From 578095768c86abae614ff0713f301e59dab8dd9d Mon Sep 17 00:00:00 2001 From: wherewhere Date: Sun, 5 Nov 2023 01:06:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreAppUWP/CoreAppUWP.csproj | 4 +++ CoreAppUWP/Pages/MainPage.xaml.cs | 6 ---- .../Pages/SettingsPages/SettingsPage.xaml | 35 +++++++++++-------- .../Pages/SettingsPages/SettingsPage.xaml.cs | 28 ++++++++++----- 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/CoreAppUWP/CoreAppUWP.csproj b/CoreAppUWP/CoreAppUWP.csproj index 96f505d..6c8c555 100644 --- a/CoreAppUWP/CoreAppUWP.csproj +++ b/CoreAppUWP/CoreAppUWP.csproj @@ -72,4 +72,8 @@ + + + + diff --git a/CoreAppUWP/Pages/MainPage.xaml.cs b/CoreAppUWP/Pages/MainPage.xaml.cs index edeb6af..0d71df9 100644 --- a/CoreAppUWP/Pages/MainPage.xaml.cs +++ b/CoreAppUWP/Pages/MainPage.xaml.cs @@ -39,12 +39,6 @@ protected override void OnNavigatedTo(NavigationEventArgs e) NavigationView_Navigate("Home", new EntranceNavigationTransitionInfo()); SystemNavigationManager.GetForCurrentView().BackRequested += System_BackRequested; CoreApplication.GetCurrentView().TitleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged; - - } - - private void Current_Closed(object sender, WindowEventArgs args) - { - } protected override void OnNavigatedFrom(NavigationEventArgs e) diff --git a/CoreAppUWP/Pages/SettingsPages/SettingsPage.xaml b/CoreAppUWP/Pages/SettingsPages/SettingsPage.xaml index 0ce9870..a859d72 100644 --- a/CoreAppUWP/Pages/SettingsPages/SettingsPage.xaml +++ b/CoreAppUWP/Pages/SettingsPages/SettingsPage.xaml @@ -76,22 +76,27 @@ Content="Exit" /> - - + Icon=""> + + + sender.Destroy(); + if (AppWindowTitleBar.IsCustomizationSupported()) + { + AppWindowTitleBar TitleBar = window.TitleBar; + Color ForegroundColor = Colors.Black; + Color BackgroundColor = Colors.White; - break; - case "NewDesktopWindow": - var window = AppWindow.Create(); + TitleBar.ExtendsContentIntoTitleBar = true; + TitleBar.ForegroundColor = TitleBar.ButtonForegroundColor = ForegroundColor; + TitleBar.BackgroundColor = TitleBar.InactiveBackgroundColor = BackgroundColor; + TitleBar.ButtonBackgroundColor = TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + } + window.Title = Package.Current.DisplayName; + window.SetIcon("favicon.ico"); window.Show(); - window.Closing += Window_Closing; break; case "SearchFlyout" when SettingsPaneRegister.IsSearchPaneSupported: SearchPane.GetForCurrentView().Show(); @@ -109,11 +124,6 @@ private async void Button_Click(object sender, RoutedEventArgs e) } } - private void Window_Closing(AppWindow sender, AppWindowClosingEventArgs args) - { - sender.Destroy(); - } - private async void HyperlinkButton_Click(object sender, RoutedEventArgs e) { switch ((sender as FrameworkElement).Tag.ToString())