DispatcherProcessingDisabled Estrutura

Definição

Representa o Despachante quando este está em estado de desativação e fornece um meio para reativar o processamento do despachante.

public value class DispatcherProcessingDisabled : IDisposable
public struct DispatcherProcessingDisabled : IDisposable
type DispatcherProcessingDisabled = struct
    interface IDisposable
Public Structure DispatcherProcessingDisabled
Implements IDisposable
Herança
DispatcherProcessingDisabled
Implementações

Exemplos

O exemplo seguinte mostra como desativar o processamento do despachante e reativar o processamento do despachante. DisableProcessing é chamado numa instrução usando . DisableProcessing devolve uma DispatcherProcessingDisabled estrutura que é usada como objeto a ser descartado quando o bloco de utilização termina. A chamada Dispose à DispatcherProcessingDisabled estrutura reativa o processamento do despachante.

// 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

Observações

DisableProcessing devolve um DispatcherProcessingDisabled objeto quando é chamado.

Desativar o processamento do despachante é um método avançado destinado a eliminar a possibilidade de reentrância não relacionada.

Os efeitos de desabilitar o processamento são os seguintes:

  • Os bloqueios CLR não bombeiam mensagens internamente.

  • DispatcherFrame objetos não podem ser empurrados.

  • O processamento de mensagens não é permitido.

Ligar Dispose ao DispatcherProcessingDisabled objeto reativará o processamento do despachante.

Métodos

Name Description
Dispose()

Reativa o processamento do despachante.

Equals(Object)

Determina se o objeto especificado DispatcherProcessingDisabled é igual a este DispatcherProcessingDisabled objeto.

GetHashCode()

Recebe um código hash para esta instância.

Operadores

Name Description
Equality(DispatcherProcessingDisabled, DispatcherProcessingDisabled)

Determina se dois DispatcherProcessingDisabled objetos são iguais.

Inequality(DispatcherProcessingDisabled, DispatcherProcessingDisabled)

Determina se dois DispatcherProcessingDisabled objetos não são iguais.

Aplica-se a

Ver também