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


C# ActivityExecutionContext.ExecuteActivity方法代码示例

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


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

示例1: Execute

 public static ActivityExecutionStatus Execute(CompositeActivity activity, ActivityExecutionContext executionContext)
 {
     if (activity.EnabledActivities.Count == 0)
     {
         return ActivityExecutionStatus.Closed;
     }
     activity.EnabledActivities[0].RegisterForStatusChange(Activity.ClosedEvent, (IActivityEventListener<ActivityExecutionStatusChangedEventArgs>) activity);
     executionContext.ExecuteActivity(activity.EnabledActivities[0]);
     activity.SetValue(ActiveChildQualifiedNameProperty, activity.EnabledActivities[0].QualifiedName);
     return ActivityExecutionStatus.Executing;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:SequenceHelper.cs

示例2: TryScheduleNextChild

 private static bool TryScheduleNextChild(CompositeActivity activity, ActivityExecutionContext executionContext)
 {
     IList<Activity> enabledActivities = activity.EnabledActivities;
     int num = 0;
     for (int i = enabledActivities.Count - 1; i >= 0; i--)
     {
         if (enabledActivities[i].ExecutionStatus == ActivityExecutionStatus.Closed)
         {
             if (i == (enabledActivities.Count - 1))
             {
                 return false;
             }
             num = i + 1;
             break;
         }
     }
     enabledActivities[num].RegisterForStatusChange(Activity.ClosedEvent, (IActivityEventListener<ActivityExecutionStatusChangedEventArgs>) activity);
     executionContext.ExecuteActivity(enabledActivities[num]);
     activity.SetValue(ActiveChildQualifiedNameProperty, enabledActivities[num].QualifiedName);
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:SequenceHelper.cs

示例3: TryScheduleNextChild

        private static bool TryScheduleNextChild(CompositeActivity activity, ActivityExecutionContext executionContext)
        {
            IList<Activity> children = activity.EnabledActivities;

            // Find index of next activity to run.
            int indexOfNextActivity = 0;
            for (int i = (children.Count - 1); i >= 0; i--)
            {
                if (children[i].ExecutionStatus == ActivityExecutionStatus.Closed)
                {
                    // Check whether this is last child?
                    if (i == (children.Count - 1))
                        return false;

                    indexOfNextActivity = i + 1;
                    break;
                }
            }

            children[indexOfNextActivity].RegisterForStatusChange(Activity.ClosedEvent, (IActivityEventListener<ActivityExecutionStatusChangedEventArgs>)activity);
            executionContext.ExecuteActivity(children[indexOfNextActivity]);
            activity.SetValue(ActiveChildQualifiedNameProperty, children[indexOfNextActivity].QualifiedName);
            return true;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:24,代码来源:Sequence.cs

示例4: Start

        internal void Start()
        {
            using (ScheduleWork work = new ScheduleWork(this))
            {
                using (this.ExecutorLock.Enter())
                {
                    if (this.WorkflowStatus != WorkflowStatus.Created)
                        throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, ExecutionStringManager.CannotStartInstanceTwice, this.InstanceId));

                    // Set a new ServiceEnvironment to establish a current batch in TLS
                    // This is needed for synchronous status change notification at start
                    // (status init->executing) when there is no batch in TLS yet
                    // and there are subscribers like tracking
                    this.WorkflowStatus = WorkflowStatus.Running;
                    using (new ServiceEnvironment(this.rootActivity))
                    {
                        FireWorkflowExecutionEvent(this, WorkflowEventInternal.Starting);
                        try
                        {
                            using (ActivityExecutionContext executionContext = new ActivityExecutionContext(this.rootActivity, true))
                            {
                                // make sure the scheduler is able to run
                                this.schedulingContext.CanRun = true;

                                // Since we are actually scheduling work at this point, we should grab
                                // the scheduler lock. This will avoid ----s some operations we schedule
                                // start executing before we are done scheduling all operations.
                                using (new SchedulerLockGuard(this._schedulerLock, this))
                                {
                                    executionContext.ExecuteActivity(this.rootActivity);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Terminate(e.Message);
                            throw;
                        }
                        FireWorkflowExecutionEvent(this, WorkflowEventInternal.Started);

                    }
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:44,代码来源:WorkflowExecutor.cs

示例5: Start

 internal void Start()
 {
     using (new ScheduleWork(this))
     {
         using (this.ExecutorLock.Enter())
         {
             if (this.WorkflowStatus != System.Workflow.Runtime.WorkflowStatus.Created)
             {
                 throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.CannotStartInstanceTwice, new object[] { this.InstanceId }));
             }
             this.WorkflowStatus = System.Workflow.Runtime.WorkflowStatus.Running;
             using (new ServiceEnvironment(this.rootActivity))
             {
                 this.FireWorkflowExecutionEvent(this, WorkflowEventInternal.Starting);
                 try
                 {
                     using (ActivityExecutionContext context = new ActivityExecutionContext(this.rootActivity, true))
                     {
                         this.schedulingContext.CanRun = true;
                         using (new SchedulerLockGuard(this._schedulerLock, this))
                         {
                             context.ExecuteActivity(this.rootActivity);
                         }
                     }
                 }
                 catch (Exception exception)
                 {
                     this.Terminate(exception.Message);
                     throw;
                 }
                 this.FireWorkflowExecutionEvent(this, WorkflowEventInternal.Started);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:WorkflowExecutor.cs

示例6: Execute

 public ActivityExecutionStatus Execute()
 {
     using (ActivityExecutionContext activityExecutionContext = new ActivityExecutionContext(this.rootActivity, true))
     {
         activityExecutionContext.ExecuteActivity(this.rootActivity);
     }
     scheduler.Run();
     return TranslateExecutionStatus();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:InteropExecutor.cs


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