public void showRaceFactory() { prepareForPanelChange(true); raceConfig = null; RaceFactoryPanel toAdd; if (ss_isActive && ss_savedPanel != null) { toAdd = ss_savedPanel; ss_isActive = false; } else { toAdd = new RaceFactoryPanel(factoryComplete); } Grid_Content.Children.Add(toAdd); PanelState = panelState.RaceFactory; ss_lastActivity = DateTime.Now; if (AntPlusRacerConfig.getInstance().RecordScreenSaverTimeout_negativeIsOff > 0) { ss_ScreenSaverTimer.Start(); } }
private void prepareForPanelChange(bool doneWithRace) { if (doneWithRace) { //If we are in the factory, we need to dispose the configured racers data sources if (PanelState == panelState.RaceFactory && !ss_isActive) { foreach (RacerDetails i in ((RaceFactoryPanel)Grid_Content.Children[0]).configuredRacers) { i.dataSource.isInUse = false; } } if (raceConfig != null) //Ensure we dispose of the race { if (!raceConfig.isRaceFinished) { raceConfig.disposeRace(); //If the race is still running, cancel it } raceConfig = null; } } ss_ScreenSaverTimer.Stop(); Grid_Content.Children.Clear(); Grid_Content.RowDefinitions.Clear(); }
public void factoryComplete(RaceDetails raceConfig) { this.raceConfig = raceConfig; hideMenu(); showRaces(); raceConfig.startRace(this); }