示例#1
0
 internal static void CompleteAsynchronousExecution(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         AsyncOperationContext asyncState = result.AsyncState as AsyncOperationContext;
         if (asyncState != null)
         {
             asyncState.CompleteAsyncCodeActivity(new CompleteAsyncCodeActivityData(asyncState, result));
         }
     }
 }
        internal static void CompleteAsynchronousExecution(IAsyncResult result)
        {
            if (result.CompletedSynchronously)
            {
                return;
            }
            AsyncOperationContext asyncContext = result.AsyncState as AsyncOperationContext;

            // User code may not have correctly passed the AsyncOperationContext thru as the "state" parameter for
            // BeginInvoke. If is null, don't bother going any further. We would have thrown an exception out of the
            // workflow from InternalExecute. In that case, AsyncOperationContext.CancelOperation will be called in
            // InternalExecute.
            if (asyncContext != null)
            {
                asyncContext.CompleteAsyncCodeActivity(new CompleteAsyncCodeActivityData(asyncContext, result));
            }
        }