コード例 #1
0
        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);
        }
コード例 #2
0
 protected virtual void OnRunWorkerCompleted(RunWorkerCompletedProviderEventArgs completedArgs)
 {
     ProcessDelegate(RunWorkerCompleted, this, completedArgs);
 }