DispatcherQueue.ShutdownStarting Kejadian
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Dimunculkan saat ShutdownQueueAsync dipanggil. Untuk daftar lengkap peristiwa yang dimunculkan, dan dalam urutan apa, lihat Keterangan untuk 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)
Jenis Acara
Contoh
_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
});
};
Keterangan
Peristiwa ShutdownStarting dinaikkan dari utas perulangan peristiwa sebelum perulangan peristiwa keluar. Handler untuk kejadian ini dapat mengambil penangguhan, dan dapat terus memposting pekerjaan sampai penangguhan selesai. Setelah penahanan selesai, DispatcherQueue tidak lagi menerima pekerjaan, dan DispatcherQueue.TryEnqueue mengembalikan false
.