AsyncOperation::Post Method (SendOrPostCallback^, Object^)
Invokes a delegate on the thread or context appropriate for the application model.
Assembly: System (in System.dll)
Themethod invokes the delegate specified by the arg parameter without ending the lifetime of the asynchronous operation.
You can call the PostOperationCompleted. You can use the method to report progress or interim results back to clients.method as often as you like while the lifetime of the asynchronous operation has not been ended by a call to
The d parameter wraps the delegate you want called when you want to post an update about the status of the asynchronous task. The AsyncOperation object will ensure that your delegate is invoked on the thread or context appropriate for the application model. Your method can optionally raise an event that notifies clients of a status change, progress update, or newly available incremental results.
The arg parameter should be used to pass state to the delegate wrapped by the d parameter. It might be a reference to an AsyncOperation, or it might be a System.ComponentModel::ProgressChangedEventArgs object. It may be desirable to derive your own class from System.ComponentModel::ProgressChangedEventArgs to provide additional state storage.
Notes to Inheritors:
Inheritors must make theinvocation asynchronous, so that class library providers do not need to concern themselves with potential stack overflows if they assume asynchrony but a particular application model happens to be synchronous.
Console applications do not synchronize the execution of System.Threading::SynchronizationContext class.calls. This can cause ProgressChanged events to be raised out of order. If you wish to have serialized execution of calls, implement and install a
For more information about implementing asynchronous classes, see Implementing the Event-based Asynchronous Pattern.
The following code example demonstrates using the System.ComponentModel::AsyncOperationManager class.method for reporting progress and incremental results of an asynchronous operation. This code example is part of a larger example provided for the
Available since 10
Available since 2.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0