I am subscribing to DispatcherOperation’s Completed event when the delegate finishes processing. Can any one please tell me how to get the value returned by the delegate inside the Completed event handler. I think it is only possible to not to block the main thread by accepting the return value inside the Completed event handler.
DispatcherOperation dispOp = this.Dispatcher.BeginInvoke(balUpdater,
GlobalParams._sessionObject.UserInfo.CardData);
dispOp.Completed += new EventHandler(dispOp_Completed);
void dispOp_Completed(object sender, EventArgs e)
{
// accept return value of balUpdater here.
}
I would guess the
senderparameter is quite possibly theDispatcherOperation, but if not, you can just capture theDispatcherOperationin a delegate: