DispatcherQueue Class

Definition

Manages a prioritized queue on which tasks execute in a serial fashion on a thread.

public ref class DispatcherQueue sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.LiftedContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class DispatcherQueue final
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
class DispatcherQueue final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.LiftedContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class DispatcherQueue
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
public sealed class DispatcherQueue
Public NotInheritable Class DispatcherQueue
Inheritance
Object Platform::Object IInspectable DispatcherQueue
Attributes

Remarks

All tasks dispatched to a queue execute on the same thread.

Properties

HasThreadAccess

Gets a value indicating whether the DispatcherQueue has access to the current thread.

Methods

CreateTimer()

Creates a DispatcherQueueTimer on the DispatcherQueue to execute a task periodically after a time interval has elapsed.

EnqueueEventLoopExit()

Enqueues a message loop exit message.

EnsureSystemDispatcherQueue()

Causes the Microsoft.UI.Dispatching.DispatcherQueue to manage the shutdown of the system DispatcherQueue (Windows.System.DispatcherQueue) from the same thread.

GetForCurrentThread()

Gets the DispatcherQueue associated with the current thread.

RunEventLoop()

Runs a message loop until either EnqueueEventLoopExit or PostQuitMessage is called. Also handles raising the ShutdownStarting/ShutdownCompleted and FrameworkShutdownStarting/FrameworkShutdownCompleted events.

RunEventLoop(DispatcherRunOptions, DispatcherExitDeferral)

Runs a message loop until either EnqueueEventLoopExit or PostQuitMessage is called. Also handles raising the ShutdownStarting/ShutdownCompleted and FrameworkShutdownStarting/FrameworkShutdownCompleted events.

TryEnqueue(DispatcherQueueHandler)

Adds a task to the DispatcherQueue that will be executed on the thread associated with the DispatcherQueue.

TryEnqueue(DispatcherQueuePriority, DispatcherQueueHandler)

Adds a task to the DispatcherQueue that will be executed on the thread associated with the DispatcherQueue with the specified priority.

Events

FrameworkShutdownCompleted

Raised when either ShutdownQueue or ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

FrameworkShutdownStarting

Raised when either ShutdownQueue or ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

ShutdownCompleted

Raised when either ShutdownQueue or ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

ShutdownStarting

Raised when either ShutdownQueue or ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

Applies to