Fix current theme not being selected in dropdown

This commit is contained in:
Caeden Statia 2020-02-07 16:13:27 -08:00
parent 23a94aa36c
commit 1c25ceb0c7
3 changed files with 7 additions and 7 deletions

View file

@ -45,7 +45,10 @@ namespace ModAssistant
//MessageBox.Show($"(DEBUG) Loaded {loadedThemes.Count - 2} themes from Themes folder.");
}
if (Options.Instance != null && Options.Instance.ApplicationThemeComboBox != null)
{
Options.Instance.ApplicationThemeComboBox.ItemsSource = LoadedThemes;
Options.Instance.ApplicationThemeComboBox.SelectedIndex = LoadedThemes.IndexOf(LoadedTheme);
}
}
private static ResourceDictionary LoadTheme(string name, bool localUri = false)

View file

@ -64,7 +64,8 @@ namespace ModAssistant
try
{
Themes.ApplyTheme("Light", this);
}catch (ArgumentException)
}
catch (ArgumentException)
{
Themes.ApplyTheme("Light", this);
MainText = "Theme not found, reverting to Light theme...";
@ -124,6 +125,7 @@ namespace ModAssistant
break;
case "Options":
Main.Content = Options.Instance;
Themes.LoadThemes();
break;
default:
Main.Content = Intro.Instance;
@ -191,6 +193,7 @@ namespace ModAssistant
private void OptionsButton_Click(object sender, RoutedEventArgs e)
{
Main.Content = Options.Instance;
Themes.LoadThemes();
Properties.Settings.Default.LastTab = "Options";
Properties.Settings.Default.Save();
}

View file

@ -54,12 +54,6 @@ namespace ModAssistant.Pages
UpdateHandlerStatus();
this.DataContext = this;
if (!DesignerProperties.GetIsInDesignMode(this))
{
if (!Themes.LoadedThemes.Any()) Themes.LoadThemes();
ApplicationThemeComboBox.SelectedValue = Themes.LoadedTheme;
}
}
public void UpdateHandlerStatus()