See Also: AsyncOperation Members
When you implement a class according to the Event-based Asynchronous Pattern Overview, you may need to track the lifetime of each asynchronous operation invoked on an instance of your class. The System.ComponentModel.AsyncOperation class provides ways to track and report the progress of an asynchronous task.
The following list identifies ways to use an System.ComponentModel.AsyncOperation object:
To report progress and interim results to the client, call AsyncOperation.Post(System.Threading.SendOrPostCallback, object) from your asynchronous worker code.
To indicate that an asynchronous task has completed, or to cancel a pending asynchronous task, call AsyncOperation.PostOperationCompleted(System.Threading.SendOrPostCallback, object).
Your class should get an System.ComponentModel.AsyncOperation object for each asynchronous task by calling AsyncOperationManager.CreateOperation(object) when each task starts. To allow the client to distinguish separate asynchronous tasks, AsyncOperationManager.CreateOperation(object) takes a parameter for a unique client-provided token, which becomes the AsyncOperation.UserSuppliedState property. It can then be used by client code to identify the particular asynchronous task that is raising progress or completion events.