public static void ResetStatus(string mode = "Quiet", string state = "Off") { _modeTransitionList = new List<string>(); _currentTransitionState = new TransitionState(mode, state); _modeTransitionList.Add(_currentTransitionState.GetPrettyXml()); RaiseTransitionStatusEvent(MachineAction.TransactionStatusReset); }
public static void RunFunction(string functionName, TransitionState currentState) { var methodObject = FSMFunctionLoader.GetFunction(functionName); if(methodObject != null) { methodObject.GetMethodInfo.Invoke(methodObject.GetObject, new object[] { currentState }); } }
public void FsmFunctionCall(TransitionState transitionState) { _transitionState = transitionState; _eventParams = transitionState.GetEventParameters(); _properties = transitionState.GetProperties(); _stateProperties = transitionState.GetStateProperties(); FunctionCallProcessing(); }
private static void RaiseActivityEvent(TransitionState currentState, MachineAction action) { if (MachineActivtyEvent != null) { var args = new ActivityEventHandlerArgs(); args.ThisTransitionState = currentState; args.ActivityAction = action; args.EventRaiseTime = DateTime.UtcNow; MachineActivtyEvent.Invoke(null, args); } }
public static int CloneCurrentStatus() { if(_currentTransitionState == null) { ResetStatus(); } var xml = _currentTransitionState.GetPrettyXml(); _modeTransitionList.Add(xml); var clonedState = _currentTransitionState.CloneMe(); _currentTransitionState = clonedState; RaiseTransitionStatusEvent(MachineAction.TransitionStatusCloned); return _modeTransitionList.Count; }
public static bool Execute(this Function function, TransitionState runState) { var returnBool = false; FSMFunctionCaller.RunFunction(function.FunctionName, runState); return returnBool; }
private Function SetUpTransitionToRun(Transition transition, TransitionState currentState, string eventName) { var tFunction = (transition.TransitionFunctions).FirstOrDefault(); var firstFunction = tFunction == null ? null : tFunction.Function; LoadFunctionList(transition.TransitionFunctions.ToList()); return firstFunction; }
public TransitionState CloneMe() { var doc = _statusNode.OwnerDocument.CloneNode(true); var myStatus = doc.SelectSingleNode("Status"); var returnState = new TransitionState(myStatus); // If there is a change in state, clear prior state properties if(PriorState != State) { //returnState.ClearProperties(PropertyType.StateProperty); returnState.PriorState = returnState.State; } return returnState; }
private static void RunTransitionFunction(Function function, TransitionState currentState) { FSMFunctionCaller.RunFunction(function.FunctionName, currentState); StatusManager.CloneCurrentStatus(); RaiseActivityEvent(StatusManager.CurrentState, MachineAction.EndFunction); }