Breyta

Deila með


DispatcherProcessingDisabled Struct

Definition

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
Inheritance
DispatcherProcessingDisabled
Implements

Examples

The following example shows how to disable dispatcher processing and re-enable dispatcher processing. DisableProcessing is called in a using statement. DisableProcessing returns a DispatcherProcessingDisabled structure which is used as the object to be disposed when the using block finishes. 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

Remarks

DisableProcessing returns a DispatcherProcessingDisabled object when it is called.

Disabling dispatcher processing is an advanced method that is intended to eliminate the chance of unrelated reentrancy.

The effects of disabling processing are as follows:

  • CLR locks will not pump messages internally.

  • DispatcherFrame objects are not allowed to be pushed.

  • Message processing is not permitted.

Calling Dispose on the DispatcherProcessingDisabled object will re-enable dispatcher processing.

Methods

Dispose()

Re-enables dispatcher processing.

Equals(Object)

Determines whether the specified DispatcherProcessingDisabled object is equal to this DispatcherProcessingDisabled object.

GetHashCode()

Gets a hash code for this instance.

Operators

Equality(DispatcherProcessingDisabled, DispatcherProcessingDisabled)

Determines whether two DispatcherProcessingDisabled objects are equal.

Inequality(DispatcherProcessingDisabled, DispatcherProcessingDisabled)

Determines whether two DispatcherProcessingDisabled objects are not equal.

Applies to

See also