From cc753d89d4925948ffa563626afa85c38a996c0f Mon Sep 17 00:00:00 2001 From: Scighost Date: Thu, 28 Dec 2023 14:46:17 +0800 Subject: [PATCH] delete useless combo box drop down event --- src/Starward/Pages/GachaLogPage.xaml.cs | 16 ++-------------- src/Starward/Pages/ImageViewPage.xaml.cs | 4 ++-- src/Starward/Pages/SelfQueryPage.xaml.cs | 17 ----------------- src/Starward/Pages/SettingPage.xaml.cs | 13 ------------- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/src/Starward/Pages/GachaLogPage.xaml.cs b/src/Starward/Pages/GachaLogPage.xaml.cs index 4b1040771..56d487324 100644 --- a/src/Starward/Pages/GachaLogPage.xaml.cs +++ b/src/Starward/Pages/GachaLogPage.xaml.cs @@ -368,7 +368,7 @@ private async Task InputUrlAsync() // 取消 SecondaryButtonText = Lang.Common_Cancel, DefaultButton = ContentDialogButton.Primary, - XamlRoot = MainWindow.Current.Content.XamlRoot, + XamlRoot = this.XamlRoot, }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) @@ -454,7 +454,7 @@ private async Task DeleteUidAsync() // 取消 SecondaryButtonText = Lang.Common_Cancel, DefaultButton = ContentDialogButton.Secondary, - XamlRoot = MainWindow.Current.Content.XamlRoot, + XamlRoot = this.XamlRoot, }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) @@ -574,18 +574,6 @@ private async Task ImportGachaLogAsync() - private void ComboBox_Uid_DropDownOpened(object sender, object e) - { - MainWindow.Current.SetDragRectangles(); - } - - - - private void ComboBox_Uid_DropDownClosed(object sender, object e) - { - MainPage.Current.UpdateDragRectangles(); - } - [RelayCommand] diff --git a/src/Starward/Pages/ImageViewPage.xaml.cs b/src/Starward/Pages/ImageViewPage.xaml.cs index 6f73b2e89..98c51aead 100644 --- a/src/Starward/Pages/ImageViewPage.xaml.cs +++ b/src/Starward/Pages/ImageViewPage.xaml.cs @@ -295,8 +295,8 @@ private async Task OpenFileAsync() [RelayCommand] private void Close() { - MainWindow.Current?.CloseOverlayPage(); - MainWindow.Current?.AppWindow?.SetPresenter(AppWindowPresenterKind.Overlapped); + MainWindow.Current.CloseOverlayPage(); + MainWindow.Current.AppWindow.SetPresenter(AppWindowPresenterKind.Overlapped); } diff --git a/src/Starward/Pages/SelfQueryPage.xaml.cs b/src/Starward/Pages/SelfQueryPage.xaml.cs index d2ed7ae9e..a9bf538fc 100644 --- a/src/Starward/Pages/SelfQueryPage.xaml.cs +++ b/src/Starward/Pages/SelfQueryPage.xaml.cs @@ -543,23 +543,6 @@ private async Task DeleteCurrentMonthData() - - private void ComboBox_Uid_DropDownOpened(object sender, object e) - { - MainWindow.Current.SetDragRectangles(); - } - - - - private void ComboBox_Uid_DropDownClosed(object sender, object e) - { - MainPage.Current.UpdateDragRectangles(); - } - - - - - private static string TypeToIcon(GenshinQueryType type) { return type switch diff --git a/src/Starward/Pages/SettingPage.xaml.cs b/src/Starward/Pages/SettingPage.xaml.cs index b6e459a27..9ee40b064 100644 --- a/src/Starward/Pages/SettingPage.xaml.cs +++ b/src/Starward/Pages/SettingPage.xaml.cs @@ -158,19 +158,6 @@ private void ComboBox_Language_SelectionChanged(object sender, SelectionChangedE } - - private void ComboBox_Language_DropDownOpened(object sender, object e) - { - MainWindow.Current.SetDragRectangles(); - } - - private void ComboBox_Language_DropDownClosed(object sender, object e) - { - MainPage.Current.UpdateDragRectangles(); - } - - - #endregion