Skip to content

Commit 537584e

Browse files
committed
更新版本并优化窗口管理功能
在 `Package.appxmanifest` 中将版本号更新为 `1.0.32.0`。 在 `App.xaml.cs` 中优化 `OnLaunched` 方法,增加对 `lyricsWindow` 的空值检查。 在 `SystemTray.xaml` 中添加双击和左击命令以打开歌词窗口。 在 `SystemTrayViewModel.cs` 中新增 `OpenLyricsWindow` 方法,支持通过命令机制打开歌词窗口。
1 parent e06a50d commit 537584e

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Identity
1313
Name="37412.BetterLyrics"
1414
Publisher="CN=E1428B0E-DC1D-4EA4-ACB1-4556569D5BA9"
15-
Version="1.0.31.0" />
15+
Version="1.0.32.0" />
1616

1717
<mp:PhoneIdentity PhoneProductId="ca4a4830-fc19-40d9-b823-53e2bff3d816" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
1818

BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ private void EnsureSingleInstance()
7676
protected override void OnLaunched(LaunchActivatedEventArgs args)
7777
{
7878
WindowHelper.OpenWindow<LyricsWindow>();
79-
var lyricsWindow = WindowHelper.GetWindowByWindowType<LyricsWindow>();
80-
if (lyricsWindow == null) return;
8179

82-
lyricsWindow.ViewModel.InitLockHotKey();
83-
lyricsWindow.AutoSelectLyricsMode();
80+
var lyricsWindow = WindowHelper.GetWindowByWindowType<LyricsWindow>();
81+
if (lyricsWindow != null)
82+
{
83+
lyricsWindow.ViewModel.InitLockHotKey();
84+
lyricsWindow.AutoSelectLyricsMode();
85+
}
8486
}
8587

8688
private static void ConfigureServices()

BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/SystemTray.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
x:Name="TrayIcon"
1515
x:FieldModifier="public"
1616
ContextMenuMode="SecondWindow"
17+
DoubleClickCommand="{x:Bind ViewModel.OpenLyricsWindowCommand}"
1718
IconSource="ms-appx:///Assets/Logo.ico"
19+
LeftClickCommand="{x:Bind ViewModel.OpenLyricsWindowCommand}"
1820
NoLeftClickDelay="True"
1921
ToolTipText="{x:Bind ViewModel.ToolTipText, Mode=OneWay}">
2022
<tb:TaskbarIcon.ContextFlyout>

BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SystemTrayViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ private static void OpenMusicGallery()
5656
WindowHelper.OpenWindow<MusicGalleryWindow>();
5757
}
5858

59+
[RelayCommand]
60+
private static void OpenLyricsWindow()
61+
{
62+
WindowHelper.OpenWindow<LyricsWindow>();
63+
}
64+
5965
[RelayCommand]
6066
private void UnlockWindow()
6167
{

0 commit comments

Comments
 (0)