jjzjj

DispatcherPriority

全部标签

windows - 如何设置 DispatcherTimer 的优先级?

我正在使用C#中的Silverlight创建适用于WindowsPhone7的应用。我发现许多对DispatcherTimer(DispatcherPriority)重载的引用,但我无法在我的代码中设置它(例如timer=newDispatcherTimer(DispatcherPriority)告诉我“DispatcherPriority在当前上下文中不存在”)。我认为DispatcherTimer被DispatcherTimer(DispatcherPriority)重载了,但是当我在我的代码中使用它时,我看不到任何对此构造函数的引用。我想尝试将优先级设置为“正常”或“发送”,但我

c# - 了解 WPF Dispatcher.BeginInvoke

我的印象是dispatcher会遵循优先级排队的操作并根据优先级执行操作或将操作添加到队列的顺序(如果优先级相同)直到我被告知WPFUI调度程序不是这种情况。有人告诉我,如果UI线程上的操作需要更长的持续时间,比如数据库读取UI调度程序简单地尝试执行队列中的下一组操作。我无法接受它,所以决定编写一个示例WPF应用程序,其中包含一个按钮和三个矩形,单击按钮时,矩形会填充不同的颜色。在代码隐藏中privatevoidOnFillColorsClick(objectsender,RoutedEventArgse){vardispatcher=Application.Current.MainW