Skip to content

Instantly share code, notes, and snippets.

View runceel's full-sized avatar

Kazuki Ota runceel

View GitHub Profile
using Reactive.Bindings;
using Reactive.Bindings.Binding;
using Reactive.Bindings.Extensions;
using System;
using System.Data;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Windows.Forms;
@runceel
runceel / async.ts
Last active December 14, 2020 15:47
/* 出力
now loading
now loading
now loading
done { index: 1, result: filter2: src image }
done { index: 0, result: filter1: src image }
done { index: 2, result: filter3: src image }
filter1: src image
filter2: src image
filter3: src image
@runceel
runceel / Explain.cs
Last active November 30, 2020 09:08
class BindableBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T field, T value, [CallerMemberName]string propertyName = null)
{
Debug.WriteLine("PropertyChangedが {GetType().Name} で呼ばれました。");
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
[
{
"Index": "0",
"Label": "tench, Tinca tinca"
},
{
"Index": "1",
"Label": "goldfish, Carassius auratus"
},
{
// Model
public interface IData
{
IReadOnlyList<IDatum> DatumList { get; }
}
public interface IDatum
{
IReadOnlyList<int> Numbers { get; }
}
namespace TechSummit2018.ServerlessSmartSpeaker
{
public class SmartSpeakerEndpoints
{
private IAssistant Assistant { get; }
private IPlatformService PlatformService { get; }
public SmartSpeakerEndpoints(IAssistant assistant, IPlatformService platformService)
{
Assistant = assistant;
class ViewModel
{
public ReactiveProperty<string> Input { get; }
public ReactiveProperty<string> Output { get; }
public ViewModel()
{
Input = new ReactiveProperty("");
Output = Input
.Delay(TimeSpan.FromSecond(1)) // Using a Rx method.
<TextBlock Text="{Binding Message.Value}" />
var viewModel = new SomeViewModel();
viewModel.Message.Value = "Hello world"; // set a value
Console.WriteLine(viewModel.Message.Value); // get a value
public interface IReactiveProperty<T> : IObservable<T>, INotifyPropertyChanged
{
T Value { get; set; }
}
public class ReactiveProperty<T> : IReactiveProperty<T>
{
public event PropertyChangedEventHandler PropertyChanged;
private T _value;