Uros Bregar

Uros Bregar

  • NA
  • 15
  • 0

Windows service & Timers

Feb 12 2010 4:00 PM
Hi

I am creating a windows service which is using timers. I know I shouldn't use something like DispatcherTimer or Forms.Timer. The problem with other timers(like System.Timers.Timer or System.Threading.Timer) is that its events are raised in background threads. I tried to use the System.Threading.Timer and than use Dispatcher.CurrentDispatcher to marshal the event to the thread that created the timer but this did not work ok. I am asking the following:
Can I use Dispatcher.CurrentDispatcher and Dispatcher.Invoke in windows service app. ?
If not, can somebody direct me in the right way to solve my problem?

Any advice will be appreciated,
Uros