CoreDispatcher class

Applies to Windows and Windows Phone

Provides the Windows Runtime core event message dispatcher. Instances of this type are responsible for processing the window messages and dispatching the events to the client.

Syntax

Public NotInheritable Class CoreDispatcher
    Implements ICoreAcceleratorKeys

Attributes

[MarshalingBehavior(Agile)]
[Muse()]
[Version(0x06020000)]
[WebHostHidden()]

Members

The CoreDispatcher class has these types of members:

Events

The CoreDispatcher class has these events.

EventDescription
AcceleratorKeyActivated Fired when an accelerator key is activated (pressed or held down).

 

Methods

The CoreDispatcher class has these methods. It also inherits methods from the Object class.

MethodDescription
ProcessEvents Starts the dispatcher processing the input event queue for this instance of CoreWindow.
RunAsync Schedules the provided callback on the UI thread from a worker thread, and returns the results asynchronously.
RunIdleAsync Schedules a callback on the UI thread from a worker thread at idle priority, and returns the results asynchronously.
ShouldYield() Queries whether the caller should yield if there are items in the task queue of higher priority than the current task.
ShouldYield(CoreDispatcherPriority) Queries whether the caller should yield if there are items in the task queue of the specified priority or higher.
StopProcessEvents Stops the dispatcher from processing any queued events.

 

Properties

The CoreDispatcher class has these properties.

PropertyAccess typeDescription

CurrentPriority

Read/writeGets and sets the priority of the current task.

HasThreadAccess

Read-onlyGets a value that specifies whether the event dispatcher provided by this instance of CoreWindow has access to the current thread or not.

 

Remarks

Instances of this type can be obtained from the CoreWindow.Dispatcher property. The current CoreWindow instance can be obtained by calling CoreWindow.GetForCurrentThread.


void MyCoreWindowEvents::Run() // this is an implementation of IFrameworkView::Run() used to show context. It is called by CoreApplication::Run().
{
    CoreWindow::GetForCurrentThread()->Activate();

    /...

    CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit);
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.UI.Core
Windows::UI::Core [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft