Where is timer in a Windows store app?

时间秒杀一切 提交于 2019-12-17 16:33:42

问题


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?


回答1:


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.




回答2:


DispatcherTimer is what you are looking for

var timer = new DispatcherTimer();
timer.Tick += DispatcherTimerEventHandler;
timer.Interval = new TimeSpan(0,0,0,1);
timer.Start();


来源:https://stackoverflow.com/questions/13772955/where-is-timer-in-a-windows-store-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!