I need to use callback function to do some post procesing tasks when the function started with the Dispatcher.BeginInvoke finishes. However i could not find any parameter in Dispatcher.BeginInvoke to accept a callback. Is it possible to give a callback function to Dispatcher.BeginInvoke?
Share
The
DispatcherOperationobject returned byBeginInvokehas aCompletedevent on it. Subscribe to that to perform operations upon completion:There’s a chance the operation will complete before you subscribe, so you can test the
Statusproperty for completion after as well:It’s possible for the operation to be aborted as well, so handling/testing for
Abortedmay also be appropriate.