[UWP] [C#] DispatcherTemer [英] [UWP][C#] DispatcherTImer

查看:76
本文介绍了[UWP] [C#] DispatcherTemer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用DispatcherTimer? 


我想在UWP中创建一个计时器,这使我能够每秒更新一次。


例如:


我已经使用我的rfduino设置了mpu6050。因此,当我点击"阅读"时,它将显示"90度"。但如果我将我的mpu6050移动到另一个角度,我的c#将自动更新新值。


可以有人帮我这个吗?  

解决方案

对于一次性计时器,请考虑
CreateTimer



如果需要,您可以在处理程序的末尾安排新的工作项。


< p style =" margin:0px 0px 10.66px"> 对于定期事件,请检查
TimeTrigger



 


另见:



 





How do I use DispatcherTimer ? 

I want to create a timer in UWP which enables me to update values every second.

For example:

I have setup a mpu6050 with my rfduino. So when I click "read", it will display "90 degree". But if I were to move my mpu6050 to a different angle, my c# will update the new value automatically.

Can anyone help me with this ?  

解决方案

For one-shot timer, consider CreateTimer:

At the end of the handler you can schedule a new work item, if required.

For periodic events, check TimeTrigger:

 

See also:

 



这篇关于[UWP] [C#] DispatcherTemer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆