We are using .NET 3.5 and has started using Reactive Extensions. We are using system.Reactive (Runtime Version:v2.0.50727) which is compatible for .NET 3.5.
I'm trying to observe an event on the dispatcher scheduler since I'm using WPF controls(it's winforms shell, with WPF host control embedded), however I could not spot that option on Scheduler class(system.reactive.concurrency.scheduler). Looks like its available from .NET 4.0 onwards. My question is, how do I get this working in .NET 3.5? Note that the call is happening inside my ViewModel and not View.
Code:
this.ObservePropertyChanged(x => x.Queue)
//I cant find scheduler dispatcher option,
//there are other options such as current, imeediete, new etc.
.ObserveOn(Scheduler.Dispatcher)
.Subscribe(RefreshQueues);
Thanks,
-Mike
Update: based on Rx 2.2.4.0
DispatcherScheduler for WPF is currently moved into System.Reactive.Windows.Threading namespace.
Using Nuget package, search for Rx-WPF to download the package and use DispatcherScheduler.Current in place of Scheduler.Dispatcher
You should be able to do with the RX Winforms extension library from http://www.nuget.org/packages/Rx-WinForms/
this.ObservePropertyChanged(x => x.Queue)
.ObserveOn(control);
or if you are on the correct thread already.
this.ObservePropertyChanged(x => x.Queue)
.ObserveOn(SynchronizationContext.Current);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With