public MenuControl(Control MainControl, MenuScreen MenuScreen) { this.MenuScreen = MenuScreen; this.Control = MainControl; MenuScreen.TextBox_MultiplayerLoginUserName.Text = Data.GetMultiplayerUserName(); // savegames string[] AvailableSaveGames = Data.GetAvailableSavegames(); for (int i = 0; i < AvailableSaveGames.Length; i++) { string PathRemoved = AvailableSaveGames[i].Replace(Data.DataPath, "").Replace(Data.SaveGamesPath, "").Replace(Data.DefaultFileExtension, "").Replace("\\", ""); long Ticks = Convert.ToInt64(PathRemoved); string TimeString = Time.ConvertTicksToString(Ticks); MenuScreen.ComboBox_Local_SavegameSelection.Items.Add(TimeString); } if (AvailableSaveGames.Length == 0) { MenuScreen.Button_Local_ContinueSavegame.IsEnabled = false; MenuScreen.ComboBox_Local_SavegameSelection.IsEnabled = false; } // sound Sound.PlaySound(Sound.SoundName.MenuBackground); // updates Thread CheckForUpdatesThread = new Thread(new ThreadStart(CheckForUpdates)); CheckForUpdatesThread.IsBackground = true; // closes the thread if the window is closing CheckForUpdatesThread.Priority = ThreadPriority.Lowest; CheckForUpdatesThread.Start(); // background workers BackgroundWorkerNewAccount.DoWork += BackgroundWorkerNewAccountWork; BackgroundWorkerLogin.DoWork += BackgroundWorkerLoginWork; }
// shows the menu screen public void ShowMenuScreen() { QuitCurrentScreen(); MenuScreen = new MenuScreen(this); MainWindow.ContentControl_Main.Content = MenuScreen; }