DispatcherQueue.ShutdownStarting イベント

定義

ShutdownQueue または ShutdownQueueAsync が呼び出されたときに発生します。 発生するイベントの完全な一覧と順序については、「 ShutdownQueueAsync の備考」を参照してください。

// Register
event_token ShutdownStarting(TypedEventHandler<DispatcherQueue, DispatcherQueueShutdownStartingEventArgs const&> const& handler) const;

// Revoke with event_token
void ShutdownStarting(event_token const* cookie) const;

// Revoke with event_revoker
DispatcherQueue::ShutdownStarting_revoker ShutdownStarting(auto_revoke_t, TypedEventHandler<DispatcherQueue, DispatcherQueueShutdownStartingEventArgs const&> const& handler) const;
public event TypedEventHandler<DispatcherQueue,DispatcherQueueShutdownStartingEventArgs> ShutdownStarting;
function onShutdownStarting(eventArgs) { /* Your code */ }
dispatcherQueue.addEventListener("shutdownstarting", onShutdownStarting);
dispatcherQueue.removeEventListener("shutdownstarting", onShutdownStarting);
- or -
dispatcherQueue.onshutdownstarting = onShutdownStarting;
Public Custom Event ShutdownStarting As TypedEventHandler(Of DispatcherQueue, DispatcherQueueShutdownStartingEventArgs) 

イベントの種類

_dispatcherQueue.ShutdownStarting += (s, e) =>
{
    // Queue is shutting down, do this last operation to  
    // update state before the dispatcher loop exits
    _queue.TryEnqueue(
        () =>
        {
            // clean up state
        });
};

注釈

ShutdownStarting イベントは、イベント ループが終了する前にイベント ループ スレッドから発生します。 このイベントのハンドラーは遅延を受け取ることができ、遅延が完了するまで作業をポストし続けることができます。 遅延が完了すると、 DispatcherQueue は作業を受け入れなくなり、 DispatcherQueue.TryEnqueue は を返します false

適用対象