Ejemplo n.º 1
0
		public void RunWorkerAsync( object argument ) {
			mCancelPending = false;
			if( DoWork != null ) {
				DoWorkEventArgsBw args = new DoWorkEventArgsBw( argument );
				AsyncCallback callback = new AsyncCallback( ReportCompletion );
				DoWork.BeginInvoke( this, args, callback, args );
			}
		}
Ejemplo n.º 2
0
 public void RunWorkerAsync(object argument)
 {
     mCancelPending = false;
     if (DoWork != null)
     {
         DoWorkEventArgsBw args     = new DoWorkEventArgsBw(argument);
         AsyncCallback     callback = new AsyncCallback(ReportCompletion);
         DoWork.BeginInvoke(this, args, callback, args);
     }
 }
Ejemplo n.º 3
0
        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);
        }