protected EnterCode EnterTrialState(TRIALSTATE value, bool syncenter = false) { var c = base.EnterTrialState(value); if (syncenter && c == EnterCode.Success) { SyncEvent(value.ToString()); } return(c); }
protected virtual EnterCode EnterTrialState(TRIALSTATE value) { if (value == trialstate) { return(EnterCode.AlreadyIn); } switch (value) { case TRIALSTATE.NONE: break; case TRIALSTATE.PREITI: PreITIOnTime = timer.ElapsedMillisecond; if (ex.CondTestAtState == CONDTESTATSTATE.PREITI) { if (condmanager.IsCondRepeat(ex.CondRepeat)) { StartStopExperiment(false); return(EnterCode.NoNeed); } condtestmanager.NewCondTest(PreITIOnTime, ex.NotifyParam, ex.NotifyPerCondTest); } if (ex.CondTestAtState != CONDTESTATSTATE.NONE) { condtestmanager.AddInList(CONDTESTPARAM.Event, value.ToString(), PreITIOnTime); } if (ex.PushCondAtState == PUSHCONDATSTATE.PREITI) { SamplePushCondition(); if (ex.CondTestAtState != CONDTESTATSTATE.NONE) { condtestmanager.Add(CONDTESTPARAM.CondIndex, condmanager.condidx); condtestmanager.Add(CONDTESTPARAM.CondRepeat, condmanager.condrepeat[condmanager.condidx]); if (condmanager.nblock > 1) { condtestmanager.Add(CONDTESTPARAM.BlockIndex, condmanager.blockidx); condtestmanager.Add(CONDTESTPARAM.BlockRepeat, condmanager.blockrepeat[condmanager.blockidx]); } } } break; case TRIALSTATE.TRIAL: TrialOnTime = timer.ElapsedMillisecond; if (ex.CondTestAtState != CONDTESTATSTATE.NONE) { condtestmanager.AddInList(CONDTESTPARAM.Event, value.ToString(), TrialOnTime); } if (ex.PushCondAtState == PUSHCONDATSTATE.TRIAL) { SamplePushCondition(); if (ex.CondTestAtState != CONDTESTATSTATE.NONE) { condtestmanager.Add(CONDTESTPARAM.CondIndex, condmanager.condidx); condtestmanager.Add(CONDTESTPARAM.CondRepeat, condmanager.condrepeat[condmanager.condidx]); if (condmanager.nblock > 1) { condtestmanager.Add(CONDTESTPARAM.BlockIndex, condmanager.blockidx); condtestmanager.Add(CONDTESTPARAM.BlockRepeat, condmanager.blockrepeat[condmanager.blockidx]); } } } break; case TRIALSTATE.SUFITI: SufITIOnTime = timer.ElapsedMillisecond; if (ex.CondTestAtState != CONDTESTATSTATE.NONE) { condtestmanager.AddInList(CONDTESTPARAM.Event, value.ToString(), SufITIOnTime); } break; } trialstate = value; return(EnterCode.Success); }