mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-09-28 15:21:24 +12:00
Fix bugs and crashes with exporting template theme
This commit is contained in:
parent
dd68fa16c1
commit
621880a925
2 changed files with 14 additions and 6 deletions
|
@ -35,12 +35,15 @@ namespace ModAssistant
|
|||
//Ignore Themes without the xaml extension and ignore themes with the same names as others.
|
||||
//If requests are made I can instead make a Theme class that splits the pre-installed themes from
|
||||
//user-made ones so that one more user-made Light/Dark theme can be added.
|
||||
if (info.Extension.ToLowerInvariant() == "xaml" && !loadedThemes.ContainsKey(info.Name))
|
||||
MessageBox.Show(info.Extension);
|
||||
if (info.Extension.ToLower().Contains("xaml"))
|
||||
{
|
||||
ResourceDictionary theme = LoadTheme(info.Name);
|
||||
string name = info.Name.Split('.').First();
|
||||
MessageBox.Show(name);
|
||||
ResourceDictionary theme = LoadTheme(name);
|
||||
if (theme != null)
|
||||
{
|
||||
loadedThemes.Add(info.Name, theme);
|
||||
loadedThemes.Add(name, theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,8 +105,10 @@ namespace ModAssistant
|
|||
|
||||
if (!File.Exists($@"{ThemeDirectory}\\{themeName}.xaml"))
|
||||
{
|
||||
|
||||
//Store a local copy of the theme to prevent exceptions trying to access the saved copy while it's being written to.
|
||||
ResourceDictionary dictionary = LoadTheme(themeName, true);
|
||||
loadedThemes.Add(themeName, dictionary);
|
||||
Options.Instance.ApplicationThemeComboBox.ItemsSource = LoadedThemes;
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = true;
|
||||
|
|
|
@ -249,13 +249,16 @@ namespace ModAssistant.Pages
|
|||
|
||||
private void ApplicationThemeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Themes.ApplyTheme((sender as ComboBox).SelectedItem.ToString(), this);
|
||||
if ((sender as ComboBox).SelectedItem == null)
|
||||
{
|
||||
Themes.ApplyTheme("Light", this);
|
||||
MainWindow.Instance.MainText = "Current theme has been removed, reverting to Light...";
|
||||
}else Themes.ApplyTheme((sender as ComboBox).SelectedItem.ToString(), this);
|
||||
}
|
||||
|
||||
private void ApplicationThemeExportTemplate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Themes.WriteThemeToDisk("Light Pink");
|
||||
Themes.LoadThemes();
|
||||
}
|
||||
|
||||
private void ApplicationThemeOpenThemesFolder_Click(object sender, RoutedEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue