Where is timer in a Windows store app?

后端 未结 2 1770
小鲜肉
小鲜肉 2020-12-06 09:44

I could not find the Timer when developing a Windows Store App in c#. What is the alternative /new name/way of use of it?

相关标签:
2条回答
  • 2020-12-06 10:31

    Different timers for different needs. Roughly...

    DispatcherTimer - When you want work to be executed on the UI thread.

    ThreadPoolTimer - When you want work to be executed on a background thread.

    0 讨论(0)
  • 2020-12-06 10:50

    DispatcherTimer is what you are looking for

    var timer = new DispatcherTimer();
    timer.Tick += DispatcherTimerEventHandler;
    timer.Interval = new TimeSpan(0,0,0,1);
    timer.Start();
    
    0 讨论(0)
提交回复
热议问题