diff --git a/Bloxstrap/UI/Elements/Base/WpfUiWindow.cs b/Bloxstrap/UI/Elements/Base/WpfUiWindow.cs
new file mode 100644
index 0000000..d941ea8
--- /dev/null
+++ b/Bloxstrap/UI/Elements/Base/WpfUiWindow.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Wpf.Ui.Appearance;
+using Wpf.Ui.Controls;
+using Wpf.Ui.Mvvm.Contracts;
+using Wpf.Ui.Mvvm.Services;
+
+namespace Bloxstrap.UI.Elements.Base
+{
+ public class WpfUiWindow : UiWindow
+ {
+ private readonly IThemeService _themeService = new ThemeService();
+
+ public void ApplyTheme()
+ {
+ _themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
+ _themeService.SetSystemAccent();
+ }
+ }
+}
diff --git a/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml b/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml
index 5602e8c..40cc7f9 100644
--- a/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml
+++ b/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml
@@ -1,9 +1,10 @@
-
-
+
diff --git a/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml.cs b/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml.cs
index 011a302..7ab6cdc 100644
--- a/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml.cs
+++ b/Bloxstrap/UI/Elements/Bootstrapper/FluentDialog.xaml.cs
@@ -15,8 +15,6 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
///
public partial class FluentDialog : IBootstrapperDialog
{
- private readonly IThemeService _themeService = new ThemeService();
-
private readonly BootstrapperDialogViewModel _viewModel;
public Bloxstrap.Bootstrapper? Bootstrapper { get; set; }
@@ -69,15 +67,13 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
public FluentDialog()
{
+ InitializeComponent();
+ ApplyTheme();
+
_viewModel = new FluentDialogViewModel(this);
DataContext = _viewModel;
Title = App.Settings.Prop.BootstrapperTitle;
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
-
- _themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
- _themeService.SetSystemAccent();
-
- InitializeComponent();
}
private void UiWindow_Closing(object sender, CancelEventArgs e)
diff --git a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml
index d2ad043..58d48b3 100644
--- a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml
+++ b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml
@@ -1,10 +1,11 @@
-
-
+
diff --git a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs
index 8354ced..f2b8df0 100644
--- a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs
+++ b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs
@@ -2,6 +2,10 @@
using System.Windows.Controls;
using System.Windows.Interop;
+using Wpf.Ui.Appearance;
+using Wpf.Ui.Mvvm.Contracts;
+using Wpf.Ui.Mvvm.Services;
+
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
@@ -26,7 +30,8 @@ namespace Bloxstrap.UI.Elements.ContextMenu
public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler)
{
InitializeComponent();
-
+ ApplyTheme();
+
_activityWatcher = activityWatcher;
_richPresenceHandler = richPresenceHandler;
diff --git a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml
index 6fee20e..2a00fdd 100644
--- a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml
+++ b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml
@@ -1,4 +1,4 @@
-
-
+
diff --git a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs
index 968dabf..2c748f9 100644
--- a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs
+++ b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs
@@ -14,21 +14,14 @@ namespace Bloxstrap.UI.Elements.Menu
///
public partial class MainWindow : INavigationWindow
{
- private readonly IThemeService _themeService = new ThemeService();
-
public MainWindow()
{
+ InitializeComponent();
+ ApplyTheme();
+
App.Logger.WriteLine("MainWindow::MainWindow", "Initializing menu");
DataContext = new MainWindowViewModel(this);
- SetTheme();
- InitializeComponent();
- }
-
- public void SetTheme()
- {
- _themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
- _themeService.SetSystemAccent();
}
public void OpenWiki(object? sender, EventArgs e) => Utilities.ShellExecute($"https://github.com/{App.ProjectRepository}/wiki");
diff --git a/Bloxstrap/UI/ViewModels/Menu/AppearanceViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/AppearanceViewModel.cs
index cb81afa..9f8a453 100644
--- a/Bloxstrap/UI/ViewModels/Menu/AppearanceViewModel.cs
+++ b/Bloxstrap/UI/ViewModels/Menu/AppearanceViewModel.cs
@@ -63,7 +63,7 @@ namespace Bloxstrap.UI.ViewModels.Menu
set
{
App.Settings.Prop.Theme = Themes[value];
- ((MainWindow)Window.GetWindow(_page)!).SetTheme();
+ ((MainWindow)Window.GetWindow(_page)!).ApplyTheme();
}
}