I have 2 threads, WPF+PIPE. I register the from the WPF on the pipe rx event. when using ObserveOnDispatcher() the registered handler is not called, when removing the ObserveOnDispatcher() it is called on the pipe thread. Does anyone have ideas why it is not called at all when using ObserveOnDispatcher()?
DispatcherObservable.ObserveOnDispatcher
takes the dispatcher of the current thread at the time when it is called. If you call it from a background thread, it will look for a dispatcher on that thread (if it has one).
If you want to call back to the UI thread, you'll need to get the IScheduler
from Scheduler.Dispatcher
while on the UI thread (like at the start of the application) and pass that instance to your background thread. You can then use ObserveOn(dispatcherSchedulerInstance)
to schedule back to the UI thread.
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