本文介绍了将DispatcherTimer.Start()计为tick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF中有一个调度员,我发现它非常令人沮丧,因为当我开始()它时,它不算作一个滴答声。目前它的功能是这样的:



开始()[间隔]

[tick]

[interval]

[tick]

...

我怎么能这样做,所以Start()计为勾号并开始立即让它像这样工作?:

开始()[勾]

[间隔]

[tick]

否则我必须复制在启动计时器之前在tick事件中发生的事情,这不是非常有效,因为我只是想让计时器立即启动。

I have a dispatchertimer in WPF and I am finding it very frustrating because when I Start() it, it does not count as a tick. At the moment it's functionality is like this:

Start() [interval]
[tick]
[interval]
[tick]
...
How can I make it so the Start() counts as a tick and it starts immediately and make it work like this?:
Start() [tick]
[interval]
[tick]
Otherwise I have to duplicate what happens in the tick event before starting the timer which is not very efficient as I just want the timer to start immediately.

推荐答案



这篇关于将DispatcherTimer.Start()计为tick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 01:25