Where is timer in a Windows store app?

2019-01-15 06:14发布

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条回答
手持菜刀,她持情操
2楼-- · 2019-01-15 07:07

DispatcherTimer is what you are looking for

var timer = new DispatcherTimer();
timer.Tick += DispatcherTimerEventHandler;
timer.Interval = new TimeSpan(0,0,0,1);
timer.Start();
查看更多
放荡不羁爱自由
3楼-- · 2019-01-15 07:11

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.

查看更多
登录 后发表回答