private void EventT5() { log.Debug("ËventT5 triggered, horn pattern is" + HornPatternEventT5 + ", using Relay 1"); string[] _hornPattern = null; try { if (_boardDriver == null) { throw new Exception("Relay board not connected or in used by a different race."); } _boardDriver.Relay1_PowerOn(); _boardDriver.PlaySoundPattern(HornPatternEventT5, InternalPlayer); } catch (Exception ex) { log.Fatal("Event T1 has thrown an exception: ", ex); } lock (this) { LastEventCode = RaceEventCode.T5; } NewRaceEvent?.Invoke(this, new RaceEvent(LastEventCode.ToString())); }
private void _timer_Tick(object sender, HighPrecisionTimer.TickEventArgs e) { _raceCountDown = span.Subtract(new TimeSpan(0, 0, Convert.ToInt32(e.Duration.TotalSeconds))); //this.BeginInvoke((System.Windows.Forms.MethodInvoker)delegate() //{ // lbCounter.Text = span.ToString(); //}); if (e.Duration.TotalSeconds >= 60 && LastEventCode == RaceEventCode.T5) { lock (this) { LastEventCode = RaceEventCode.T4; } Task.Factory.StartNew(() => { EventT4(); }); } if (e.Duration.TotalSeconds >= 240 && LastEventCode == RaceEventCode.T4) { lock (this) { LastEventCode = RaceEventCode.T1; } Task.Factory.StartNew(() => { EventT1(); }); // pict1minleft.Image=Marconi.Properties.Resources.race_red_light; } if (e.Duration.TotalSeconds >= 300 && LastEventCode == RaceEventCode.T1) { lock (this) { LastEventCode = RaceEventCode.T0; } Task.Factory.StartNew(() => { EventStart(); }); } NewRaceClockEvent?.Invoke(this, e); NewRaceEvent?.Invoke(this, new RaceEvent(LastEventCode.ToString())); }