none
Rx 1.1.10425: ObserveOnDispatcher has gone? RRS feed

  • Question

  • Hello, 

    Since I updated the nuget package of Rx-Main to latest version (v1.1.10425) , I cannot find the ObserveOnDispatcher method anymore.
    Is it a breaking change? What's the new way of doing it? 
    Thank you, 
    Stéphane. 

     

     


    Live as if you were to die tomorrow. Learn as if you were to live forever.
    Thursday, May 5, 2011 1:32 PM

Answers

  • Hi Dave,

    Thank for the info. I've found this assembly in the Rx-WPF package.

    Imho this kind of feature should be part of the Rx-Main, isn't it? My project has nothing to do with WPF.

    Best regard,

    Stéphane.


    Live as if you were to die tomorrow. Learn as if you were to live forever.
    Thursday, May 5, 2011 2:23 PM

All replies

  • Hi Stéphane,

    It's still there, but you must add a reference to System.Reactive.Windows.Threading.dll.

    Edit: You probably have to download another package for this if you're using NuGet, although I'm not sure which one.

    - Dave


    http://davesexton.com/blog

    Thursday, May 5, 2011 1:57 PM
  • Hi Dave,

    Thank for the info. I've found this assembly in the Rx-WPF package.

    Imho this kind of feature should be part of the Rx-Main, isn't it? My project has nothing to do with WPF.

    Best regard,

    Stéphane.


    Live as if you were to die tomorrow. Learn as if you were to live forever.
    Thursday, May 5, 2011 2:23 PM
  • The Dispatcher is provided by WPF.  If you're not using WPF, then why do you need to ObserveOnDispatcher?

    I believe the reason that they separated it from Main is because it's a WPF-specific feature.


    http://davesexton.com/blog
    Thursday, May 5, 2011 2:31 PM
  • Hi Dave,

    Correct me if I'm wrong but I do think that it's more an UI related feature than a WPF one.

    For instance I'm using it in a plain old WinForm project (where Rx is used to call my WCF services async).

    Gtz, Stéphane.


    Live as if you were to die tomorrow. Learn as if you were to live forever.

    Thursday, May 5, 2011 7:16 PM
  • Hi Stéphane,

    I don't see the advantage of using Dispatcher in WinForms.  WinForms has it's own dispatching capability through the Control class (also from which Form derives).  So using Dispatcher only adds extra WPF library dependencies to your project.

    Rx provides another library that supports WinForms Control scheduling: System.Reactive.Windows.Forms.dll.  I bet there's a separate NuGet package for that too, perhaps Rx-WinForms.  You should probably be using it instead of Rx-WPF.

    Edit: Alternatively, SynchronizationContext can be used for both WPF and WinForms.  That's more like the UI-agnostic dispatcher you were thinking of.

    - Dave


    http://davesexton.com/blog

    • Proposed as answer by Richard Hein Friday, May 6, 2011 12:25 AM
    Thursday, May 5, 2011 9:26 PM
  • Thanks for the clarification. The thing is that my design is as follow:

    View -> Presenter -> Model (which calls WCF through Rx Observable.FromAsyncPattern).

    The problem is that I don't have any link to my view in the Model class, so I can't refer to a Control. That's why I was using "ObserveOnDispatcher" (to avoid cross thread violation on UI update).

    I'll definitely take a look to SynchronizationContext which seems to be a more appropriate way.

    Gtz,

    Stéphane.


    Live as if you were to die tomorrow. Learn as if you were to live forever.

    Friday, May 6, 2011 6:13 AM