Dispatcher.DisableProcessing Dispatcher.DisableProcessing Dispatcher.DisableProcessing Dispatcher.DisableProcessing Method

Definición

Deshabilita el procesamiento de la cola de Dispatcher.Disables processing of the Dispatcher queue.

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

Devoluciones

Estructura usada para volver a habilitar el procesamiento del distribuidor.A structure used to re-enable dispatcher processing.

Ejemplos

El ejemplo siguiente muestra cómo deshabilitar el procesamiento del distribuidor y volver a habilitar el procesamiento del distribuidor.The following example shows how to disable dispatcher processing and re-enable dispatcher processing. DisableProcessing se llama en un mediante instrucción.DisableProcessing is called in a using statement. DisableProcessing Devuelve un DispatcherProcessingDisabled estructura que se usa como el objeto se elimina cuando el mediante bloquear finaliza.DisableProcessing returns a DispatcherProcessingDisabled structure that is used as the object to be disposed when the using block finishes. Cuando Dispose se llama en el DispatcherProcessingDisabled estructura, el procesamiento del distribuidor se vuelve a habilitar.When Dispose is called on the DispatcherProcessingDisabled structure, dispatcher processing is re-enabled.

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

Comentarios

Deshabilite el procesamiento del distribuidor es un método avanzado que está pensado para eliminar la posibilidad de reentrada no relacionada.Disabling dispatcher processing is an advanced method that is intended to eliminate the chance of unrelated reentrancy.

Los efectos de deshabilitar el procesamiento son los siguientes:The effects of disabling processing are as follows:

  • Bloqueos CLR no extrae los mensajes internamente.CLR locks will not pump messages internally.

  • DispatcherFrame no se permiten objetos que se van a insertar.DispatcherFrame objects are not allowed to be pushed.

  • No se permite el procesamiento de mensajes.Message processing is not permitted.

El DispatcherProcessingDisabled estructura que DisableProcessing devuelve cuando se llama puede utilizarse para volver a habilitar el procesamiento del distribuidor.The DispatcherProcessingDisabled structure that DisableProcessing returns when it is called can be used to re-enable dispatcher processing. Una llamada a Dispose en el DispatcherProcessingDisabled estructura vuelve a habilita el procesamiento.Calling Dispose on the DispatcherProcessingDisabled structure re-enables processing.

DisableProcessing solo se puede llamar en el subproceso de la Dispatcher está asociado.DisableProcessing can only be called on the thread the Dispatcher is associated with.

Se aplica a