public ibsTicker(int para_tickerTime, ThreadPriority threadPrio) { if (ibsTicker._instanceCounter == 0) { ++ibsTicker._instanceCounter; this._locInstNumber = ibsTicker._instanceCounter; ibsTicker.timeProcPeriodic = new ibsTicker.TimeProc(ibsTicker.OnTimerPeriodicEvent); ibsTicker.timerID = ibsTicker.timeSetEvent(5, 0, ibsTicker.timeProcPeriodic, 0, 1); } else { ++ibsTicker._instanceCounter; this._locInstNumber = ibsTicker._instanceCounter; } this._tickerState = IBSTickerMode.Idle; this._tickerTime = para_tickerTime; if (this._tickerTime < 5) { this._tickerTime = 5; } this._thrHdlCallBack = new Thread(new ThreadStart(this.workerThreadCallback)); this._thrHdlCallBack.Start(); this._thrHdlCallBack.Priority = threadPrio; }
private void OnTick() { if (this._tickerState == IBSTickerMode.Start) { if (this._chOnTimerTick != null) { this._chOnTimerTick(this._tickerState); } this._tickerState = IBSTickerMode.Active; } if (this._tickerState == IBSTickerMode.Active && this._chOnTimerTick != null) { this._chOnTimerTick(this._tickerState); } if (this._tickerState != IBSTickerMode.Stop) { return; } if (this._chOnTimerTick != null) { this._chOnTimerTick(this._tickerState); } this._tickerState = IBSTickerMode.Idle; }