diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj
index 5ab5f88..4b4ea25 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj
@@ -26,7 +26,6 @@
-
@@ -61,6 +60,7 @@
+
@@ -87,11 +87,6 @@
-
-
- ..\..\..\Last.fm\src\Hqub.Lastfm\bin\Release\netstandard2.0\Hqub.Lastfm.dll
-
-
MSBuild:Compile
@@ -222,7 +217,7 @@
-
+
MSBuild:Compile
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml
index c40ce82..45237bc 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml
@@ -55,6 +55,7 @@
+
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBavkgroundSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml
similarity index 98%
rename from BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBavkgroundSettingsControl.xaml
rename to BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml
index 73ccbdd..32d254e 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBavkgroundSettingsControl.xaml
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsBackgroundSettingsControl.xaml
@@ -1,6 +1,6 @@
(LyricsBackgroundSettingsControlViewModel)DataContext;
- public LyricsBavkgroundSettingsControl()
+ public LyricsBackgroundSettingsControl()
{
InitializeComponent();
DataContext = Ioc.Default.GetRequiredService();
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSettingsControl.xaml
index 9b15162..9cae603 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSettingsControl.xaml
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsSettingsControl.xaml
@@ -319,6 +319,7 @@
+
+
+
+
+
+
+
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml
index bec30c7..3a9774b 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml
@@ -24,6 +24,14 @@
FontSize=12,
Glyph=}"
Style="{StaticResource GhostButtonStyle}" />
+
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs
index bf59f81..641e172 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/ShortcutTextBox.xaml.cs
@@ -1,3 +1,4 @@
+using BetterLyrics.WinUI3.Helper;
using Microsoft.UI.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@@ -91,5 +92,22 @@ namespace BetterLyrics.WinUI3.Controls
Shortcut = [];
UpdateTextBox();
}
+
+ private void CheckButton_Click(object sender, RoutedEventArgs e)
+ {
+ bool registered = GlobalHotKeyHelper.IsHotKeyRegistered(Shortcut);
+ if (registered)
+ {
+ App.Current.SettingsWindowNotificationPanel?.Notify(
+ App.ResourceLoader!.GetString("SettingsPageShortcutRegSuccessInfo"),
+ InfoBarSeverity.Success);
+ }
+ else
+ {
+ App.Current.SettingsWindowNotificationPanel?.Notify(
+ App.ResourceLoader!.GetString("SettingsPageShortcutRegFailInfo"),
+ InfoBarSeverity.Error);
+ }
+ }
}
}
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/GlobalHotKeyHelper.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/GlobalHotKeyHelper.cs
index f45d2f6..8682122 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/GlobalHotKeyHelper.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/GlobalHotKeyHelper.cs
@@ -13,7 +13,8 @@ namespace BetterLyrics.WinUI3.Helper
{
public class GlobalHotKeyHelper
{
- private static Dictionary _hotKeyActions = [];
+ private static Dictionary _actions = [];
+ private static Dictionary> _keys = [];
///
/// Register a global hotkey for a specific window type
@@ -22,7 +23,7 @@ namespace BetterLyrics.WinUI3.Helper
///
///
///
- public static void RegisterHotKey(ShortcutID id, List keys, Action action)
+ private static void RegisterHotKey(ShortcutID id, List keys, Action action)
{
if (keys.Count == 0) return;
@@ -55,18 +56,23 @@ namespace BetterLyrics.WinUI3.Helper
key = (VirtualKey)Enum.Parse(typeof(VirtualKey), item, true);
}
}
- User32.RegisterHotKey(hwnd, (int)id, modifiers, (uint)key);
- _hotKeyActions[(int)id] = action;
+ bool success = User32.RegisterHotKey(hwnd, (int)id, modifiers, (uint)key);
+ if (success)
+ {
+ _actions[(int)id] = action;
+ _keys[(int)id] = keys;
+ }
}
- public static void UnregisterHotKey(ShortcutID id)
+ private static void UnregisterHotKey(ShortcutID id)
{
var window = WindowHelper.GetWindowByWindowType();
if (window == null) return;
HWND hwnd = WindowNative.GetWindowHandle(window);
User32.UnregisterHotKey(hwnd, (int)id);
- _hotKeyActions.Remove((int)id);
+ _actions.Remove((int)id);
+ _keys.Remove((int)id);
}
public static void UpdateHotKey(ShortcutID id, List keys, Action action)
@@ -75,6 +81,16 @@ namespace BetterLyrics.WinUI3.Helper
RegisterHotKey(id, keys, action);
}
+ public static bool IsHotKeyRegistered(ShortcutID id)
+ {
+ return _actions.ContainsKey((int)id);
+ }
+
+ public static bool IsHotKeyRegistered(List keys)
+ {
+ return _keys.ContainsValue(keys);
+ }
+
public static bool TryInvokeAction(ShortcutID id)
{
return TryInvokeAction((int)id);
@@ -82,7 +98,7 @@ namespace BetterLyrics.WinUI3.Helper
public static bool TryInvokeAction(int id)
{
- if (_hotKeyActions.TryGetValue(id, out var action))
+ if (_actions.TryGetValue(id, out var action))
{
action?.Invoke();
return true;
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/LanguageHelper.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/LanguageHelper.cs
index f6243a7..e415b3b 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/LanguageHelper.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/LanguageHelper.cs
@@ -72,9 +72,9 @@ namespace BetterLyrics.WinUI3.Services
code = code switch
{
"simple" => "en",
- "zh_classical" => "zh-Hant",
- "zh_yue" => "zh-Hant",
- "zh" => "zh-Hans",
+ "zh_classical" => SimplifiedChineseOrTraditionalChinese(text),
+ "zh_yue" => SimplifiedChineseOrTraditionalChinese(text),
+ "zh" => SimplifiedChineseOrTraditionalChinese(text),
_ => code
};
return code;
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/PointHelper.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/PointHelper.cs
new file mode 100644
index 0000000..7bab427
--- /dev/null
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/PointHelper.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.Foundation;
+using Windows.Graphics;
+
+namespace BetterLyrics.WinUI3.Helper
+{
+ public static class PointHelper
+ {
+ public static PointInt32 ToPointInt32(this Point point)
+ {
+ return new PointInt32((int)point.X, (int)point.Y);
+ }
+ }
+}
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/ValueTransition.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/ValueTransition.cs
index 4ff058c..b37ca59 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/ValueTransition.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/ValueTransition.cs
@@ -1,7 +1,6 @@
// 2025/6/23 by Zhe Fang
using System;
-using System.Diagnostics;
using BetterLyrics.WinUI3.Enums;
namespace BetterLyrics.WinUI3.Helper
@@ -11,6 +10,8 @@ namespace BetterLyrics.WinUI3.Helper
{
private T _currentValue;
private double _durationSeconds;
+ private double _delaySeconds;
+ private double _delayRemaining;
private EasingType? _easingType;
private Func _interpolator;
private bool _isTransitioning;
@@ -19,18 +20,21 @@ namespace BetterLyrics.WinUI3.Helper
private T _targetValue;
public double DurationSeconds => _durationSeconds;
+ public double DelaySeconds => _delaySeconds;
public bool IsTransitioning => _isTransitioning;
public T Value => _currentValue;
public T TargetValue => _targetValue;
public EasingType? EasingType => _easingType;
- public ValueTransition(T initialValue, double durationSeconds, Func? interpolator = null, EasingType? easingType = null)
+ public ValueTransition(T initialValue, double durationSeconds, Func? interpolator = null, EasingType? easingType = null, double delaySeconds = 0)
{
_currentValue = initialValue;
_startValue = initialValue;
_targetValue = initialValue;
_durationSeconds = durationSeconds;
+ _delaySeconds = delaySeconds;
+ _delayRemaining = 0;
_progress = 1f;
_isTransitioning = false;
@@ -58,12 +62,18 @@ namespace BetterLyrics.WinUI3.Helper
_durationSeconds = seconds;
}
+ public void SetDelay(double seconds)
+ {
+ _delaySeconds = seconds;
+ }
+
private void JumpTo(T value)
{
_currentValue = value;
_startValue = value;
_targetValue = value;
_progress = 1f;
+ _delayRemaining = 0;
_isTransitioning = false;
}
@@ -73,6 +83,7 @@ namespace BetterLyrics.WinUI3.Helper
_startValue = value;
_targetValue = value;
_progress = 0f;
+ _delayRemaining = 0;
_isTransitioning = false;
}
@@ -89,6 +100,7 @@ namespace BetterLyrics.WinUI3.Helper
_startValue = _currentValue;
_targetValue = targetValue;
_progress = 0f;
+ _delayRemaining = _delaySeconds;
_isTransitioning = true;
}
}
@@ -103,7 +115,24 @@ namespace BetterLyrics.WinUI3.Helper
{
if (!_isTransitioning) return;
- _progress += (double)(elapsedTime / TimeSpan.FromSeconds(_durationSeconds));
+ if (_delayRemaining > 0)
+ {
+ double consume = Math.Min(_delayRemaining, elapsedTime.TotalSeconds);
+ _delayRemaining -= consume;
+ if (_delayRemaining > 0)
+ return;
+ elapsedTime = TimeSpan.FromSeconds(elapsedTime.TotalSeconds - consume);
+ }
+
+ if (_durationSeconds <= 0)
+ {
+ _progress = 1f;
+ }
+ else
+ {
+ _progress += elapsedTime.TotalSeconds / _durationSeconds;
+ }
+
if (_progress >= 1f)
{
_progress = 1f;
@@ -178,4 +207,4 @@ namespace BetterLyrics.WinUI3.Helper
_interpolator = GetInterpolatorByEasingType(easingType);
}
}
-}
+}
\ No newline at end of file
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs
index 837d4eb..4cc2595 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/LyricsEffectSettings.cs
@@ -31,6 +31,8 @@ namespace BetterLyrics.WinUI3.Models.Settings
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollDuration { get; set; }
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollTopDuration { get; set; }
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollBottomDuration { get; set; }
+ [ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollTopDelay { get; set; } = 0;
+ [ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollBottomDelay { get; set; } = 0;
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsVerticalEdgeOpacity { get; set; } = 0; // 0% opacity
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsFanLyricsEnabled { get; set; } = false;
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/PictureInPictureModeSettings.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/PictureInPictureModeSettings.cs
index 272d0ec..c00f856 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/PictureInPictureModeSettings.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/PictureInPictureModeSettings.cs
@@ -4,11 +4,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Windows.Foundation;
namespace BetterLyrics.WinUI3.Models.Settings
{
public partial class PictureInPictureModeSettings : BaseModeSettings
{
+ [ObservableProperty][NotifyPropertyChangedRecipients] public partial Point WindowPosition { get; set; } = new Point(100, 100);
[ObservableProperty][NotifyPropertyChangedRecipients] public partial List ToggleShortcut { get; set; } = new List() { "Ctrl", "Shift", "P" };
public PictureInPictureModeSettings()
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/StandardModeSettings.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/StandardModeSettings.cs
index 1ac65e6..594c0cb 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/StandardModeSettings.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Models/Settings/StandardModeSettings.cs
@@ -13,7 +13,8 @@ namespace BetterLyrics.WinUI3.Models.Settings
public partial class StandardModeSettings : BaseModeSettings
{
[ObservableProperty][NotifyPropertyChangedRecipients] public partial Rect WindowBounds { get; set; } = new Rect(100, 100, 1000, 600);
-
+ [ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsMaximized { get; set; } = false;
+
public StandardModeSettings()
{
LyricsDisplayType = LyricsDisplayType.SplitView;
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/AlbumArtSearchService/AlbumArtSearchService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/AlbumArtSearchService/AlbumArtSearchService.cs
index d5a2a69..f03f231 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/AlbumArtSearchService/AlbumArtSearchService.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/AlbumArtSearchService/AlbumArtSearchService.cs
@@ -31,6 +31,11 @@ namespace BetterLyrics.WinUI3.Services.AlbumArtSearchService
}
public async Task SearchAsync(string mediaSessionId, string title, string artist, string album, byte[]? bytesFromSMTC = null)
+ {
+ return await Task.Run(async () => await SearchAsyncCore(mediaSessionId, title, artist, album, bytesFromSMTC));
+ }
+
+ public async Task SearchAsyncCore(string mediaSessionId, string title, string artist, string album, byte[]? bytesFromSMTC = null)
{
byte[]? result = null;
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/LyricsSearchService/LyricsSearchService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/LyricsSearchService/LyricsSearchService.cs
index 58ad6c1..06377e8 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/LyricsSearchService/LyricsSearchService.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/LyricsSearchService/LyricsSearchService.cs
@@ -88,6 +88,11 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
}
public async Task<(string?, LyricsSearchProvider?)> SearchAsync(string mediaSessionId, string title, string artist, string album, double durationMs, CancellationToken token)
+ {
+ return await Task.Run(async () => await SearchAsyncCore(mediaSessionId, title, artist, album, durationMs, token), token);
+ }
+
+ private async Task<(string?, LyricsSearchProvider?)> SearchAsyncCore(string mediaSessionId, string title, string artist, string album, double durationMs, CancellationToken token)
{
_logger.LogInformation("Searching img for: {Title} - {Artist} (Album: {Album}, Duration: {DurationMs}ms)", title, artist, album, durationMs);
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.AlbumArtUpdater.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.AlbumArtUpdater.cs
index 5c3d45b..d4016c3 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.AlbumArtUpdater.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.AlbumArtUpdater.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using Windows.Storage.Streams;
@@ -21,46 +22,48 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
private void UpdateAlbumArt()
{
- _albumArtRefreshRunner.RunAsync(async (token) =>
+ _albumArtRefreshRunner.RunAsync(RefreshArtAlbum);
+ }
+
+ private async Task RefreshArtAlbum(CancellationToken token)
+ {
+ if (_cachedSongInfo == null)
{
- if (_cachedSongInfo == null)
- {
- _logger.LogWarning("Cached song info is null, cannot update album art.");
- return;
- }
+ _logger.LogWarning("Cached song info is null, cannot update album art.");
+ return;
+ }
- byte[]? bytes = await _albumArtSearchService.SearchAsync(
- SongInfo?.SourceAppUserModelId ?? "",
- _cachedSongInfo.Title,
- _cachedSongInfo.Artist,
- _cachedSongInfo?.Album ?? string.Empty,
- _SMTCAlbumArtBytes
- );
+ byte[]? bytes = await _albumArtSearchService.SearchAsync(
+ SongInfo?.SourceAppUserModelId ?? "",
+ _cachedSongInfo.Title,
+ _cachedSongInfo.Artist,
+ _cachedSongInfo?.Album ?? string.Empty,
+ _SMTCAlbumArtBytes
+ );
+ token.ThrowIfCancellationRequested();
+
+ if (bytes == null)
+ {
+ bytes = await ImageHelper.CreateTextPlaceholderBytesAsync(500, 500);
token.ThrowIfCancellationRequested();
+ }
- if (bytes == null)
- {
- bytes = await ImageHelper.CreateTextPlaceholderBytesAsync(500, 500);
- token.ThrowIfCancellationRequested();
- }
+ bytes = ImageHelper.MakeSquareWithThemeColor(bytes);
- bytes = ImageHelper.MakeSquareWithThemeColor(bytes);
+ using var stream = new InMemoryRandomAccessStream();
+ await stream.WriteAsync(bytes.AsBuffer());
+ token.ThrowIfCancellationRequested();
- using var stream = new InMemoryRandomAccessStream();
- await stream.WriteAsync(bytes.AsBuffer());
- token.ThrowIfCancellationRequested();
+ var decoder = await BitmapDecoder.CreateAsync(stream);
+ token.ThrowIfCancellationRequested();
- var decoder = await BitmapDecoder.CreateAsync(stream);
- token.ThrowIfCancellationRequested();
+ var albumArtSwBitmap = await decoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Rgba16, BitmapAlphaMode.Premultiplied);
+ token.ThrowIfCancellationRequested();
- var albumArtSwBitmap = await decoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Rgba16, BitmapAlphaMode.Premultiplied);
- token.ThrowIfCancellationRequested();
+ var albumArtLightAccentColor = ImageHelper.GetAccentColorsFromByte(bytes, 1, false).FirstOrDefault();
+ var albumArtDarkAccentColor = ImageHelper.GetAccentColorsFromByte(bytes, 1, true).FirstOrDefault();
- var albumArtLightAccentColor = ImageHelper.GetAccentColorsFromByte(bytes, 1, false).FirstOrDefault();
- var albumArtDarkAccentColor = ImageHelper.GetAccentColorsFromByte(bytes, 1, true).FirstOrDefault();
-
- AlbumArtChanged?.Invoke(this, new AlbumArtChangedEventArgs(null, albumArtSwBitmap, albumArtLightAccentColor, albumArtDarkAccentColor));
- });
+ AlbumArtChanged?.Invoke(this, new AlbumArtChangedEventArgs(null, albumArtSwBitmap, albumArtLightAccentColor, albumArtDarkAccentColor));
}
}
}
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.LyricsUpdater.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.LyricsUpdater.cs
index 0f22759..62756b9 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.LyricsUpdater.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.LyricsUpdater.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Vanara.PInvoke;
namespace BetterLyrics.WinUI3.Services.MediaSessionsService
{
@@ -220,10 +221,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
private void UpdateLyrics()
{
- _refreshLyricsRunner.RunAsync(async token =>
- {
- await RefreshLyricsAsync(token);
- });
+ _refreshLyricsRunner.RunAsync(RefreshLyricsAsync);
}
}
}
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.cs
index 68647bb..324ccea 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/MediaSessionsService/MediaSessionsService.cs
@@ -201,26 +201,29 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
private void MediaManager_OnAnyTimelinePropertyChanged(MediaManager.MediaSession mediaSession, GlobalSystemMediaTransportControlsSessionTimelineProperties timelineProperties)
{
- _dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
+ if (!_mediaManager.IsStarted) return;
+ if (mediaSession == null) return;
+
+ var focusedSession = _mediaManager.GetFocusedSession();
+
+ if (mediaSession != focusedSession) return;
+
+ if (!IsMediaSourceEnabled(mediaSession.Id))
{
- if (!_mediaManager.IsStarted) return;
- if (mediaSession == null) return;
-
- var focusedSession = _mediaManager.GetFocusedSession();
-
- if (mediaSession != focusedSession) return;
-
- if (!IsMediaSourceEnabled(mediaSession.Id))
+ _cachedPosition = TimeSpan.Zero;
+ _dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
{
- _cachedPosition = TimeSpan.Zero;
TimelineChanged?.Invoke(this, new TimelineChangedEventArgs(_cachedPosition, TimeSpan.Zero));
- }
- else
+ });
+ }
+ else
+ {
+ _cachedPosition = timelineProperties.Position;
+ _dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
{
- _cachedPosition = timelineProperties.Position;
TimelineChanged?.Invoke(this, new TimelineChangedEventArgs(_cachedPosition, timelineProperties.EndTime));
- }
- });
+ });
+ }
}
private void MediaManager_OnAnyPlaybackStateChanged(MediaManager.MediaSession mediaSession, GlobalSystemMediaTransportControlsSessionPlaybackInfo playbackInfo)
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw
index 66ab008..c708149 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw
@@ -150,9 +150,6 @@
Picture-in-picture mode
-
- Exit picture-in-picture mode
-
Cancel
@@ -478,6 +475,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
Activate standard mode
+
+ Start Picture-in-Picture Mode
+
When starting the app
@@ -934,17 +934,23 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
Scope
+
+ Tail line delay
+
- Lyrics scrolling animation duration (Last line)
+ Final line duration
- Lyrics scrolling animation duration (Current line)
+ Current line duration
Lyrics scrolling animation type
+
+ First line delay
+
- Lyrics scrolling animation duration (First line)
+ The duration of the first line
Test server
@@ -958,6 +964,12 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
Settings manager
+
+ This hotkey was not successfully registered
+
+
+ This hotkey has been successfully registered
+
Current value:
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw
index e8f1f69..c7f6775 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw
@@ -150,9 +150,6 @@
ピクチャーインピクチャーモード
-
- ピクチャーインピクチャーモードを終了します
-
キャンセル
@@ -478,6 +475,9 @@
標準モードをアクティブにします
+
+ ピクチャーインピクチャーモードを開始します
+
アプリを起動するとき
@@ -934,17 +934,23 @@
範囲
+
+ テールラインの遅延
+
- 歌詞スクロールアニメーション期間(最終行)
+ 最終ライン期間
- 歌詞スクロールアニメーション期間(現在の行)
+ 現在のライン期間
歌詞スクロールアニメーションタイプ
+
+ 最初の行の遅延
+
- 歌詞スクロールアニメーション期間(最初の行)
+ 最初の行の期間
テストサーバー
@@ -958,6 +964,12 @@
設定マネージャー
+
+ このホットキーは正常に登録されていません
+
+
+ このホットキーは正常に登録されています
+
現在の値:
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw
index 522142f..e4c7f66 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw
@@ -150,9 +150,6 @@
사진 인당 모드
-
- Picture-in-Picture 모드 종료
-
취소
@@ -478,6 +475,9 @@
표준 모드를 활성화합니다
+
+ Picture-in-Picture 모드를 시작하십시오
+
앱을 시작할 때
@@ -934,17 +934,23 @@
범위
+
+ 테일 라인 지연
+
- 가사 스크롤 애니메이션 지속 시간 (마지막 줄)
+ 최종 라인 기간
- 가사 스크롤 애니메이션 지속 시간 (현재 줄)
+ 현재 라인 기간
가사 스크롤링 애니메이션 유형
+
+ 첫 번째 줄 지연
+
- 가사 스크롤 애니메이션 지속 시간 (첫 번째 줄)
+ 첫 번째 줄의 기간
테스트 서버
@@ -958,6 +964,12 @@
설정 관리자
+
+ 이 핫키는 성공적으로 등록되지 않았습니다
+
+
+ 이 핫키는 성공적으로 등록되었습니다
+
현재 가치 :
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw
index fc1e48d..1705381 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw
@@ -150,9 +150,6 @@
画中画模式
-
- 退出画中画模式
-
取消
@@ -478,6 +475,9 @@
启动标准模式
+
+ 启动画中画模式
+
启动应用时
@@ -934,17 +934,23 @@
范围
+
+ 尾行延时
+
- 歌词滚动动画持续时间(最后一行)
+ 尾行持续时间
- 歌词滚动动画持续时间(当前行)
+ 当前行持续时间
歌词滚动动画类型
+
+ 首行延时
+
- 歌词滚动动画持续时间(第一行)
+ 首行持续时间
测试服务器
@@ -958,6 +964,12 @@
设置管理器
+
+ 该热键未成功注册
+
+
+ 该热键已成功注册
+
当前值:
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw
index dc832a6..7cf6e59 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw
@@ -150,9 +150,6 @@
畫中畫模式
-
- 退出畫中畫模式
-
取消
@@ -478,6 +475,9 @@
啟動標準模式
+
+ 啟動畫中畫模式
+
啟動應用程式時
@@ -934,17 +934,23 @@
範圍
+
+ 尾行延時
+
- 歌詞滾動動畫持續時間(最後一行)
+ 尾行持續時間
- 歌詞滾動動畫持續時間(當前行)
+ 當前行持續時間
歌詞滾動動畫類型
+
+ 首行延時
+
- 歌詞滾動動畫持續時間(第一行)
+ 首行持續時間
測試服務器
@@ -958,6 +964,12 @@
設置管理器
+
+ 該熱鍵未成功註冊
+
+
+ 該熱鍵已成功註冊
+
目前值:
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs
index 62fde97..7d26a6c 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Messages.cs
@@ -167,6 +167,14 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
{
_isLayoutChanged = true;
}
+ else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollTopDelay))
+ {
+ _isLayoutChanged = true;
+ }
+ else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollBottomDelay))
+ {
+ _isLayoutChanged = true;
+ }
}
else if (message.Sender is LyricsStyleSettings)
{
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs
index 7fe9de8..cf41bd0 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel/LyricsRendererViewModel.Update.cs
@@ -589,25 +589,31 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
line.HighlightOpacityTransition.StartTransition(i == _playingLineIndex ? 1f : 0f);
double yScrollDuration;
+ double yScrollDelay;
+
if (lineCountDelta < 0)
{
yScrollDuration =
_canvasYScrollTransition.DurationSeconds +
distanceFactor * (_liveStatesService.LiveStates.CurrentLyricsEffectSettings.LyricsScrollTopDuration / 1000.0 - _canvasYScrollTransition.DurationSeconds);
+ yScrollDelay = distanceFactor * _liveStatesService.LiveStates.CurrentLyricsEffectSettings.LyricsScrollTopDelay / 1000.0;
}
else if (lineCountDelta == 0)
{
yScrollDuration = _canvasYScrollTransition.DurationSeconds;
+ yScrollDelay = 0;
}
else
{
yScrollDuration =
_canvasYScrollTransition.DurationSeconds +
distanceFactor * (_liveStatesService.LiveStates.CurrentLyricsEffectSettings.LyricsScrollBottomDuration / 1000.0 - _canvasYScrollTransition.DurationSeconds);
+ yScrollDelay = distanceFactor * _liveStatesService.LiveStates.CurrentLyricsEffectSettings.LyricsScrollBottomDelay / 1000.0;
}
line.YOffsetTransition.SetEasingType(_canvasYScrollTransition.EasingType ?? EasingType.Linear);
line.YOffsetTransition.SetDuration(yScrollDuration);
+ line.YOffsetTransition.SetDelay(yScrollDelay);
line.YOffsetTransition.StartTransition(_canvasTargetYScrollOffset, _isLayoutChanged);
}
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsWindowViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsWindowViewModel.cs
index 22ef87c..9a2e073 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsWindowViewModel.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsWindowViewModel.cs
@@ -218,8 +218,7 @@ namespace BetterLyrics.WinUI3
private void UpdateDesktopLockShortcut()
{
- GlobalHotKeyHelper.UnregisterHotKey(ShortcutID.DesktopLock);
- GlobalHotKeyHelper.RegisterHotKey(ShortcutID.DesktopLock,
+ GlobalHotKeyHelper.UpdateHotKey(ShortcutID.DesktopLock,
_settingsService.AppSettings.DesktopModeSettings.LockShortcut,
() =>
{
@@ -233,8 +232,7 @@ namespace BetterLyrics.WinUI3
private void UpdateDesktopToggleShortcut()
{
- GlobalHotKeyHelper.UnregisterHotKey(ShortcutID.DesktopToggle);
- GlobalHotKeyHelper.RegisterHotKey(ShortcutID.DesktopToggle,
+ GlobalHotKeyHelper.UpdateHotKey(ShortcutID.DesktopToggle,
_settingsService.AppSettings.DesktopModeSettings.ToggleShortcut,
() =>
{
@@ -249,8 +247,7 @@ namespace BetterLyrics.WinUI3
private void UpdateDockToggleShortcut()
{
- GlobalHotKeyHelper.UnregisterHotKey(ShortcutID.DockToggle);
- GlobalHotKeyHelper.RegisterHotKey(ShortcutID.DockToggle,
+ GlobalHotKeyHelper.UpdateHotKey(ShortcutID.DockToggle,
_settingsService.AppSettings.DockModeSettings.ToggleShortcut,
() =>
{
@@ -265,8 +262,7 @@ namespace BetterLyrics.WinUI3
private void UpdatePictureInPictureToggleShortcut()
{
- GlobalHotKeyHelper.UnregisterHotKey(ShortcutID.PictureInPictureToggle);
- GlobalHotKeyHelper.RegisterHotKey(ShortcutID.PictureInPictureToggle,
+ GlobalHotKeyHelper.UpdateHotKey(ShortcutID.PictureInPictureToggle,
_settingsService.AppSettings.PictureInPictureModeSettings.ToggleShortcut,
() =>
{
@@ -463,6 +459,7 @@ namespace BetterLyrics.WinUI3
if (LiveStates.CurrentLyricsWindowMode == LyricsWindowMode.PictureInPictureMode)
{
window.AppWindow.SetPresenter(AppWindowPresenterKind.CompactOverlay);
+ window.AppWindow.Move(AppSettings.PictureInPictureModeSettings.WindowPosition.ToPointInt32());
SetPIPModeTitleBarControlsStatus();
}
else
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs
index 906918f..63a95c8 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs
@@ -20,6 +20,7 @@ namespace BetterLyrics.WinUI3.Views
{
private readonly ISettingsService _settingsService = Ioc.Default.GetRequiredService();
private readonly WindowMessageMonitor _wmm;
+ private bool _autoSelectLyricsModeOnRunning = true;
public LyricsWindow()
{
@@ -75,8 +76,17 @@ namespace BetterLyrics.WinUI3.Views
switch (type!)
{
case LyricsWindowMode.StandardMode:
- AppWindow.MoveAndResize(_settingsService.AppSettings.StandardModeSettings.WindowBounds.ToRectInt32());
ViewModel.SetStandardModeTitleBarControlsStatus();
+ if (_settingsService.AppSettings.StandardModeSettings.IsMaximized)
+ {
+ // ʱôڴСԱ˳
+ // ܶĻԵӰ
+ this.Maximize();
+ }
+ else
+ {
+ AppWindow.MoveAndResize(_settingsService.AppSettings.StandardModeSettings.WindowBounds.ToRectInt32());
+ }
break;
case LyricsWindowMode.DockMode:
ViewModel.ToggleDockMode();
@@ -84,9 +94,13 @@ namespace BetterLyrics.WinUI3.Views
case LyricsWindowMode.DesktopMode:
ViewModel.ToggleDesktopMode();
break;
+ case LyricsWindowMode.PictureInPictureMode:
+ ViewModel.TogglePictureInPictureMode();
+ break;
default:
break;
}
+ _autoSelectLyricsModeOnRunning = false;
}
private void AOTFlyoutItem_Click(object sender, RoutedEventArgs e)
@@ -96,6 +110,8 @@ namespace BetterLyrics.WinUI3.Views
private void AppWindow_Changed(AppWindow sender, AppWindowChangedEventArgs args)
{
+ if (_autoSelectLyricsModeOnRunning) return;
+
if (args.DidPositionChange || args.DidSizeChange)
{
var size = AppWindow.Size;
@@ -107,14 +123,28 @@ namespace BetterLyrics.WinUI3.Views
}
else
{
- if (ViewModel.LiveStates.CurrentLyricsWindowMode == LyricsWindowMode.DesktopMode)
+ switch (ViewModel.LiveStates.CurrentLyricsWindowMode)
{
- _settingsService.AppSettings.DesktopModeSettings.WindowBounds = new Windows.Foundation.Rect(rect.X, rect.Y, size.Width, size.Height);
- }
- else if (ViewModel.LiveStates.CurrentLyricsWindowMode == LyricsWindowMode.DockMode) { }
- else
- {
- _settingsService.AppSettings.StandardModeSettings.WindowBounds = new Windows.Foundation.Rect(rect.X, rect.Y, size.Width, size.Height);
+ case LyricsWindowMode.StandardMode:
+ if (AppWindow.Presenter is OverlappedPresenter overlappedPresenter)
+ {
+ _settingsService.AppSettings.StandardModeSettings.WindowBounds = new Windows.Foundation.Rect(rect.X, rect.Y, size.Width, size.Height);
+ _settingsService.AppSettings.StandardModeSettings.IsMaximized = overlappedPresenter.State == OverlappedPresenterState.Maximized;
+ }
+ break;
+ case LyricsWindowMode.DockMode:
+ break;
+ case LyricsWindowMode.DesktopMode:
+ _settingsService.AppSettings.DesktopModeSettings.WindowBounds = new Windows.Foundation.Rect(rect.X, rect.Y, size.Width, size.Height);
+ break;
+ case LyricsWindowMode.PictureInPictureMode:
+ if (AppWindow.Presenter is CompactOverlayPresenter compactOverlayPresenter)
+ {
+ _settingsService.AppSettings.PictureInPictureModeSettings.WindowPosition = new Windows.Foundation.Point(rect.X, rect.Y);
+ }
+ break;
+ default:
+ break;
}
}
}
diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml
index 91a7d9f..ced2fbc 100644
--- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml
+++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml
@@ -89,7 +89,7 @@
-
+