DispatcherProcessingDisabled 構造体

定義

ディスパッチャーが無効状態にある場合に、ディスパッチャーを表し、ディスパッチャーの処理を再度有効にする手段を提供します。

public value class DispatcherProcessingDisabled : IDisposable
public struct DispatcherProcessingDisabled : IDisposable
type DispatcherProcessingDisabled = struct
    interface IDisposable
Public Structure DispatcherProcessingDisabled
Implements IDisposable
継承
DispatcherProcessingDisabled
実装

次の例は、ディスパッチャー処理を無効にし、ディスパッチャー処理を再度有効にする方法を示しています。 DisableProcessingusing ステートメントで呼び出されます。 DisableProcessing は、using ブロックの終了時に破棄されるオブジェクトとして使用される DispatcherProcessingDisabled 構造体 返します。 DispatcherProcessingDisabled構造体でDisposeを呼び出すと、ディスパッチャーの処理が再度有効になります。

// 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 オブジェクトはプッシュできません。

  • メッセージ処理は許可されません。

DispatcherProcessingDisabled オブジェクトでDisposeを呼び出すと、ディスパッチャー処理が再度有効になります。

メソッド

名前 説明
Dispose()

ディスパッチャー処理を再度有効にします。

Equals(Object)

指定した DispatcherProcessingDisabled オブジェクトがこの DispatcherProcessingDisabled オブジェクトと等しいかどうかを判断します。

GetHashCode()

このインスタンスのハッシュ コードを取得します。

演算子

名前 説明
Equality(DispatcherProcessingDisabled, DispatcherProcessingDisabled)

2 つの DispatcherProcessingDisabled オブジェクトが等しいかどうかを判断します。

Inequality(DispatcherProcessingDisabled, DispatcherProcessingDisabled)

2 つの DispatcherProcessingDisabled オブジェクトが等しくないかどうかを判断します。

適用対象

こちらもご覧ください