Dispatcher.DisableProcessing 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
큐 처리를 Dispatcher 사용하지 않도록 설정합니다.
public:
System::Windows::Threading::DispatcherProcessingDisabled DisableProcessing();
public System.Windows.Threading.DispatcherProcessingDisabled DisableProcessing();
member this.DisableProcessing : unit -> System.Windows.Threading.DispatcherProcessingDisabled
Public Function DisableProcessing () As DispatcherProcessingDisabled
반품
디스패처 처리를 다시 사용하도록 설정하는 데 사용되는 구조체입니다.
예제
다음 예제에서는 디스패처 처리를 사용하지 않도록 설정하고 디스패처 처리를 다시 사용하도록 설정하는 방법을 보여 줍니다. DisableProcessing using 문에서 호출됩니다. DisableProcessing 는 DispatcherProcessingDisabled사용 블록이 완료될 때 삭제할 개체로 사용되는 구조를 반환합니다. Dispose 구조체에서 DispatcherProcessingDisabled 호출되면 디스패처 처리가 다시 활성화됩니다.
// 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
설명
디스패처 처리를 사용하지 않도록 설정하는 것은 관련 없는 재진입 가능성을 제거하기 위한 고급 방법입니다.
처리를 사용하지 않도록 설정하면 다음과 같은 효과가 발생합니다.
CLR 잠금은 내부적으로 메시지를 펌핑하지 않습니다.
DispatcherFrame 개체를 푸시할 수 없습니다.
메시지 처리는 허용되지 않습니다.
DispatcherProcessingDisabled 호출될 때 반환되는 DisableProcessing 구조체를 사용하여 디스패처 처리를 다시 사용하도록 설정할 수 있습니다. 구조를 호출 Dispose 하면 DispatcherProcessingDisabled 처리가 다시 활성화됩니다.
DisableProcessing 는 연결된 스레드 Dispatcher 에서만 호출할 수 있습니다.