示例#1
0
 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);
 }
示例#2
0
 public static void RunFunction(string functionName, TransitionState currentState)
 {
     var methodObject = FSMFunctionLoader.GetFunction(functionName);
     if(methodObject != null)
     {
         methodObject.GetMethodInfo.Invoke(methodObject.GetObject, new object[] { currentState });
     }
 }
示例#3
0
 public void FsmFunctionCall(TransitionState transitionState)
 {
     _transitionState = transitionState;
     _eventParams = transitionState.GetEventParameters();
     _properties = transitionState.GetProperties();
     _stateProperties = transitionState.GetStateProperties();
     FunctionCallProcessing();
 }
示例#4
0
        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);
            }
        }
示例#5
0
 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;
 }
示例#6
0
 public static bool Execute(this Function function, TransitionState runState)
 {
     var returnBool = false;
     FSMFunctionCaller.RunFunction(function.FunctionName, runState);
     return returnBool;
 }
示例#7
0
 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;
 }
示例#8
0
 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;
 }
示例#9
0
 private static void RunTransitionFunction(Function function, TransitionState currentState)
 {
     FSMFunctionCaller.RunFunction(function.FunctionName, currentState);
     StatusManager.CloneCurrentStatus();
     RaiseActivityEvent(StatusManager.CurrentState, MachineAction.EndFunction);
 }