locked
Timer or DispatcherTimer for WCF Callback? RRS feed

  • Question

  • In my service I let clients subscribe to certain information and then I use a callback to send that information to the clients. As it is desgined now I use a Timer that make callbacks at each tick. Would it be better to use a DispatcherTimer? If so, why?

    Thanks for help!
    Monday, November 9, 2009 3:03 PM

Answers

  • For non-UI applications (like services), the Timer class is usually preferred, since DispatcherTimer will always post the callback in the UI queue to be dispatched in the UI thread. DispatcherTimer also adds a dependency to the WPF (WindowsBase.dll, I think), which may not be necessary on non-UI apps. That is a minor advantage in case you need to run your service in the IA64 architecture, which currently doesn't support WCF - this is not a very common scehario, though.

    • Marked as answer by xkrja Monday, November 9, 2009 3:32 PM
    Monday, November 9, 2009 3:15 PM