Share via


DispatcherQueue.ShutdownStarting Evento

Definição

Gerado quando ShutdownQueue ou ShutdownQueueAsync é chamado. Para obter uma lista completa dos eventos gerados e em que ordem, consulte Os Comentários para 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) 

Tipo de evento

Exemplos

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

Comentários

O evento ShutdownStarting é gerado do thread do loop de eventos antes que o loop de eventos seja encerrado. O manipulador para esse evento pode fazer um adiamento e pode continuar a postar o trabalho até que o adiamento seja concluído. Depois que o adiamento for concluído, o DispatcherQueue não aceitará mais o trabalho e DispatcherQueue.TryEnqueue retornará false.

Aplica-se a