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