private void EnsureOnlyCurrentRaceCanBeSelected(bool onlyCurrentRace) { foreach (TabItem tab in tabControlTopLevel.Items) { RaceUC raceUC = tab.Content as RaceUC; if (raceUC != null) { bool isEnabled = !onlyCurrentRace || (_dm.GetCurrentRace() == raceUC.GetRace()); tab.IsEnabled = isEnabled; } } }
private void addRaceTab(Race r) { TabItem tabRace = new RaceTabItem(r); tabControlTopLevel.Items.Insert(1, tabRace); tabRace.FontSize = 16; RaceUC raceUC = new RaceUC(_dm, r, _liveTimingMeasurement, _txtLiveTimingStatus); tabRace.Content = raceUC; }