共用方式為


DispatcherQueue.ShutdownStarting 事件

定義

呼叫 ShutdownQueueShutdownQueueAsync 時引發。 如需引發之事件的完整清單,以及順序為何,請參閱 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 回 。

適用於