From 004079a7ee8da02abbbdf866651579ea6f0e27e0 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Thu, 6 Nov 2025 11:27:59 -0500 Subject: [PATCH] feat: support create and import playlist; fix text in textbox overflow issue in search window; change in-app push style --- .../Package.appxmanifest | 2 +- .../BetterLyrics.WinUI3/App.xaml | 11 +- .../BetterLyrics.WinUI3/App.xaml.cs | 18 +- .../BetterLyrics.WinUI3.csproj | 11 +- .../AlbumArtLayoutSettingsControl.xaml | 57 +- .../Controls/AppSettingsControl.xaml | 53 +- .../LyricsBackgroundSettingsControl.xaml | 80 ++- .../Controls/LyricsEffectSettingsControl.xaml | 154 +++--- .../Controls/LyricsSearchControl.xaml | 9 +- .../Controls/LyricsStyleSettingsControl.xaml | 97 ++-- .../Controls/LyricsWindowSettingsControl.xaml | 105 ++-- .../Controls/MediaSettingsControl.xaml | 31 +- .../Controls/PlaybackSettingsControl.xaml | 133 ++--- .../Controls/ShortcutTextBox.xaml.cs | 12 +- ...ArtSearchProviderToDisplayNameConverter.cs | 8 +- .../Converter/ByteArrayToImageConverter.cs | 7 +- .../Converter/IntToBoolConverter.cs | 26 + ...icsSearchProviderToDisplayNameConverter.cs | 14 +- ...chedLocalFilesPathToVisibilityConverter.cs | 8 +- .../SecondsToFormattedTimeConverter.cs | 18 +- .../Converter/TrackToLyricsConverter.cs | 28 + ...ionSearchProviderToDisplayNameConverter.cs | 14 +- .../Enums/CommonSongProperty.cs | 3 +- .../BetterLyrics.WinUI3/Helper/ImageHelper.cs | 3 +- .../Helper/LanguageHelper.cs | 5 +- .../BetterLyrics.WinUI3/Helper/PathHelper.cs | 1 + .../Helper/PhoneticHelper.cs | 12 +- .../BetterLyrics.WinUI3/Helper/TrackHelper.cs | 9 + .../BetterLyrics.WinUI3/Models/LyricsData.cs | 6 +- .../Models/LyricsWindowStatus.cs | 14 +- .../Services/LastFMService/LastFMService.cs | 25 +- .../LyricsSearchService.cs | 2 +- .../MediaSessionsService.LyricsUpdater.cs | 2 +- .../MediaSessionsService.cs | 8 +- .../ResourceService/IResourceService.cs | 13 + .../ResourceService/ResourceService.cs | 19 + .../TranslateService/TranslateService.cs | 2 +- .../Strings/en-US/Resources.resw | 25 +- .../Strings/ja-JP/Resources.resw | 25 +- .../Strings/ko-KR/Resources.resw | 25 +- .../Strings/zh-CN/Resources.resw | 25 +- .../Strings/zh-TW/Resources.resw | 25 +- .../LyricsRendererViewModel.Messages.cs | 3 + .../MediaSettingsControlViewModel.cs | 12 +- .../ViewModels/MusicGalleryViewModel.cs | 84 ++- .../PlaybackSettingsControlViewModel.cs | 14 +- .../ViewModels/SettingsPageViewModel.cs | 11 +- .../BetterLyrics.WinUI3/Views/LyricsPage.xaml | 8 +- .../Views/LyricsSearchWindow.xaml.cs | 6 +- .../Views/LyricsWindow.xaml | 12 - .../Views/LyricsWindow.xaml.cs | 10 +- .../Views/MusicGalleryPage.xaml | 510 ++++++++++++------ .../Views/MusicGalleryPage.xaml.cs | 111 ++-- .../Views/MusicGalleryWindow.xaml.cs | 6 +- .../Views/SettingsPage.xaml | 85 +-- .../Views/SettingsWindow.xaml | 11 - .../Views/SettingsWindow.xaml.cs | 10 +- 57 files changed, 1292 insertions(+), 746 deletions(-) create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Converter/IntToBoolConverter.cs create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Converter/TrackToLyricsConverter.cs create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ResourceService/IResourceService.cs create mode 100644 BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ResourceService/ResourceService.cs diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest index 0b8d0ab..0054877 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest @@ -12,7 +12,7 @@ + Version="1.0.95.0" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml index 2f4c05d..e66994f 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml @@ -13,8 +13,8 @@ - + @@ -66,10 +66,13 @@ + + + 4 @@ -305,8 +308,12 @@ - diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs index 1b4d7fb..c24b383 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs @@ -9,6 +9,7 @@ using BetterLyrics.WinUI3.Services.LibWatcherService; using BetterLyrics.WinUI3.Services.LiveStatesService; using BetterLyrics.WinUI3.Services.LyricsSearchService; using BetterLyrics.WinUI3.Services.MediaSessionsService; +using BetterLyrics.WinUI3.Services.ResourceService; using BetterLyrics.WinUI3.Services.SettingsService; using BetterLyrics.WinUI3.Services.TranslateService; using BetterLyrics.WinUI3.ViewModels; @@ -22,7 +23,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.Windows.ApplicationModel.Resources; using Serilog; -using ShadowViewer.Controls; using System; using System.Diagnostics; using System.Linq; @@ -39,12 +39,6 @@ namespace BetterLyrics.WinUI3 private readonly ILogger _logger; public static new App Current => (App)Application.Current; - public static DispatcherQueue? DispatcherQueue { get; private set; } - public static DispatcherQueueTimer? DispatcherQueueTimer { get; private set; } - public static ResourceLoader? ResourceLoader { get; private set; } - - public NotificationPanel? LyricsWindowNotificationPanel { get; set; } - public NotificationPanel? SettingsWindowNotificationPanel { get; set; } private static Mutex? _instanceMutex; @@ -52,10 +46,6 @@ namespace BetterLyrics.WinUI3 { this.InitializeComponent(); - DispatcherQueue = DispatcherQueue.GetForCurrentThread(); - DispatcherQueueTimer = DispatcherQueue.CreateTimer(); - ResourceLoader = new ResourceLoader(); - EnsureSingleInstance(); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); @@ -72,12 +62,11 @@ namespace BetterLyrics.WinUI3 private void EnsureSingleInstance() { - bool createdNew; - _instanceMutex = new Mutex(true, Constants.App.AppName, out createdNew); + _instanceMutex = new Mutex(true, Constants.App.AppName, out bool createdNew); if (!createdNew) { - User32.MessageBox(HWND.NULL, ResourceLoader!.GetString("TryRunMultipleInstance"), null, User32.MB_FLAGS.MB_APPLMODAL); + User32.MessageBox(HWND.NULL, new ResourceLoader().GetString("TryRunMultipleInstance"), null, User32.MB_FLAGS.MB_APPLMODAL); Environment.Exit(0); } } @@ -111,6 +100,7 @@ namespace BetterLyrics.WinUI3 .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() // ViewModels .AddSingleton() .AddSingleton() diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj index c575964..c55bf46 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj @@ -50,20 +50,16 @@ - - - - - + @@ -74,7 +70,7 @@ - + @@ -82,7 +78,6 @@ - @@ -92,7 +87,7 @@ - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml index 7dd9c2a..4ff2b65 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml @@ -7,6 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:dev="using:DevWinUI" xmlns:ui="using:CommunityToolkit.WinUI" mc:Ignorable="d"> @@ -17,16 +18,16 @@ - - - + + - - + + - - - + + + - + - + - + - + - + - + - - - + + - - + + - - - + + + - - - + + - - - + + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml index 9ce9dff..9a1be26 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml @@ -5,6 +5,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dev="using:DevWinUI" xmlns:globalization="using:Windows.Globalization" xmlns:helper="using:BetterLyrics.WinUI3.Helper" xmlns:local="using:BetterLyrics.WinUI3.Controls" @@ -22,7 +23,7 @@ - - - + + + + Grid.Row="2" + ItemsSource="{x:Bind ViewModel.AppSettings.StarredPlaylists, Mode=OneWay}"> @@ -121,33 +257,28 @@ - - - - - - - - - - - - + + + + + + + + - + @@ -163,7 +294,7 @@ @@ -172,7 +303,7 @@ @@ -206,7 +337,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs index a7b8316..51c7e7e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs @@ -1,4 +1,5 @@ using BetterLyrics.WinUI3.Helper; +using BetterLyrics.WinUI3.Services.ResourceService; using BetterLyrics.WinUI3.ViewModels; using CommunityToolkit.Mvvm.DependencyInjection; using Microsoft.UI.Windowing; @@ -9,12 +10,14 @@ namespace BetterLyrics.WinUI3.Views { public sealed partial class SettingsWindow : Window { + private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService(); + public SettingsWindowViewModel ViewModel { get; set; } = Ioc.Default.GetRequiredService(); public SettingsWindow() { InitializeComponent(); - Title = App.ResourceLoader?.GetString("SettingsPageTitle"); + Title = _resourceService.GetLocalizedString("SettingsPageTitle"); AppWindow.TitleBar.PreferredTheme = TitleBarTheme.UseDefaultAppMode; AppWindow.SetIcons(); @@ -30,11 +33,6 @@ namespace BetterLyrics.WinUI3.Views WindowHelper.CloseWindow(); } - private void TipContainerCenter_Loaded(object sender, RoutedEventArgs e) - { - App.Current.SettingsWindowNotificationPanel = TipContainerCenter; - } - private void LyricsWindowButton_Click(object sender, RoutedEventArgs e) { WindowHelper.OpenOrShowWindow();