什么是“IsEnabled”和DispatcherTimer的“开始/停止”之间有什么不同? [英] What is the different between 'IsEnabled' and 'Start/Stop' of DispatcherTimer?

查看:776
本文介绍了什么是“IsEnabled”和DispatcherTimer的“开始/停止”之间有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得IsEnabled = FALSE /真同样具有一流的System.Windows.Threading.DispatcherTimer
的停止/启动方法一样,对吗?

I think that IsEnabled = false/true is equally the same with Stop/Start method of class System.Windows.Threading.DispatcherTimer Am I right?


开始():一个完整​​的间隔倒数计时开始。
IsEnabled = FALSE:暂停计时器,间隔倒计时仍然存在。
IsEnabled =真:恢复定时器和放大器;继续上次使用的时间间隔倒计时。
停止():停止计时,将间隔倒计时重置

Start() : begin timer with a full interval countdown. IsEnabled = false : pause the timer, the interval countdown remains. IsEnabled = true : resume the timer & continue with the last used interval countdown. Stop() : stop the timer, will the interval countdown reset?

推荐答案

考虑到启动/停止切换的 IsEnabled 属性,你的假设是接近。

Considering that Start/Stop toggles the IsEnabled property, your assumption is close.

启动/停止不同的间隔复位,那里的只是翻转 IsEnabled 不会复位间隔

Start/Stop differs as the Interval is reset, where as just toggling the IsEnabled will not reset the Interval.

从的MSDN

设置IsEnabled为false时,
启动计时器停止计时器。

Setting IsEnabled to false when the timer is started stops the timer.


定时器停止设置IsEnabled为true,启动定时器。

Setting IsEnabled to true when the timer is stopped starts the timer.

开始设置IsEnabled为true。

Start sets IsEnabled to true.

启动复位定时器间隔。

编辑:
我的意思间隔为复位的不​​是Interval属性本身,而是决定后台间隔有多长,直到下一个滴答事件被解雇了。

What I mean by the interval being reset is not the Interval property itself, but the background interval that determines how long until the next tick event is fired.

例如。如果你有1000毫秒的间隔,并停止/禁用它,如果有250ms的运行(它运行750毫秒),这是结果取决于你如何再次启动它。

Eg. If you have an interval of 1000ms and you stop/disable it if with 250ms to run (it's run for 750ms), this is the result depending on how you start it again.


  • 如果您开始(),然后通过间隔将被重置回为0,这将是在<$ 1000毫秒C $ C>勾选事件引发。

  • 与如果重新启用 IsEnabled = TRUE 那么它会继续从它的当前位置和勾选活动将在250毫秒提高。

  • If you start it with Start(), then the passed interval will be reset back to 0 and it will be 1000ms before the Tick event is raised.
  • If you re-enable it with IsEnabled = true then it will continue from it's current location and the Tick event will be raised in 250ms.

我希望这阐明它。

这篇关于什么是“IsEnabled”和DispatcherTimer的“开始/停止”之间有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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