diff --git a/Torch.Server/Themes/Dark Theme Animated.xaml b/Torch.Server/Themes/Dark Theme Animated.xaml index 96a1576..0e52633 100644 --- a/Torch.Server/Themes/Dark Theme Animated.xaml +++ b/Torch.Server/Themes/Dark Theme Animated.xaml @@ -11,4 +11,8 @@ + + \ No newline at end of file diff --git a/Torch.Server/Themes/Dark Theme.xaml b/Torch.Server/Themes/Dark Theme.xaml index 9d1080b..c7c2827 100644 --- a/Torch.Server/Themes/Dark Theme.xaml +++ b/Torch.Server/Themes/Dark Theme.xaml @@ -79,4 +79,8 @@ + + \ No newline at end of file diff --git a/Torch.Server/Themes/Light Theme Animated.xaml b/Torch.Server/Themes/Light Theme Animated.xaml new file mode 100644 index 0000000..759e8a7 --- /dev/null +++ b/Torch.Server/Themes/Light Theme Animated.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Torch.Server/Themes/Light Theme.xaml b/Torch.Server/Themes/Light Theme.xaml index 3ebffd8..668ecf5 100644 --- a/Torch.Server/Themes/Light Theme.xaml +++ b/Torch.Server/Themes/Light Theme.xaml @@ -1,4 +1,86 @@  + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index ff8a514..6b25d1f 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -368,6 +368,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Torch.Server/TorchConfig.cs b/Torch.Server/TorchConfig.cs index 7037a1a..c9a5041 100644 --- a/Torch.Server/TorchConfig.cs +++ b/Torch.Server/TorchConfig.cs @@ -65,6 +65,9 @@ namespace Torch.Server internal Point WindowSize { get; set; } = new Point(800, 600); internal Point WindowPosition { get; set; } = new Point(); + + public string LastUsedTheme { get; set; } = "Torch Theme"; + [XmlIgnore] private string _path; diff --git a/Torch.Server/Views/Resources.xaml b/Torch.Server/Views/Resources.xaml index 4f313ed..616a17a 100644 --- a/Torch.Server/Views/Resources.xaml +++ b/Torch.Server/Views/Resources.xaml @@ -16,7 +16,12 @@ + + + - \ No newline at end of file + \ No newline at end of file diff --git a/Torch.Server/Views/ThemeControl.xaml b/Torch.Server/Views/ThemeControl.xaml index caa1d99..b5e21f2 100644 --- a/Torch.Server/Views/ThemeControl.xaml +++ b/Torch.Server/Views/ThemeControl.xaml @@ -21,5 +21,11 @@ SelectionChanged="Selector_OnSelectionChanged"> + + + + Theme License + + diff --git a/Torch.Server/Views/ThemeControl.xaml.cs b/Torch.Server/Views/ThemeControl.xaml.cs index 5b2277d..24c9a3b 100644 --- a/Torch.Server/Views/ThemeControl.xaml.cs +++ b/Torch.Server/Views/ThemeControl.xaml.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Diagnostics; +using System.Windows.Navigation; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -21,6 +23,7 @@ namespace Torch.Server.Views public partial class ThemeControl : UserControl, INotifyPropertyChanged { public TorchUI uiSource; + private TorchConfig _torchConfig; public List Themes { @@ -37,8 +40,13 @@ namespace Torch.Server.Views this.DataContext = this; _themes["Dark theme"] = new ResourceDictionary() { Source = new Uri(@"/Themes/Dark Theme.xaml", UriKind.Relative) }; - _themes["Light theme"] = new ResourceDictionary() { Source = new Uri(@"/Themes/Light Theme.xaml", UriKind.Relative) }; _themes["Animated Dark theme"] = new ResourceDictionary() { Source = new Uri(@"/Themes/Dark Theme Animated.xaml", UriKind.Relative) }; + + _themes["Light theme"] = new ResourceDictionary() { Source = new Uri(@"/Themes/Light Theme.xaml", UriKind.Relative) }; + _themes["Light theme animated"] = new ResourceDictionary() { Source = new Uri(@"/Themes/Light Theme Animated.xaml", UriKind.Relative) }; + + _themes["Torch Theme"] = new ResourceDictionary() { Source = new Uri(@"/Views/Resources.xaml", UriKind.Relative) }; + if (null == System.Windows.Application.Current) { new System.Windows.Application(); @@ -51,6 +59,9 @@ namespace Torch.Server.Views var boxText = box.SelectedItem.ToString(); ChangeTheme(_themes[boxText].Source); + + if (_torchConfig != null) + _torchConfig.LastUsedTheme = boxText; } public void ChangeTheme(Uri uri) @@ -58,5 +69,19 @@ namespace Torch.Server.Views uiSource.Resources.MergedDictionaries.Clear(); uiSource.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uri }); } + + private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) + { + Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); + e.Handled = true; + } + + public void SetConfig(TorchConfig config) + { + _torchConfig = config; + + if (_themes.ContainsKey(config.LastUsedTheme)) + ChangeTheme(_themes[config.LastUsedTheme].Source); + } } } diff --git a/Torch.Server/Views/TorchUI.xaml.cs b/Torch.Server/Views/TorchUI.xaml.cs index d1215db..31f5c24 100644 --- a/Torch.Server/Views/TorchUI.xaml.cs +++ b/Torch.Server/Views/TorchUI.xaml.cs @@ -50,6 +50,7 @@ namespace Torch.Server Plugins.BindServer(server); Themes.uiSource = this; + Themes.SetConfig(_config); LoadConfig((TorchConfig)server.Config); }