void RaceProc_OnRaceComplete() { if (this.InvokeRequired == false) { // Load our times this.txtTime2.Text = _activeRace.Racer1.RaceTime.ToString("#.####"); this.txtTime3.Text = _activeRace.Racer2.RaceTime.ToString("#.####"); int winningLane = _activeRace.Racer1.RaceTime < _activeRace.Racer2.RaceTime ? 2 : 3; switch (winningLane) { case 2: this.picLane2.Visible = true; break; case 3: this.picLane3.Visible = true; break; } } else { RaceProc_OnRaceCompleteDelegate myDelegate = new RaceProc_OnRaceCompleteDelegate(RaceProc_OnRaceComplete); Invoke(myDelegate); } }
void RaceProc_OnRaceComplete() { if (this.InvokeRequired == false) { int heatIndex = RaceDataStore.PrelimHeatNumber - 1; // Load our times this.txtTime1.Text = _activeRace.Lane1Racer.Heats[heatIndex].Time.ToString("#.####"); this.txtTime2.Text = _activeRace.Lane2Racer.Heats[heatIndex].Time.ToString("#.####"); this.txtTime3.Text = _activeRace.Lane3Racer.Heats[heatIndex].Time.ToString("#.####"); this.txtTime4.Text = _activeRace.Lane4Racer.Heats[heatIndex].Time.ToString("#.####"); // Find the winning lane int winningLane = FindWinningLane(); switch (winningLane) { case 1: this.picLane1.Visible = true; break; case 2: this.picLane2.Visible = true; break; case 3: this.picLane3.Visible = true; break; case 4: this.picLane4.Visible = true; break; } // Change our Race State _activeRace.RaceState = RaceStateType.ReviewingResults; // Backup our results RaceDataStore.RaceProc.BackupRaceData(); } else { RaceProc_OnRaceCompleteDelegate myDelegate = new RaceProc_OnRaceCompleteDelegate(RaceProc_OnRaceComplete); Invoke(myDelegate); } }