public static void ByPassActionsTree(BaseActionInstance action, Action <BaseActionInstance> function) { function(action); foreach (BaseActionInstance childAction in action.ChildActions) { ByPassActionsTree(childAction, function); } }
private bool PerformTrueAction(ActionScope scope, BaseActionInstance execute, BaseActionInstance notToExecute) { if (notToExecute != null) { ByPassActionsTree(notToExecute, (action_) => { //that actions will never be executed, so mark as executed scope.ExecutedActionIDS.Add(action_.EventAction.ActionID); }); } if (execute != null) { return(execute.ExecuteAction(scope)); } return(true); }
protected override bool Execute(ActionScope scope) { bool result = this.PerformPredicate(scope); var trueAction = this.ChildActions .FirstOrDefault(e => e.EventAction.ActionID == this.PredicateAction.ActionIDTrue); var falseAction = this.ChildActions .FirstOrDefault(e => e.EventAction.ActionID == this.PredicateAction.ActionIDFalse); //predicate executed scope.ExecutedActionIDS.Add(this.EventAction.ActionID); BaseActionInstance execute = result ? trueAction : falseAction; BaseActionInstance notToExecute = result ? falseAction : trueAction; bool fullyExecuted = this.PerformTrueAction(scope, execute, notToExecute); return(fullyExecuted); }
public BaseActionInstance GetEventAction(int actionID) { BaseActionInstance search = null; foreach (var @event in this.Events) { foreach (var action in @event.EventActions) { BaseActionInstance.ByPassActionsTree(action, (_action) => { if (_action.EventAction.ActionID == actionID) { search = _action; } ; }); } } return(search); }
public ActionScope(BaseActionInstance Action, FormInstance Form, List <OperandValue> OperandValues) { this.Action = Action; this.Form = Form; this._ResultScope = new ActionResultScope(OperandValues); }