FIx inconsistent WPF theming (#2621)

This commit is contained in:
pizzaboxer 2024-08-17 12:53:02 +01:00
parent d9f8cace43
commit 943acd78e8
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
14 changed files with 15 additions and 17 deletions

View File

@ -96,7 +96,6 @@ namespace Bloxstrap
return; return;
} }
bool confirmed = false; bool confirmed = false;
bool keepData = true; bool keepData = true;

View File

@ -11,10 +11,15 @@ using Wpf.Ui.Mvvm.Services;
namespace Bloxstrap.UI.Elements.Base namespace Bloxstrap.UI.Elements.Base
{ {
public class WpfUiWindow : UiWindow public abstract class WpfUiWindow : UiWindow
{ {
private readonly IThemeService _themeService = new ThemeService(); private readonly IThemeService _themeService = new ThemeService();
public WpfUiWindow()
{
ApplyTheme();
}
public void ApplyTheme() public void ApplyTheme()
{ {
_themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light); _themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);

View File

@ -78,7 +78,6 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
public ClassicFluentDialog() public ClassicFluentDialog()
{ {
InitializeComponent(); InitializeComponent();
ApplyTheme();
_viewModel = new ClassicFluentDialogViewModel(this); _viewModel = new ClassicFluentDialogViewModel(this);
DataContext = _viewModel; DataContext = _viewModel;

View File

@ -88,7 +88,6 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
public FluentDialog(bool aero) public FluentDialog(bool aero)
{ {
InitializeComponent(); InitializeComponent();
ApplyTheme();
_viewModel = new FluentDialogViewModel(this, aero); _viewModel = new FluentDialogViewModel(this, aero);
DataContext = _viewModel; DataContext = _viewModel;

View File

@ -31,7 +31,6 @@ namespace Bloxstrap.UI.Elements.ContextMenu
public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler, int? processId) public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler, int? processId)
{ {
InitializeComponent(); InitializeComponent();
ApplyTheme();
_activityWatcher = activityWatcher; _activityWatcher = activityWatcher;
_richPresenceHandler = richPresenceHandler; _richPresenceHandler = richPresenceHandler;

View File

@ -1,9 +1,10 @@
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.ContextMenu.ServerInformation" <base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.ContextMenu.ServerInformation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.ContextMenu" xmlns:local="clr-namespace:Bloxstrap.UI.Elements.ContextMenu"
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.ContextMenu" xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.ContextMenu"
xmlns:resources="clr-namespace:Bloxstrap.Resources" xmlns:resources="clr-namespace:Bloxstrap.Resources"
@ -56,4 +57,4 @@
</StackPanel> </StackPanel>
</Border> </Border>
</Grid> </Grid>
</ui:UiWindow> </base:WpfUiWindow>

View File

@ -1,10 +1,11 @@
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.Dialogs.AddFastFlagDialog" <base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Dialogs.AddFastFlagDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs" xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs"
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
xmlns:resources="clr-namespace:Bloxstrap.Resources" xmlns:resources="clr-namespace:Bloxstrap.Resources"
xmlns:converters="clr-namespace:Bloxstrap.UI.Converters" xmlns:converters="clr-namespace:Bloxstrap.UI.Converters"
mc:Ignorable="d" mc:Ignorable="d"
@ -101,4 +102,4 @@
</StackPanel> </StackPanel>
</Border> </Border>
</Grid> </Grid>
</ui:UiWindow> </base:WpfUiWindow>

View File

@ -1,10 +1,11 @@
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.Dialogs.FluentMessageBox" <base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Dialogs.FluentMessageBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs" xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs"
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
mc:Ignorable="d" mc:Ignorable="d"
Title="Bloxstrap" Title="Bloxstrap"
d:DesignWidth="480" d:DesignWidth="480"
@ -43,4 +44,4 @@
</StackPanel> </StackPanel>
</Border> </Border>
</Grid> </Grid>
</ui:UiWindow> </base:WpfUiWindow>

View File

@ -26,7 +26,6 @@ namespace Bloxstrap.UI.Elements.Dialogs
DataContext = viewModel; DataContext = viewModel;
InitializeComponent(); InitializeComponent();
ApplyTheme();
viewModel.CloseRequestEvent += (_, _) => Close(); viewModel.CloseRequestEvent += (_, _) => Close();
} }

View File

@ -36,7 +36,6 @@ namespace Bloxstrap.UI.Elements.Dialogs
DataContext = viewModel; DataContext = viewModel;
InitializeComponent(); InitializeComponent();
ApplyTheme();
} }
} }
} }

View File

@ -39,7 +39,6 @@ namespace Bloxstrap.UI.Elements.Dialogs
DataContext = viewModel; DataContext = viewModel;
InitializeComponent(); InitializeComponent();
ApplyTheme();
} }
} }
} }

View File

@ -62,7 +62,6 @@ namespace Bloxstrap.UI.Elements.Installer
DataContext = _viewModel; DataContext = _viewModel;
InitializeComponent(); InitializeComponent();
ApplyTheme();
App.Logger.WriteLine("MainWindow::MainWindow", "Initializing installer"); App.Logger.WriteLine("MainWindow::MainWindow", "Initializing installer");

View File

@ -1,5 +1,4 @@
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Settings.MainWindow" <base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Settings.MainWindow"
x:Name="ConfigurationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@ -18,7 +18,6 @@ namespace Bloxstrap.UI.Elements.Settings
DataContext = viewModel; DataContext = viewModel;
InitializeComponent(); InitializeComponent();
ApplyTheme();
App.Logger.WriteLine("MainWindow::MainWindow", "Initializing menu"); App.Logger.WriteLine("MainWindow::MainWindow", "Initializing menu");