protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { // If there is StateInitializationActivity should go first StateInitializationActivity init = null; foreach (Activity activity in Activities) { if (IsBasedOnType(activity, typeof(StateInitializationActivity))) { init = (StateInitializationActivity)activity; ActivitiesToExecute.Enqueue(init); break; } } foreach (Activity activity in Activities) { if (activity == init) { continue; } ActivitiesToExecute.Enqueue(activity); } NeedsExecution = false; return(ActivityExecutionStatus.Executing); }
//protected override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext) protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { bool condition_true = false; foreach (IfElseBranchActivity activity in Activities) { if (activity == null || activity.Condition == null) { continue; } if (activity.Condition.Evaluate(this, executionContext) == true) { condition_true = true; break; } } if (Activities.Count > 1) { if (condition_true == true) { ActivitiesToExecute.Enqueue(Activities[0]); } else { ActivitiesToExecute.Enqueue(Activities[1]); } } NeedsExecution = false; return(ActivityExecutionStatus.Closed); }
// Methods protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { Activity next_activity = GetActivityByName(TargetStateName, false); next_activity.NeedsExecution = true; ActivitiesToExecute.Enqueue(next_activity); NeedsExecution = false; return(ActivityExecutionStatus.Closed); }
// Methods //protected override ActivityExecutionStatus Cancel (ActivityExecutionContext executionContext) protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { foreach (Activity activity in Activities) { ActivitiesToExecute.Enqueue(activity); } NeedsExecution = false; return(ActivityExecutionStatus.Executing); }
//public Activity DynamicActivity { get; } // Methods //protected override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext); protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { Activities[0].NeedsExecution = true; ActivitiesToExecute.Enqueue(Activities[0]); if (Condition.Evaluate(this, executionContext) == false) { NeedsExecution = false; return(ActivityExecutionStatus.Closed); } NeedsExecution = true; return(ActivityExecutionStatus.Executing); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { List <Activity> list = new List <Activity> (); Activity child = this; // Indicate that all children activites can be executed in paralell while (child != null) { //Console.WriteLine ("Child {0}", child); // TODO: if (IsBasedOnType (current, typeof (CompositeActivity))) { if (child.GetType().BaseType == typeof(CompositeActivity)) { CompositeActivity composite = (CompositeActivity)child; foreach (Activity activity in composite.Activities) { list.Add(activity); } } if (list.Count == 0) { break; } child = list [0]; child.ParallelParent = this; list.Remove(child); } foreach (Activity activity in Activities) { ActivitiesToExecute.Enqueue(activity); } NeedsExecution = false; return(ActivityExecutionStatus.Closed); }