From b0fd43ead53ab7cbc725627539fa64bb26c49f90 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Sun, 24 Aug 2025 16:29:28 -0400 Subject: [PATCH] fix input issue in search panel; fix display issue in lyrics window manager --- .../Package.appxmanifest | 2 +- .../BetterLyrics.WinUI3.csproj | 6 ++ .../Controls/LyricsSearchControl.xaml | 102 +++++++++--------- .../BetterLyrics.WinUI3/Helper/ColorHelper.cs | 5 + .../Helper/WindowHelper.cs | 4 + .../BetterLyrics.WinUI3/Models/LiveStates.cs | 16 +-- .../Strings/en-US/Resources.resw | 3 + .../Strings/ja-JP/Resources.resw | 3 + .../Strings/ko-KR/Resources.resw | 3 + .../Strings/zh-CN/Resources.resw | 3 + .../Strings/zh-TW/Resources.resw | 3 + .../BetterLyrics.WinUI3/Views/LyricsPage.xaml | 8 -- .../Views/LyricsPage.xaml.cs | 13 +-- .../Views/LyricsSearchWindow.xaml | 16 +++ .../Views/LyricsSearchWindow.xaml.cs | 47 ++++++++ 15 files changed, 155 insertions(+), 79 deletions(-) create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml.cs diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest index 03e609b..f9b6ebc 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest @@ -12,7 +12,7 @@ + Version="1.0.65.0" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj index 2475ad9..87671a1 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj @@ -32,6 +32,7 @@ + @@ -181,6 +182,11 @@ Always + + + MSBuild:Compile + + MSBuild:Compile diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSearchControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSearchControl.xaml index 8291c64..ead6a47 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSearchControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSearchControl.xaml @@ -13,61 +13,61 @@ - - - - - - - - - - diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml.cs index 5d096a6..a039fa7 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml.cs @@ -2,6 +2,7 @@ using BetterLyrics.WinUI3.Controls; using BetterLyrics.WinUI3.Enums; +using BetterLyrics.WinUI3.Helper; using BetterLyrics.WinUI3.Models.Settings; using BetterLyrics.WinUI3.Services.MediaSessionsService; using BetterLyrics.WinUI3.Services.SettingsService; @@ -133,17 +134,7 @@ namespace BetterLyrics.WinUI3.Views private void LyricsSearchShortcutButton_Click(object sender, RoutedEventArgs e) { - LyricsSearchFlyout.Content = new LyricsSearchControl - { - MaxHeight = 500, - MaxWidth = 850, - }; - LyricsSearchFlyout.ShowAt(BottomRightCommandStackPanel); - } - - private void LyricsSearchFlyout_Closed(object sender, object e) - { - LyricsSearchFlyout.Content = null; + WindowHelper.OpenWindow(); } private void TimelineSliderOverlay_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e) diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml new file mode 100644 index 0000000..5ec6376 --- /dev/null +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml.cs new file mode 100644 index 0000000..dbe824b --- /dev/null +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsSearchWindow.xaml.cs @@ -0,0 +1,47 @@ +using BetterLyrics.WinUI3.Helper; +using Microsoft.UI.Windowing; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace BetterLyrics.WinUI3.Views +{ + /// + /// An empty window that can be used on its own or navigated to within a Frame. + /// + public sealed partial class LyricsSearchWindow : Window + { + public LyricsSearchWindow() + { + InitializeComponent(); + + Title = App.ResourceLoader?.GetString("LyricsSearchPageTitle"); + AppWindow.TitleBar.PreferredTheme = TitleBarTheme.UseDefaultAppMode; + AppWindow.SetIcons(); + + AppWindow.Closing += AppWindow_Closing; + + SystemBackdrop = SystemBackdropHelper.CreateSystemBackdrop(Enums.BackdropType.Transparent); + } + + private void AppWindow_Closing(AppWindow sender, AppWindowClosingEventArgs args) + { + WindowHelper.CloseWindow(); + } + + } +}