Schedule Manager - Rx

We are using .NET 3.5 and have started using Reactive Extensions. We use system.Reactive (Runtime Version: v2.0.50727), which is compatible with .NET 3.5.

I am trying to observe the dispatcher manager event, since I use WPF controls (it has winforms shell, with WPF host control built in), however I could not define this parameter in the Scheduler class (system.reactive.concurrency.scheduler). It appears to be available from .NET 4.0 onwards. My question is, how can I work in .NET 3.5? Please note that the call is inside my ViewModel, not View.

the 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

+7
c # system.reactive
source share
3 answers

Update: based on Rx 2.2.4.0
DispatcherScheduler for WPF is currently moving into the System.Reactive.Windows.Threading namespace.
Using the Nuget package, find Rx-WPF to download the package and use DispatcherScheduler.Current instead of Scheduler.Dispatcher

+8
source share

You should be able to use the RX Winforms extension library from http://www.nuget.org/packages/Rx-WinForms/

 this.ObservePropertyChanged(x => x.Queue) .ObserveOn(control); 

or if you are already on the right thread.

 this.ObservePropertyChanged(x => x.Queue) .ObserveOn(SynchronizationContext.Current); 
+5
source share

I think you should be able to use DispatcherScheduler.Current

+1
source share

All Articles