diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest index 30514b4..a6327c8 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest @@ -12,7 +12,7 @@ + Version="1.0.21.0" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs index c545c08..ab84ce7 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs @@ -16,6 +16,7 @@ using ShadowViewer.Controls; using System; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace BetterLyrics.WinUI3 diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/DesktopModeHelper.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/DesktopModeHelper.cs index ee3ecdc..65a8334 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/DesktopModeHelper.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/DesktopModeHelper.cs @@ -73,6 +73,14 @@ namespace BetterLyrics.WinUI3.Helper int targetX = _settingsService.DesktopWindowLeft; int targetY = _settingsService.DesktopWindowTop; + if (targetWidth <= 0 || targetHeight <= 0 || targetX < 0 || targetY < 0) + { + targetWidth = 1200; + targetHeight = 600; + targetX = 200; + targetY = 200; + } + // 设置窗口大小和位置 window.AppWindow.MoveAndResize( new Windows.Graphics.RectInt32(targetX, targetY, targetWidth, targetHeight) diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/WindowHelper.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/WindowHelper.cs index 27d8c94..bc17bb6 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/WindowHelper.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Helper/WindowHelper.cs @@ -26,15 +26,6 @@ namespace BetterLyrics.WinUI3.Helper } } - public static void ExitAllWindows() - { - while (_activeWindows.Count > 0) - { - var window = (Window)_activeWindows[0]; - window.Close(); - } - } - public static T? GetWindowByWindowType() { foreach (var window in _activeWindows) diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsPageViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsPageViewModel.cs index 25c1055..f765226 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsPageViewModel.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsPageViewModel.cs @@ -49,10 +49,10 @@ namespace BetterLyrics.WinUI3.ViewModels IsSongPlaying = _playbackService.IsPlaying; } - private void SystemVolumeHelper_VolumeChanged(int volume) - { - Volume = volume; - } + //private void SystemVolumeHelper_VolumeChanged(int volume) + //{ + // Volume = volume; + //} private void PlaybackService_IsPlayingChanged(object? sender, Events.IsPlayingChangedEventArgs e) { @@ -245,10 +245,10 @@ namespace BetterLyrics.WinUI3.ViewModels } } - partial void OnVolumeChanged(int value) - { - SystemVolumeHelper.SetMasterVolume(value); - } + //partial void OnVolumeChanged(int value) + //{ + // SystemVolumeHelper.SetMasterVolume(value); + //} public void Receive(PropertyChangedMessage message) { diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SystemTrayViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SystemTrayViewModel.cs index 86a3c6d..a433bd6 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SystemTrayViewModel.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SystemTrayViewModel.cs @@ -34,7 +34,12 @@ namespace BetterLyrics.WinUI3.ViewModels [RelayCommand] private static void ExitApp() { - WindowHelper.ExitAllWindows(); + LyricsWindow? lyricsWindow = WindowHelper.GetWindowByWindowType(); + if (lyricsWindow != null) + { + DockModeHelper.Disable(lyricsWindow); + } + App.Current.Exit(); } [RelayCommand] diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml index 82839c0..b847035 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsPage.xaml @@ -193,13 +193,12 @@ Spacing="3"> -