You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StephenCleary edited this page Sep 5, 2014
·
1 revision
Overview
The DeferralManager type simplifies the writing of "command-style" events. Regular events don't care when their handlers complete, so they work with async event handlers just fine. Command-style events need to know when their handlers are complete, even if they're async.
The DeferralManager type uses a pattern similar to WinRT deferrals: the event argument type provides a GetDeferral and can detect when all deferrals have completed.
API
// Manages the deferrals for a "command" event that may have asynchonous handlers.publicsealedclassDeferralManager{// Gets a deferral. The deferral is complete when disposed.publicIDisposableGetDeferral();// Notifies the manager that all deferrals have been requested, and returns a task that is completed// when all deferrals have completed.publicTaskSignalAndWaitAsync();}