こんなつぶやきを見たので。
一方のReactiveProperty<string>が変化するとThrottleで何秒か捨ててからもう一方のRP<string>に整形しつつ反映する、ってやつで、捨てる間隔もRP<int>が変化するたびに反映させたい感じの
書いてみたけど、こんな感じかなぁ?
public class MainWindowViewModel : BindableBase { public ReactiveProperty<string> Input { get; private set; } private ReactiveProperty<string> output; public ReactiveProperty<string> Output { get { return this.output; } set { this.SetProperty(ref this.output, value); } } public ReactiveProperty<int> Interval { get; private set; } public MainWindowViewModel() { this.Input = new ReactiveProperty<string>(); this.Interval = new ReactiveProperty<int>(); this.Interval.Subscribe(v => { var initialValue = default(string); if (this.Output != null) { initialValue = this.Output.Value; this.Output.Dispose(); } this.Output = this.Input.Throttle(TimeSpan.FromSeconds(v)).ToReactiveProperty(initialValue); }); } }