コード例 #1
0
ファイル: BackgroundWorker.cs プロジェクト: GodLesZ/svn-dump
		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 );
			}
		}
コード例 #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);
     }
 }
コード例 #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);
        }