private void State_StateCompleted(object sender, ScriptStateEventArgs e) { CurrentState = null; States.TryGetValue(e.NextState, out _CurrentState); if (CurrentState.Type == ScriptState.StateType.Complete) { Status = StatusType.Completed; _EndTime = DateTime.Now; //_MazeDataPoint.Stop(); //DataPointReady?.Invoke(this, _MazeDataPoint); //ScriptEnd?.Invoke(this, new ScriptEndEventArgs(true, RunTime)); //CurrentState = StartState; } StateChanged?.Invoke(this, new ScriptMachineEventArgs(CurrentState)); _MazeDataPoint.Stop(); _MazeDataPoint.ExitAction = e.Condition.Label; //DataPointReady?.Invoke(this, _MazeDataPoint); _MazeDataPoint = new MazeDataPoint(CurrentState.Name); _MazeDataPoint.Session = _SessionLoop.CurrentIteration; _MazeDataPoint.Trial = _TrialLoop.CurrentIteration; DataPointReady?.Invoke(this, _MazeDataPoint); if (CurrentState.Type == ScriptState.StateType.Complete) { ScriptEnd?.Invoke(this, new ScriptEndEventArgs(true, RunTime)); //CurrentState = StartState; if (_TrialLoop.Next() > 0) { RunTrial(); } else { _TrialLoop.Reset(); if (_SessionLoop.Next() > 0) { RunSession(); } else { SessionSetComplete?.Invoke(this, new EventArgs()); } } } }
private void ScriptFSM_StateConditionTriggered(object sender, ScriptStateEventArgs e) { RunConditionCommands(e.Condition); }
private void State_StateConditionTriggered(object sender, ScriptStateEventArgs e) { StateConditionTriggered?.Invoke(sender, e); }