Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.37 KB

dispatcherqueue_shutdownstarting.md

File metadata and controls

35 lines (26 loc) · 1.37 KB
-api-id -api-type
E:Microsoft.UI.Dispatching.DispatcherQueue.ShutdownStarting
winrt event

Microsoft.UI.Dispatching.DispatcherQueue.ShutdownStarting

-description

Raised when either ShutdownQueue or ShutdownQueueAsync is called. For a full list of the events raised, and in what order, see the Remarks for ShutdownQueueAsync.

-remarks

The ShutdownStarting event is raised from the event loop thread before the event loop exits. The handler for this event can take a deferral, and can continue to post work until the deferral completes. Once the deferral completes, the DispatcherQueue no longer accepts work, and DispatcherQueue.TryEnqueue returns false.

-see-also

-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
        });
};