DispatcherProcessingDisabled 结构  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示处于禁用状态的调度程序,并提供重新启用调度程序处理的方法。
public value class DispatcherProcessingDisabled : IDisposablepublic struct DispatcherProcessingDisabled : IDisposabletype DispatcherProcessingDisabled = struct
    interface IDisposablePublic Structure DispatcherProcessingDisabled
Implements IDisposable- 继承
- 实现
示例
以下示例演示如何禁用调度程序处理并重新启用调度程序处理。 DisableProcessing 在 using 语句中调用。 DisableProcessing 返回一个 DispatcherProcessingDisabled 结构,该结构用作 在使用 块完成时要释放的对象。 调用DisposeDispatcherProcessingDisabled结构可重新启用调度程序处理。
// The Dispose() method is called at the end of the using statement.
// Calling Dispose on the DispatcherProcessingDisabled structure, 
// which is returned from the call to DisableProcessing, will
// re-enalbe Dispatcher processing.
using (Dispatcher.DisableProcessing())
{
    // Do work while the dispatcher processing is disabled.
    Thread.Sleep(2000);
}
' The Dispose() method is called at the end of the using statement.
' Calling Dispose on the DispatcherProcessingDisabled structure, 
' which is returned from the call to DisableProcessing, will
' re-enable Dispatcher processing.
Using Dispatcher.DisableProcessing()
    ' Do work while the dispatcher processing is disabled.
    Thread.Sleep(2000)
End Using
注解
DisableProcessing 调用对象时返回对象 DispatcherProcessingDisabled 。
禁用调度程序处理是一种高级方法,旨在消除不相关的重新进入的可能性。
禁用处理的效果如下:
- CLR 锁不会在内部泵送消息。 
- DispatcherFrame 不允许推送对象。 
- 不允许消息处理。 
调用DisposeDispatcherProcessingDisabled对象将重新启用调度程序处理。
方法
| Dispose() | 重新启用调度程序处理。 | 
| Equals(Object) | 确定指定的 DispatcherProcessingDisabled 对象是否等同于此 DispatcherProcessingDisabled 对象。 | 
| GetHashCode() | 获取此实例的哈希代码。 |