void ReportCompletion(IAsyncResult asyncResult)
        {
            AsyncResult        ar  = (AsyncResult)asyncResult;
            DoWorkEventHandler del = (DoWorkEventHandler)ar.AsyncDelegate;

            DoWorkEventArgs doWorkArgs = (DoWorkEventArgs)asyncResult.AsyncState;
            object          result     = null;
            Exception       error      = null;

            try {
                del.EndInvoke(asyncResult);
                result = doWorkArgs.Result;
            }
            catch (Exception exception) {
                error = exception;
            }

            WorkCompletedEventArgs completedArgs = new WorkCompletedEventArgs(result, error, doWorkArgs.Cancel);

            OnWorkerCompleted(completedArgs);
        }
 protected virtual void OnWorkerCompleted(WorkCompletedEventArgs completedArgs)
 {
     ProcessDelegate(WorkCompleted, this, completedArgs);
 }