本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例6: Execute
public ActivityExecutionStatus Execute()
{
using (ActivityExecutionContext activityExecutionContext = new ActivityExecutionContext(this.rootActivity, true))
{
activityExecutionContext.ExecuteActivity(this.rootActivity);
}
scheduler.Run();
return TranslateExecutionStatus();
}