You can now export Light Pink to disk

This commit is contained in:
Caeden Statia 2020-02-07 16:46:20 -08:00
parent f25fe2ade2
commit dd68fa16c1
2 changed files with 25 additions and 1 deletions

View file

@ -5,6 +5,8 @@ using System.Windows;
using System.IO;
using System.Windows.Media;
using ModAssistant.Pages;
using System.Xml;
using System.Windows.Markup;
namespace ModAssistant
{
@ -90,5 +92,26 @@ namespace ModAssistant
element.Resources[ResourceColorName] = loadedThemes[LoadedTheme][ResourceColorName];
((GeometryDrawing)((DrawingGroup)icons[DrawingGroupName]).Children[0]).Brush = (Brush)element.Resources[ResourceColorName];
}
public static void WriteThemeToDisk(string themeName)
{
if (!Directory.Exists(ThemeDirectory))
{
Directory.CreateDirectory(ThemeDirectory);
}
if (!File.Exists($@"{ThemeDirectory}\\{themeName}.xaml"))
{
ResourceDictionary dictionary = LoadTheme(themeName, true);
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter writer = XmlWriter.Create($@"{ThemeDirectory}\\{themeName}.xaml", settings);
XamlWriter.Save(dictionary, writer);
MainWindow.Instance.MainText = $"Template theme \"{themeName}\" saved to Themes folder.";
}
else MessageBox.Show("Template theme already exists!");
}
}
}

View file

@ -254,7 +254,8 @@ namespace ModAssistant.Pages
private void ApplicationThemeExportTemplate_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("nice going laughShorts this is coming soon");
Themes.WriteThemeToDisk("Light Pink");
Themes.LoadThemes();
}
private void ApplicationThemeOpenThemesFolder_Click(object sender, RoutedEventArgs e)