void ReportCompletion(IAsyncResult asyncResult) { System.Runtime.Remoting.Messaging.AsyncResult ar = (System.Runtime.Remoting.Messaging.AsyncResult)asyncResult; DoWorkEventHandler del; del = (DoWorkEventHandler)ar.AsyncDelegate; DoWorkProviderEventArgs doWorkArgs = (DoWorkProviderEventArgs)ar.AsyncState; object result = null; Exception error = null; try { del.EndInvoke(asyncResult); result = doWorkArgs.Result; } catch (Exception exception) { error = exception; } RunWorkerCompletedProviderEventArgs completedArgs = new RunWorkerCompletedProviderEventArgs(result, error, doWorkArgs.Cancel); OnRunWorkerCompleted(completedArgs); }
protected virtual void OnRunWorkerCompleted(RunWorkerCompletedProviderEventArgs completedArgs) { ProcessDelegate(RunWorkerCompleted, this, completedArgs); }