From 2e0dd24cdd4c619a19845776ce87c87e6b73b043 Mon Sep 17 00:00:00 2001 From: Aleh Khantsevich Date: Mon, 15 Jul 2024 00:20:22 +0200 Subject: [PATCH] Fix title bar caption buttons theme --- Wino.Core.UWP/Services/ThemeService.cs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Wino.Core.UWP/Services/ThemeService.cs b/Wino.Core.UWP/Services/ThemeService.cs index 83f522e5..1379f81f 100644 --- a/Wino.Core.UWP/Services/ThemeService.cs +++ b/Wino.Core.UWP/Services/ThemeService.cs @@ -240,13 +240,9 @@ namespace Wino.Services _ = mainApplicationFrame.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => { - ApplicationViewTitleBar titleBar = null; - try - { - titleBar = ApplicationView.GetForCurrentView().TitleBar; - } - catch { } - if (titleBar == null) return; + var titleBar = _appShellService.AppWindow.AppWindow.TitleBar; + + if(titleBar == null) return; if (_underlyingThemeService.IsUnderlyingThemeDark()) { @@ -260,12 +256,8 @@ namespace Wino.Services #else _ = mainApplicationFrame.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { - ApplicationViewTitleBar titleBar = null; - try - { - titleBar = ApplicationView.GetForCurrentView().TitleBar; - } - catch { } + ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; + if (titleBar == null) return; if (_underlyingThemeService.IsUnderlyingThemeDark()) @@ -458,7 +450,7 @@ namespace Wino.Services { byte[] bytes = new byte[readerStream.Length]; - await readerStream.ReadAsync(bytes,0, bytes.Length); + await readerStream.ReadAsync(bytes, 0, bytes.Length); var buffer = bytes.AsBuffer();