private void ui_gamesetup_done_Click(object sender, RoutedEventArgs e) { GameVersion selectedGameVersion = GameVersion_Functions.Get_Versions_ParseIntValue(ui_gamesetup_gameversion_combobox.SelectedIndex); appSettings.ChangeGameVersion(selectedGameVersion); modManager.ChangedGameVersion(); if (appSettings.IsGameSetupAndValid(true) == false) { return; } appSettings.UpdateChangesToFile(); this.Hide(); mainWindow.Show(); mainWindow.Activate(); }
/// <summary> /// Initalizes the main script objects and windows /// </summary> private void InitalizeApplication() { //initalize our objects appSettings = new AppSettings(); modManager = new ModManager(appSettings, this); //get the mods from the current game version folder modManager.GetModsFromFolder(); //create our window objects modManager_ViewMod_ViewText = new ModManager_ViewMod_ViewText(); modManager_ViewMod = new ModManager_ViewMod(modManager_ViewMod_ViewText, appSettings); setupWizard_Window = new SetupWizard_Window(appSettings, this, modManager); //we finished starting up now, so lets set this to false startingUp = false; //check if the currently selected game that was selected is valid, if it isn't then pop open the setup wizzard if (appSettings.IsGameSetupAndValid() == false) { InitalizeSetupWizard(); } }
/// <summary> /// Updates the UI to reflect the new values from the scripts. /// </summary> public void UpdateUI() { //if the app is starting up, don't continue (otherwise we get issues that you don't want) if (startingUp) { return; } bool ifModSelected = ui_modmanager_modlist_listview.SelectedIndex != -1 && ui_modmanager_modlist_listview.SelectedItem != null; bool ifModsExist = ui_modmanager_modlist_listview.Items.Count != 0; bool ifCanLaunchGame = ui_launcher_gameversion_combobox.SelectedIndex != -1 && appSettings.IsGameSetupAndValid(); //launcher stuff string gameExePath = appSettings.Get_Current_GameVersionSettings_GameExeLocation(); ui_launcher_gameversion_combobox.ItemsSource = GameVersion_Functions.Get_Versions_StringList(true); ui_launcher_launchgame_tile_gameModsAmount_textBlock.Text = string.Format("Mods: {0}", modManager.mods.Count); ui_launcher_launchgame_tile.IsEnabled = ifCanLaunchGame; ui_window_appversion_label.Content = appSettings.appVersionString; if (ui_launcher_gameversion_combobox.SelectedItem != null) { ui_launcher_launchgame_tile_gameTitle_textBlock.Text = ui_launcher_gameversion_combobox.SelectedItem.ToString(); } ui_launcher_launchgame_tile_exeIcon_image.Source = null; if (System.IO.File.Exists(gameExePath)) { ui_launcher_launchgame_tile_exeIcon_image.Source = GetFileIcon(gameExePath); } //mod manager stuff ui_modmanager_addmod_button.IsEnabled = ifCanLaunchGame; ui_modmanager_removemod_button.IsEnabled = ifModSelected; ui_modmanager_viewmod_button.IsEnabled = ifModSelected; ui_modmanager_openmodfolder_button.IsEnabled = ifCanLaunchGame; ui_modmanager_purgemod_button.IsEnabled = ifModsExist; ui_modmanager_refreshmodfolder_button.IsEnabled = ifCanLaunchGame; ui_modmanager_modlist_listview.IsEnabled = ifCanLaunchGame; ui_modmanager_modlist_listview.ItemsSource = modManager.mods; ui_modmanager_modlist_listview.Items.Refresh(); ui_modmanager_modlist_listview_contextmenu_add.IsEnabled = ui_modmanager_addmod_button.IsEnabled; ui_modmanager_modlist_listview_contextmenu_remove.IsEnabled = ui_modmanager_removemod_button.IsEnabled; ui_modmanager_modlist_listview_contextmenu_openmodfolder.IsEnabled = ui_modmanager_openmodfolder_button.IsEnabled; ui_modmanager_modlist_listview_contextmenu_refreshmods.IsEnabled = ui_modmanager_refreshmodfolder_button.IsEnabled; ui_modmanager_modlist_listview_contextmenu_view.IsEnabled = ui_modmanager_viewmod_button.IsEnabled; ui_modmanager_gameversion_label.Content = appSettings.Get_Current_GameVersionName(); ui_modmanager_gameversion_label.Content = string.Format("Game: {0}", appSettings.Get_Current_GameVersionName().ToString().Replace("_", " ")); //settings stuff ui_settings_gameversion_label.Content = string.Format("Current Game: {0}", appSettings.Get_Current_GameVersionName().ToString().Replace("_", " ")); ui_settings_gameversion_combobox.ItemsSource = GameVersion_Functions.Get_Versions_StringList(true); ui_settings_gameversion_combobox.SelectedIndex = (int)appSettings.appSettingsFile.Default_Game_Version; ui_settings_gamedirectoryexe_textbox.Text = appSettings.Get_Current_GameVersionSettings_GameExeLocation(); }