当前位置: 首页>>代码示例>>C#>>正文


C# ActivityExecutionContext.CloseActivity方法代码示例

本文整理汇总了C#中ActivityExecutionContext.CloseActivity方法的典型用法代码示例。如果您正苦于以下问题:C# ActivityExecutionContext.CloseActivity方法的具体用法?C# ActivityExecutionContext.CloseActivity怎么用?C# ActivityExecutionContext.CloseActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActivityExecutionContext的用法示例。


在下文中一共展示了ActivityExecutionContext.CloseActivity方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 protected internal sealed override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
 {
     executionContext.CloseActivity();
     string error = this.Error;
     executionContext.SuspendWorkflowInstance(error);
     return ActivityExecutionStatus.Closed;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SuspendActivity.cs

示例2: Execute

        protected internal override sealed ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            executionContext.CloseActivity();

            string suspendReason = this.Error;
            executionContext.SuspendWorkflowInstance(suspendReason);
            return ActivityExecutionStatus.Closed;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:Suspend.cs

示例3: Execute

        protected internal override sealed ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            executionContext.CloseActivity();

            string terminateReason = this.Error;
            executionContext.TerminateWorkflowInstance(new WorkflowTerminatedException(terminateReason));
            return ActivityExecutionStatus.Closed;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:Terminate.cs

示例4: OnWorkflowChangesCompleted

 public static void OnWorkflowChangesCompleted(CompositeActivity activity, ActivityExecutionContext executionContext)
 {
     string str = activity.GetValue(ActiveChildQualifiedNameProperty) as string;
     bool flag = (bool) activity.GetValue(ActiveChildRemovedProperty);
     if (((str != null) && flag) && (((activity.ExecutionStatus == ActivityExecutionStatus.Canceling) || (activity.ExecutionStatus == ActivityExecutionStatus.Faulting)) || ((activity.ExecutionStatus == ActivityExecutionStatus.Executing) && !TryScheduleNextChild(activity, executionContext))))
     {
         activity.RemoveProperty(ActiveChildQualifiedNameProperty);
         executionContext.CloseActivity();
     }
     activity.RemoveProperty(ActiveChildRemovedProperty);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:SequenceHelper.cs

示例5: ExecuteNext

        // This function executes the ForEach activity.  It advances the current index of the collection.
        // If the end of the collection is reached, return false.  Otherwise, it executes any child activity
        // and return true.
        private bool ExecuteNext(ActivityExecutionContext context)
        {
            // First, move to the next position.
            if (!this.Enumerator.MoveNext())
                return false;

            // Fire the Iterating event.
            base.RaiseEvent(IteratingEvent, this, EventArgs.Empty);

            // Execute the child activity.
            if (this.EnabledActivities.Count > 0)
            {
                // Add the child activity to the execution context and setup the event handler to 
                // listen to the child Close event.
                // A new instance of the child activity is created for each iteration.
                ActivityExecutionContext innerContext = 
                    context.ExecutionContextManager.CreateExecutionContext(this.EnabledActivities[0]);
                innerContext.Activity.Closed += this.OnChildClose;

                // Execute the child activity again.  
                innerContext.ExecuteActivity(innerContext.Activity);
            }
            else
            {
                // an empty foreach loop. 
                // If the ForEach activity is still executing, then execute the next one.
                if (this.ExecutionStatus == ActivityExecutionStatus.Executing)
                {
                    if (!ExecuteNext(context))
                        context.CloseActivity();
                }
            }
            return true;
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:37,代码来源:ForEach.cs

示例6: OnWorkflowChangesCompleted

        public static void OnWorkflowChangesCompleted(CompositeActivity activity, ActivityExecutionContext executionContext)
        {
            String activeChildQualifiedName = activity.GetValue(ActiveChildQualifiedNameProperty) as String;
            bool activeChildRemovedInDynamicUpdate = (bool)activity.GetValue(ActiveChildRemovedProperty);

            if (activeChildQualifiedName != null && activeChildRemovedInDynamicUpdate)
            {   //We have our active child removed.    
                if (activity.ExecutionStatus == ActivityExecutionStatus.Canceling ||
                activity.ExecutionStatus == ActivityExecutionStatus.Faulting ||
                activity.ExecutionStatus == ActivityExecutionStatus.Executing && !TryScheduleNextChild(activity, executionContext))
                {
                    activity.RemoveProperty(ActiveChildQualifiedNameProperty);
                    executionContext.CloseActivity();
                }
            }
            activity.RemoveProperty(ActiveChildRemovedProperty);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:17,代码来源:Sequence.cs

示例7: Run

        public override bool Run(IWorkflowCoreRuntime workflowCoreRuntime)
        {
            // get state reader
            Activity contextActivity = workflowCoreRuntime.GetContextActivityForId(this.ContextId);
            Activity activity = contextActivity.GetActivityByName(this.activityName);

            using (workflowCoreRuntime.SetCurrentActivity(activity))
            {
                using (ActivityExecutionContext activityExecutionContext = new ActivityExecutionContext(activity))
                {
                    ActivityExecutor activityExecutor = ActivityExecutors.GetActivityExecutor(activity);
                    switch (this.operation)
                    {
                        case ActivityOperationType.Execute:
                            if (activity.ExecutionStatus == ActivityExecutionStatus.Executing)
                            {
                                try
                                {
                                    workflowCoreRuntime.RaiseActivityExecuting(activity);

                                    ActivityExecutionStatus newStatus = activityExecutor.Execute(activity, activityExecutionContext);
                                    if (newStatus == ActivityExecutionStatus.Closed)
                                        activityExecutionContext.CloseActivity();
                                    else if (newStatus != ActivityExecutionStatus.Executing)
                                        throw new InvalidOperationException(SR.GetString(SR.InvalidExecutionStatus, activity.QualifiedName, newStatus.ToString(), ActivityExecutionStatus.Executing.ToString()));
                                }
                                catch (Exception e)
                                {
                                    System.Workflow.Runtime.WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Execute of Activity {0} threw {1}", activity.QualifiedName, e.ToString());
                                    throw;
                                }
                            }
                            break;
                        case ActivityOperationType.Cancel:
                            if (activity.ExecutionStatus == ActivityExecutionStatus.Canceling)
                            {
                                try
                                {
                                    ActivityExecutionStatus newStatus = activityExecutor.Cancel(activity, activityExecutionContext);
                                    if (newStatus == ActivityExecutionStatus.Closed)
                                        activityExecutionContext.CloseActivity();
                                    else if (newStatus != ActivityExecutionStatus.Canceling)
                                        throw new InvalidOperationException(SR.GetString(SR.InvalidExecutionStatus, activity.QualifiedName, newStatus.ToString(), ActivityExecutionStatus.Canceling.ToString()));

                                }
                                catch (Exception e)
                                {
                                    System.Workflow.Runtime.WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Cancel of Activity {0} threw {1}", activity.QualifiedName, e.ToString());
                                    throw;
                                }
                            }
                            break;
                        case ActivityOperationType.Compensate:
                            if (activity.ExecutionStatus == ActivityExecutionStatus.Compensating)
                            {
                                try
                                {
                                    ActivityExecutionStatus newStatus = activityExecutor.Compensate(activity, activityExecutionContext);
                                    if (newStatus == ActivityExecutionStatus.Closed)
                                        activityExecutionContext.CloseActivity();
                                    else if (newStatus != ActivityExecutionStatus.Compensating)
                                        throw new InvalidOperationException(SR.GetString(SR.InvalidExecutionStatus, activity.QualifiedName, newStatus.ToString(), ActivityExecutionStatus.Compensating.ToString()));
                                }
                                catch (Exception e)
                                {
                                    System.Workflow.Runtime.WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Compensate of Activity {0} threw {1}", activity.QualifiedName, e.ToString());
                                    throw;
                                }
                            }
                            break;
                        case ActivityOperationType.HandleFault:
                            if (activity.ExecutionStatus == ActivityExecutionStatus.Faulting)
                            {
                                try
                                {
                                    ActivityExecutionStatus newStatus = activityExecutor.HandleFault(activity, activityExecutionContext, this.exceptionToDeliver);
                                    if (newStatus == ActivityExecutionStatus.Closed)
                                        activityExecutionContext.CloseActivity();
                                    else if (newStatus != ActivityExecutionStatus.Faulting)
                                        throw new InvalidOperationException(SR.GetString(SR.InvalidExecutionStatus, activity.QualifiedName, newStatus.ToString(), ActivityExecutionStatus.Faulting.ToString()));
                                }
                                catch (Exception e)
                                {
                                    System.Workflow.Runtime.WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Compensate of Activity {0} threw {1}", activity.QualifiedName, e.ToString());
                                    throw;
                                }
                            }
                            break;
                    }
                }
            }
            return true;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:93,代码来源:ActivityExecutorOperation.cs

示例8: Run

        public override bool Run(IWorkflowCoreRuntime workflowCoreRuntime)
        {
            Activity activityByName = workflowCoreRuntime.GetContextActivityForId(base.ContextId).GetActivityByName(this.activityName);
            using (workflowCoreRuntime.SetCurrentActivity(activityByName))
            {
                using (ActivityExecutionContext context = new ActivityExecutionContext(activityByName))
                {
                    ActivityExecutor activityExecutor = ActivityExecutors.GetActivityExecutor(activityByName);
                    switch (this.operation)
                    {
                        case ActivityOperationType.Execute:
                            if (activityByName.ExecutionStatus != ActivityExecutionStatus.Executing)
                            {
                                goto Label_0309;
                            }
                            try
                            {
                                workflowCoreRuntime.RaiseActivityExecuting(activityByName);
                                ActivityExecutionStatus status = activityExecutor.Execute(activityByName, context);
                                if (status == ActivityExecutionStatus.Closed)
                                {
                                    context.CloseActivity();
                                }
                                else if (status != ActivityExecutionStatus.Executing)
                                {
                                    throw new InvalidOperationException(SR.GetString("InvalidExecutionStatus", new object[] { activityByName.QualifiedName, status.ToString(), ActivityExecutionStatus.Executing.ToString() }));
                                }
                                goto Label_0309;
                            }
                            catch (Exception exception)
                            {
                                WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Execute of Activity {0} threw {1}", new object[] { activityByName.QualifiedName, exception.ToString() });
                                throw;
                            }
                            break;

                        case ActivityOperationType.Cancel:
                            break;

                        case ActivityOperationType.Compensate:
                            goto Label_01A4;

                        case ActivityOperationType.HandleFault:
                            goto Label_0248;

                        default:
                            goto Label_0309;
                    }
                    if (activityByName.ExecutionStatus != ActivityExecutionStatus.Canceling)
                    {
                        goto Label_0309;
                    }
                    try
                    {
                        ActivityExecutionStatus status2 = activityExecutor.Cancel(activityByName, context);
                        if (status2 == ActivityExecutionStatus.Closed)
                        {
                            context.CloseActivity();
                        }
                        else if (status2 != ActivityExecutionStatus.Canceling)
                        {
                            throw new InvalidOperationException(SR.GetString("InvalidExecutionStatus", new object[] { activityByName.QualifiedName, status2.ToString(), ActivityExecutionStatus.Canceling.ToString() }));
                        }
                        goto Label_0309;
                    }
                    catch (Exception exception2)
                    {
                        WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Cancel of Activity {0} threw {1}", new object[] { activityByName.QualifiedName, exception2.ToString() });
                        throw;
                    }
                Label_01A4:
                    if (activityByName.ExecutionStatus != ActivityExecutionStatus.Compensating)
                    {
                        goto Label_0309;
                    }
                    try
                    {
                        ActivityExecutionStatus status3 = activityExecutor.Compensate(activityByName, context);
                        if (status3 == ActivityExecutionStatus.Closed)
                        {
                            context.CloseActivity();
                        }
                        else if (status3 != ActivityExecutionStatus.Compensating)
                        {
                            throw new InvalidOperationException(SR.GetString("InvalidExecutionStatus", new object[] { activityByName.QualifiedName, status3.ToString(), ActivityExecutionStatus.Compensating.ToString() }));
                        }
                        goto Label_0309;
                    }
                    catch (Exception exception3)
                    {
                        WorkflowTrace.Runtime.TraceEvent(TraceEventType.Error, 1, "Compensate of Activity {0} threw {1}", new object[] { activityByName.QualifiedName, exception3.ToString() });
                        throw;
                    }
                Label_0248:
                    if (activityByName.ExecutionStatus == ActivityExecutionStatus.Faulting)
                    {
                        try
                        {
                            ActivityExecutionStatus status4 = activityExecutor.HandleFault(activityByName, context, this.exceptionToDeliver);
                            if (status4 == ActivityExecutionStatus.Closed)
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ActivityExecutorOperation.cs


注:本文中的ActivityExecutionContext.CloseActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。