public MainWindow() { try { InitializeComponent(); Window.Title = "Control Panel - " + ScoreboardConfig.SCOREBOARD_NAME; Languages.ItemsSource = LanguagesUtil.Languages; LanguagesHolder.SelectedItem = LanguagesUtil.Languages[0]; LanguagesHolder.SelectionChanged += LanguagesHolder_SelectionChanged; //ThemesInBox.ItemsSource = ThemeManager.GetThemes(); Application.Current.ApplyTheme("WhistlerBlue"); setupViewForGame(); //must open after policys because the keyboard shortcuts are controled from the policys view. teamManager = new TeamManager(); ClockView c = new ClockView(); ClockViewArray = new List<ClockView>(); ClockViewArray.Add(c); this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; //opens the window to ask if they are testing, going live etc. InitialWindow askIfTestingOnline = new InitialWindow(); askIfTestingOnline.Show(); _slideShow = new Views.Tabs.SlideShowTab(); SlideShowFrame.Content = _slideShow; _advertTab = new Views.Tabs.AdvertisementTab(); AdvertisementFrame.Content = _advertTab; CreateAndStartWebServer(); if (ScoreboardCrashed.DidScoreboardJustCrash()) { if (MessageBox.Show("It seems the Scoreboard just crashed. Would you like to load the last game?", "Scoreboard Crashed?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { try { ScoreboardCrashed.LoadTempGameFile(); setupViewForGame(); enableButtonsToOnMode(); teamManager.setupTeamManager(); foreach (var scoreboard in ClockViewArray) scoreboard.setupView(); SaveGame.IsEnabled = true; } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } } else return; } ScoreboardCrashed.Opened(); if (!String.IsNullOrEmpty(PolicyViewModel.Instance.DefaultLanguage)) { LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo(PolicyViewModel.Instance.DefaultLanguage); } else { LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US"); PolicyViewModel.Instance.DefaultLanguage = "en-US"; Logger.Instance.logMessage("setting language", LoggerEnum.message); PolicyViewModel.Instance.savePolicyToXml(); } } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }
private void CRGWindow_Click(object sender, RoutedEventArgs e) { try { ClockView cv = new Views.ClockView(); ClockViewArray.Add(cv); cv.Show(); } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }