DispatcherPriority 枚举

DispatcherPriority 枚举

ApplicationIdle 2枚举值为 2。 在应用程序空闲时处理操作。
Background 4 枚举值为 4。 在完成所有其他非空闲操作后处理操作。
ContextIdle 3 枚举值为 3。 在完成后台操作后处理操作。
DataBind 8 枚举值为 8。 按与数据绑定相同的优先级处理操作。
Inactive 0 枚举值为 0。 操作未处理。
Input 5 枚举值为 5。 按与输入相同的优先级处理操作。
Invalid -1 枚举值为 -1。 这是一个无效的优先级。
Loaded 6 枚举值为 6。 在布局和呈现已完成,即将按输入优先级处理项之前处理操作。 具体来说,此值在引发 Loaded 事件时使用。
Normal 9 枚举值为 9。 按正常优先级处理操作。 这是典型的应用程序优先级。
Render 7 枚举值为 7。 按与呈现相同的优先级处理操作。
Send 10 枚举值为 10。 在其他异步操作之前处理操作。 这是最高优先级。
SystemIdle 1 枚举值为 1。 在系统空闲时处理操作。

使用示例:(调用Dispatcher.BeginInvoke 方法,向其传入一个具有一个参数的委托,设置起优先级为 Normal)

// Schedule the update function in the UI thread.
tomorrowsWeather.Dispatcher.BeginInvoke(
    System.Windows.Threading.DispatcherPriority.Normal,
    new OneArgDelegate(UpdateUserInterface), 
    weather);

注: 如果设置为 Send 优先级别,则该操作会绕过队列立即执行。

原文地址:https://www.cnblogs.com/runningRain/p/13722725.html