开发者

DispatcherTimer Constructors

开发者 https://www.devze.com 2023-03-14 11:25 出处:网络
How come in some classes I have to specify this constructor to get the c开发者_StackOverflow中文版allback to be invoked?

How come in some classes I have to specify this constructor to get the c开发者_StackOverflow中文版allback to be invoked?

_timer = new DispatcherTimer(DispatcherPriority.Normal, Application.Current.Dispatcher);

Instead of just:

_timer = new DispatcherTimer();


The default constructor will use the current Dispatcher instead of the current application's Dispatcher. If this is called on a thread other than the UI thread, the first overload is required in order to get the correct synchronization context.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号