Пример #1
0
        public async void RunTrial()
        {
            TrialStart?.Invoke(this, _TrialLoop.CurrentIteration);
            _Status = StatusType.TrialDelay;
            try
            {
                await TrialDelay.RunAsync(CancelToken);

                if (!CancelToken.IsCancellationRequested)
                {
                    CurrentState = StartState;
                    ScriptMachineEventArgs e = new ScriptMachineEventArgs(StartState);
                    ScriptStart?.Invoke(this, e);
                    _MazeDataPoint         = new MazeDataPoint(CurrentState.Name);
                    _MazeDataPoint.Session = _SessionLoop.CurrentIteration;
                    _MazeDataPoint.Trial   = _TrialLoop.CurrentIteration;
                    DataPointReady?.Invoke(this, _MazeDataPoint);
                    CurrentState.Activate();
                    _Status    = StatusType.Running;
                    _StartTime = DateTime.Now;
                }
                else
                {
                    TrialAborted?.Invoke(this, new EventArgs());
                }
            }
            catch (Exception ex)
            {
                TrialAborted?.Invoke(this, new EventArgs());
            }
        }
Пример #2
0
 public void MatchSensor(string Sensor)
 {
     if (!CancelToken.IsCancellationRequested)
     {
         if (_Status == StatusType.Running && CurrentState != null)
         {
             CurrentState.MatchSensor(Sensor);
         }
     }
     else
     {
         TrialAborted?.Invoke(this, new EventArgs());
     }
 }