Esempio n. 1
0
        private IAsyncResult BeginInvoke(Activity workflow, IDictionary <string, object> inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions, AsyncCallback callback, object state)
        {
            if (inputs == null)
            {
                throw CoreWf.Internals.FxTrace.Exception.ArgumentNull("inputs");
            }

            TimeoutHelper.ThrowIfNegativeArgument(timeout);

            return(WorkflowApplication.BeginInvoke(workflow, inputs, extensions, timeout, null, null, callback, state));
        }
Esempio n. 2
0
        private void InternalInvokeAsync(IDictionary <string, object> inputs, TimeSpan timeout, object userState)
        {
            AsyncInvokeContext context = new AsyncInvokeContext(userState, this);

            if (userState != null)
            {
                AddToPendingInvokes(context);
            }
            Exception error = null;
            bool      completedSynchronously = false;

            try
            {
                if (s_invokeCallback == null)
                {
                    s_invokeCallback = Fx.ThunkCallback(new AsyncCallback(InvokeCallback));
                }
                context.Operation.OperationStarted();
                IAsyncResult result = WorkflowApplication.BeginInvoke(_workflow, inputs, _extensions, timeout, SynchronizationContext.Current, context, s_invokeCallback, context);
                if (result.CompletedSynchronously)
                {
                    context.Outputs        = this.EndInvoke(result);
                    completedSynchronously = true;
                }
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                error = e;
            }
            if (error != null || completedSynchronously)
            {
                PostInvokeCompletedAndRemove(context, error);
            }
        }
Esempio n. 3
0
        private IAsyncResult BeginInvoke(Activity workflow, TimeSpan timeout, WorkflowInstanceExtensionManager extensions, AsyncCallback callback, object state)
        {
            TimeoutHelper.ThrowIfNegativeArgument(timeout);

            return(WorkflowApplication.BeginInvoke(workflow, null, extensions, timeout, null, null, callback, state));
        }