1

i have a wpf app that is updating date/time in one dispatchertimer, another is for a mp3 player timer that tracks time and slidebar for playing time. is it possible to have 2 dispatchertimer's running?

that's dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); and dispatcherTimer.Tick += new EventHandler(mp3Timer_Tick);

darthwillard
  • 809
  • 2
  • 14
  • 28

1 Answers1

1

Yes, it's possible.

What you are doing is something different: You are trying to attach two event handlers to one DispatcherTimer. Don't do that. If you want two timers for different purposes (and with different timeouts), use two DispatcherTimer objects:

dateTimeTimer.Tick += new EventHandler(dateTimeTimer_Tick); 
mp3Timer.Tick += new EventHandler(mp3Timer_Tick);

Then you can do something like...

mp3Timer.Stop();

...when the music stops playing, and it won't affect the dateTimeTimer.

Heinzi
  • 167,459
  • 57
  • 363
  • 519