Exemple #1
0
        /// <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();
        }
        /// <summary>
        /// Updates the UI elements to reflect the new data from the objects.
        /// </summary>
        public void UpdateUI()
        {
            string darkmodeTheme = appSettings.Get_AppSettings_LightMode() ? "Light.Blue" : "Dark.Blue";

            ThemeManager.Current.ChangeTheme(this, darkmodeTheme);

            ui_window_appversion_label.Content            = appSettings.appVersionString;
            ui_gamesetup_gameversion_combobox.ItemsSource = GameVersion_Functions.Get_Versions_StringList(true);
            ui_gamesetup_gamedirectoryexe_textbox.Text    = appSettings.Get_Current_GameVersionSettings_GameExeLocation();
        }