mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Fix theme not applying to notification area menu
This commit is contained in:
parent
0cca373833
commit
197429dbf9
24
Bloxstrap/UI/Elements/Base/WpfUiWindow.cs
Normal file
24
Bloxstrap/UI/Elements/Base/WpfUiWindow.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.Bootstrapper.FluentDialog"
|
||||
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Bootstrapper.FluentDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
|
||||
mc:Ignorable="d"
|
||||
Width="420"
|
||||
MinHeight="0"
|
||||
@ -46,4 +47,4 @@
|
||||
<Button Margin="0" Content="Cancel" Width="120" HorizontalAlignment="Right" IsEnabled="{Binding CancelEnabled, Mode=OneWay}" Command="{Binding CancelInstallCommand}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</ui:UiWindow>
|
||||
</base:WpfUiWindow>
|
||||
|
@ -15,8 +15,6 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
|
||||
/// </summary>
|
||||
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)
|
||||
|
@ -1,10 +1,11 @@
|
||||
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.ContextMenu.MenuContainer"
|
||||
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.ContextMenu.MenuContainer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.ContextMenu"
|
||||
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
|
||||
mc:Ignorable="d"
|
||||
Title="ContextMenuContainer"
|
||||
MinWidth="0"
|
||||
@ -62,4 +63,4 @@
|
||||
<MenuItem x:Name="LogTracerMenuItem" Header="Open log tracer" Visibility="Collapsed" Click="LogTracerMenuItem_Click" />
|
||||
</ContextMenu>
|
||||
</ui:UiWindow.ContextMenu>
|
||||
</ui:UiWindow>
|
||||
</base:WpfUiWindow>
|
||||
|
@ -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,6 +30,7 @@ namespace Bloxstrap.UI.Elements.ContextMenu
|
||||
public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler)
|
||||
{
|
||||
InitializeComponent();
|
||||
ApplyTheme();
|
||||
|
||||
_activityWatcher = activityWatcher;
|
||||
_richPresenceHandler = richPresenceHandler;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.Menu.MainWindow"
|
||||
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Menu.MainWindow"
|
||||
x:Name="ConfigurationWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@ -6,6 +6,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pages="clr-namespace:Bloxstrap.UI.Elements.Menu.Pages"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
|
||||
mc:Ignorable="d"
|
||||
Title="Bloxstrap Menu"
|
||||
MinWidth="960"
|
||||
@ -79,4 +80,4 @@
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</ui:UiWindow>
|
||||
</base:WpfUiWindow>
|
||||
|
@ -14,21 +14,14 @@ namespace Bloxstrap.UI.Elements.Menu
|
||||
/// </summary>
|
||||
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");
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user