地铁应用倒计时 [英] Countdown timer for metro App
问题描述
我是初学者在Metro风格的发展,
我试图做一个小的游戏,需要一个计时器,倒计时从10到0
但是在这个Visual Studio中没有定时器组件, DispatcherTimer未映射到了xmlns。
I'm beginner in Metro Style Developing, I tried to make a small game that's need a timer, countdown from 10 to 0. But at this Visual Studio there is no Timer Component, and DispatcherTimer Not mapped to an xmlns.
我试图用时间跨度,具有该领域的TicksPerSecond但这个例子这么想的帮助我,使我的倒计时:
的 http://msdn.microsoft.com/en-us/library/system.timespan .tickspersecond.aspx
I Tried to use TimeSpan, that have this field "TicksPerSecond" But this example dosen't help me to make my countdown timer : http://msdn.microsoft.com/en-us/library/system.timespan.tickspersecond.aspx
时间跨度也有这种方法FromSeconds,我不能也用这一个我的倒计时:
http://msdn.microsoft.com/en-us/library /system.timespan.fromseconds.aspx
TimeSpan also have this method "FromSeconds", and i Can't also use this one for my countdown timer : http://msdn.microsoft.com/en-us/library/system.timespan.fromseconds.aspx
也是我在阅读计算器这样的疑问:
的如何实现在Metro应用
定时器,但这是没有用的。
also I Read this question at stackoverflow : How to Implement a timer in Metro App but this isn't useful.
我能为这个倒数计时器办?
what can I do for this countdown timer?
推荐答案
有一个<一个HREF =http://winrtxamltoolkit.codeplex.com/SourceControl/changeset/view/13069#228449相对=nofollow> CountdownControl 中的的WinRT XAML工具包,可以帮助你太 - 它基本上是用动画的事件之间需要1秒。另一种选择是使用异步/等待关键字 - 你基本上可以说等待Task.Delay(1000),以等待一秒钟,并呼吁它在一个循环倒计时秒。这也将是便携式的。
There is a CountdownControl in the WinRT XAML Toolkit that could help you too - it is basically using an animation that takes 1s between events. Another option would be to use the async/await keywords - you can basically say await Task.Delay(1000) to wait for a second and call it in a loop to count down seconds. This would also be portable.
这篇关于地铁应用倒计时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!