DispatcherProcessingDisabled Estrutura
Definição
Representa o Dispatcher quando ele está em um estado desabilitado e fornece um meio de habilitar o processamento do dispatcher novamente.Represents the Dispatcher when it is in a disable state and provides a means to re-enable dispatcher processing.
public value class DispatcherProcessingDisabled : IDisposable
public struct DispatcherProcessingDisabled : IDisposable
type DispatcherProcessingDisabled = struct
interface IDisposable
Public Structure DispatcherProcessingDisabled
Implements IDisposable
- Herança
- Implementações
Exemplos
O exemplo a seguir mostra como desabilitar o processamento do Dispatcher e reabilitar o processamento do Dispatcher.The following example shows how to disable dispatcher processing and re-enable dispatcher processing. DisableProcessingé chamado em uma instrução using .DisableProcessing is called in a using statement. DisableProcessingRetorna uma DispatcherProcessingDisabled estrutura que é usada como o objeto a ser Descartado quando o bloco using é concluído.DisableProcessing returns a DispatcherProcessingDisabled structure which is used as the object to be disposed when the using block finishes. A Dispose chamada na DispatcherProcessingDisabled estrutura habilita novamente o processamento do Dispatcher.Calling Dispose on the DispatcherProcessingDisabled structure re-enables dispatcher processing.
// 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
Comentários
DisableProcessingRetorna um DispatcherProcessingDisabled objeto quando ele é chamado.DisableProcessing returns a DispatcherProcessingDisabled object when it is called.
A desabilitação do processamento do Dispatcher é um método avançado que se destina a eliminar a chance de reentrância não relacionada.Disabling dispatcher processing is an advanced method that is intended to eliminate the chance of unrelated reentrancy.
Os efeitos da desabilitação do processamento são os seguintes:The effects of disabling processing are as follows:
Os bloqueios de CLR não Bombeam as mensagens internamente.CLR locks will not pump messages internally.
DispatcherFrameos objetos não podem ser enviados por push.DispatcherFrame objects are not allowed to be pushed.
O processamento de mensagens não é permitido.Message processing is not permitted.
A Dispose chamada no DispatcherProcessingDisabled objeto habilitará novamente o processamento do Dispatcher.Calling Dispose on the DispatcherProcessingDisabled object will re-enable dispatcher processing.
Métodos
Dispose() |
Habilita o processamento do dispatcher novamente.Re-enables dispatcher processing. |
Equals(Object) |
Determina se o objeto DispatcherProcessingDisabled especificado é igual a este objeto DispatcherProcessingDisabled.Determines whether the specified DispatcherProcessingDisabled object is equal to this DispatcherProcessingDisabled object. |
GetHashCode() |
Obtém um código hash para essa instância.Gets a hash code for this instance. |
Operadores
Equality(DispatcherProcessingDisabled, DispatcherProcessingDisabled) |
Determina se dois objetos DispatcherProcessingDisabled são iguais.Determines whether two DispatcherProcessingDisabled objects are equal. |
Inequality(DispatcherProcessingDisabled, DispatcherProcessingDisabled) |
Determina se dois objetos DispatcherProcessingDisabled não são iguais.Determines whether two DispatcherProcessingDisabled objects are not equal. |