DispatcherQueue.ShutdownStarting Event
Definition
Fires before the dispatcher queue initiates an exit from its event loop.
// 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
ShutdownStarting_revoker ShutdownStarting(auto_revoke_t, TypedEventHandler<DispatcherQueue, DispatcherQueueShutdownStartingEventArgs const &> const& handler) const;
public event TypedEventHandler<DispatcherQueue,DispatcherQueueShutdownStartingEventArgs> ShutdownStarting;
Public Custom Event ShutdownStarting As TypedEventHandler(Of DispatcherQueue, DispatcherQueueShutdownStartingEventArgs)
Event Type
- Windows.Foundation.TypedEventHandler<DispatcherQueue,DispatcherQueueShutdownStartingEventArgs>
Examples
_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
});
};
Remarks
The event is fired on the thread running the DispatcherQueue event loop.
This event fires before the DispatcherQueue initiates the exit from the event loop. Event handlers for this event can queue work from within the handler. The event handler can take a deferral and continue to post work to the DispatcherQueue until the deferral completes. Once the deferral completes, no new work will be accepted by the DispatcherQueue.