From 4aee0a33f15da606ff4b66ff5574a4c91afb28e7 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:36:07 +0000 Subject: [PATCH] rearrange and add new editor button --- .../Elements/Editor/BootstrapperEditorWindow.xaml | 15 ++++++++++----- .../Editor/BootstrapperEditorWindow.xaml.cs | 5 ++++- .../Editor/BootstrapperEditorWindowViewModel.cs | 8 ++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml b/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml index f27f802..274d1d5 100644 --- a/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml +++ b/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml @@ -43,10 +43,16 @@ SyntaxHighlighting="XML" TextChanged="OnCodeChanged" /> + + + HorizontalAlignment="Right"> @@ -54,15 +60,14 @@ diff --git a/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml.cs b/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml.cs index 5888c63..852310d 100644 --- a/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml.cs +++ b/Bloxstrap/UI/Elements/Editor/BootstrapperEditorWindow.xaml.cs @@ -136,10 +136,13 @@ namespace Bloxstrap.UI.Elements.Editor { CustomBootstrapperSchema.ParseSchema(); - string themeContents = File.ReadAllText(Path.Combine(Paths.CustomThemes, name, "Theme.xml")); + string directory = Path.Combine(Paths.CustomThemes, name); + + string themeContents = File.ReadAllText(Path.Combine(directory, "Theme.xml")); themeContents = ToCRLF(themeContents); // make sure the theme is in CRLF. a function expects CRLF. var viewModel = new BootstrapperEditorWindowViewModel(); + viewModel.Directory = directory; viewModel.Name = name; viewModel.Title = $"Editing \"{name}\""; viewModel.Code = themeContents; diff --git a/Bloxstrap/UI/ViewModels/Editor/BootstrapperEditorWindowViewModel.cs b/Bloxstrap/UI/ViewModels/Editor/BootstrapperEditorWindowViewModel.cs index 7148dd4..b3b99fe 100644 --- a/Bloxstrap/UI/ViewModels/Editor/BootstrapperEditorWindowViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Editor/BootstrapperEditorWindowViewModel.cs @@ -16,6 +16,9 @@ namespace Bloxstrap.UI.ViewModels.Editor public ICommand PreviewCommand => new RelayCommand(Preview); public ICommand SaveCommand => new RelayCommand(Save); + public ICommand OpenThemeFolderCommand => new RelayCommand(OpenThemeFolder); + + public string Directory { get; set; } = ""; public string Name { get; set; } = ""; public string Title { get; set; } = "Editing \"Custom Theme\""; @@ -66,5 +69,10 @@ namespace Bloxstrap.UI.ViewModels.Editor Frontend.ShowMessageBox($"Failed to save theme: {ex.Message}", MessageBoxImage.Error, MessageBoxButton.OK); } } + + private void OpenThemeFolder() + { + Process.Start("explorer.exe", Directory); + } } }