Merge pull request #1456 from DGP-Studio/fix/darkmode

fix #1434
This commit is contained in:
DismissedLight
2024-03-10 14:13:10 +08:00
committed by GitHub
2 changed files with 5 additions and 10 deletions

View File

@@ -69,12 +69,10 @@ internal sealed class WindowController
window.Activate(); window.Activate();
options.BringToForeground(); options.BringToForeground();
if (options.UseSystemBackdrop) AppOptions appOptions = serviceProvider.GetRequiredService<AppOptions>();
{ UpdateElementTheme(appOptions.ElementTheme);
AppOptions appOptions = serviceProvider.GetRequiredService<AppOptions>(); UpdateSystemBackdrop(appOptions.BackdropType);
UpdateSystemBackdrop(appOptions.BackdropType); appOptions.PropertyChanged += OnOptionsPropertyChanged;
appOptions.PropertyChanged += OnOptionsPropertyChanged;
}
subclass.Initialize(); subclass.Initialize();

View File

@@ -41,21 +41,18 @@ internal readonly struct WindowOptions
/// </summary> /// </summary>
public readonly bool PersistSize; public readonly bool PersistSize;
public readonly bool UseSystemBackdrop;
/// <summary> /// <summary>
/// 是否使用 Win UI 3 自带的拓展标题栏实现 /// 是否使用 Win UI 3 自带的拓展标题栏实现
/// </summary> /// </summary>
public readonly bool UseLegacyDragBarImplementation = !AppWindowTitleBar.IsCustomizationSupported(); public readonly bool UseLegacyDragBarImplementation = !AppWindowTitleBar.IsCustomizationSupported();
public WindowOptions(Window window, FrameworkElement titleBar, SizeInt32 initSize, bool persistSize = false, bool useSystemBackdrop = true) public WindowOptions(Window window, FrameworkElement titleBar, SizeInt32 initSize, bool persistSize = false)
{ {
Hwnd = WindowNative.GetWindowHandle(window); Hwnd = WindowNative.GetWindowHandle(window);
InputNonClientPointerSource = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id); InputNonClientPointerSource = InputNonClientPointerSource.GetForWindowId(window.AppWindow.Id);
TitleBar = titleBar; TitleBar = titleBar;
InitSize = initSize; InitSize = initSize;
PersistSize = persistSize; PersistSize = persistSize;
UseSystemBackdrop = useSystemBackdrop;
} }
/// <summary> /// <summary>