CoreDispatcher 클래스

정의

Windows 런타임 핵심 이벤트 메시지 디스패처를 제공합니다. 이 유형의 인스턴스는 창 메시지를 처리하고 클라이언트에 이벤트를 디스패치합니다.

public ref class CoreDispatcher sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CoreDispatcher final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class CoreDispatcher
Public NotInheritable Class CoreDispatcher
상속
Object Platform::Object IInspectable CoreDispatcher
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

설명

이 형식의 인스턴스는 CoreWindow.Dispatcher 속성에서 가져올 수 있습니다. 현재 CoreWindow instance CoreWindow.GetForCurrentThread를 호출하여 가져올 수 있습니다.

// App.cpp
...
// An implementation of IFrameworkView::Run.
void Run()
{
    CoreWindow window{ CoreWindow::GetForCurrentThread() };
    window.Activate();

    CoreDispatcher dispatcher{ window.Dispatcher() };
    dispatcher.ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit);
}

// The CoreApplication::Run call indirectly calls the App::Run function above.
int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
{
    CoreApplication::Run(App());
}
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);
}

속성

CurrentPriority

현재 작업의 우선 순위를 가져오고 설정합니다.

HasThreadAccess

CoreWindow instance 제공된 이벤트 디스패처가 현재 스레드에 액세스할 수 있는지 여부를 지정하는 값을 가져옵니다.

메서드

ProcessEvents(CoreProcessEventsOption)

이 CoreWindow instance 대한 입력 이벤트 큐를 처리하는 디스패처를 시작합니다.

RunAsync(CoreDispatcherPriority, DispatchedHandler)

작업자 스레드에서 UI 스레드에서 제공된 콜백을 예약하고 결과를 비동기적으로 반환합니다.

RunIdleAsync(IdleDispatchedHandler)

유휴 우선 순위의 작업자 스레드에서 UI 스레드에 대한 콜백을 예약하고 결과를 비동기적으로 반환합니다.

ShouldYield()

현재 작업보다 우선 순위가 높은 작업 큐에 항목이 있는 경우 호출자가 생성해야 하는지 여부를 쿼리합니다.

ShouldYield(CoreDispatcherPriority)

지정된 우선 순위 이상의 작업 큐에 항목이 있는 경우 호출자가 생성해야 하는지 여부를 쿼리합니다.

StopProcessEvents()

디스패처가 큐에 대기 중인 이벤트를 처리하지 못하도록 합니다.

TryRunAsync(CoreDispatcherPriority, DispatchedHandler)

작업자 스레드에서 UI 스레드에서 지정된 콜백을 예약하고 결과를 비동기적으로 반환합니다.

TryRunIdleAsync(IdleDispatchedHandler)

유휴 우선 순위의 작업자 스레드에서 UI 스레드에 대한 콜백을 예약하고 결과를 비동기적으로 반환합니다.

이벤트

AcceleratorKeyActivated

가속기 키가 활성화될 때 발생합니다(누르거나 누름).

적용 대상