Exemplo n.º 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());
            }
        }
Exemplo n.º 2
0
        private void ScriptFSM_StateChanged(object sender, ScriptMachineEventArgs e)
        {
            StateChanged?.Invoke(this, e);
            //if (e.NextState.Type == ScriptState.StateType.Complete)
            //{
            //    TrialComplete?.Invoke(this, CurrentTrial);
            //    if (CurrentTrial >= TrialCount)
            //    {

            //    }
            //}
        }
Exemplo n.º 3
0
        //private void cOM1ToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    ToolStripMenuItem Item = (ToolStripMenuItem)sender;
        //    ComPort = Item.Text;
        //}

        private void ScriptFSM_StateChanged(object sender, ScriptMachineEventArgs e)
        {
            RunDoorCommands(e.NextState.DoorCommands);
            if (e.NextState.Type == ScriptState.StateType.Complete)
            {
                //System.Windows.Forms.MessageBox.Show($"Maze Complete!\nRun time: {ScriptFSM.RunTime}");
                //ScriptFSM.Reset();
            }
            else
            {
                e.NextState.Activate();
            }
        }
Exemplo n.º 4
0
 private void ScriptFSM_ScriptStart(object sender, ScriptMachineEventArgs e)
 {
     ScriptStart?.Invoke(this, e);
 }
Exemplo n.º 5
0
 private void ScriptFSM_ScriptStart(object sender, ScriptMachineEventArgs e)
 {
     //ResetResults();
     ResetMazeSafe();
     RunDoorCommands(e.NextState.DoorCommands);
 }