diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs index 4dbc09e..1b4d7fb 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs @@ -118,6 +118,7 @@ namespace BetterLyrics.WinUI3 .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() .AddSingleton() .AddSingleton() .AddSingleton() diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml index 0a76850..94b8659 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/LyricsWindowSwitchControl.xaml @@ -16,13 +16,19 @@ VerticalAlignment="Center" Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}" CornerRadius="12"> + + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs index e586771..01d705c 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindow.xaml.cs @@ -27,6 +27,8 @@ namespace BetterLyrics.WinUI3.Views private readonly ILiveStatesService _liveStatesService = Ioc.Default.GetRequiredService(); private readonly WindowMessageMonitor _wmm; + public LyricsWindowViewModel ViewModel { get; private set; } = Ioc.Default.GetRequiredService(); + public LyricsWindow() { this.InitializeComponent(); @@ -79,8 +81,6 @@ namespace BetterLyrics.WinUI3.Views } } - public LyricsWindowViewModel ViewModel { get; private set; } = Ioc.Default.GetRequiredService(); - private void AppWindow_Changed(AppWindow sender, AppWindowChangedEventArgs args) { if (args.DidPositionChange || args.DidSizeChange) @@ -127,5 +127,10 @@ namespace BetterLyrics.WinUI3.Views { ViewModel.ExitOrClose(); } + + private void LyricsWindowSwitchButton_Click(object sender, RoutedEventArgs e) + { + WindowHelper.OpenOrShowWindow(); + } } } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindowSwitchWindow.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindowSwitchWindow.xaml index 632c73b..97fac7b 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindowSwitchWindow.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/LyricsWindowSwitchWindow.xaml @@ -10,7 +10,10 @@ Title="LyricsWindowSwitchWindow" mc:Ignorable="d"> - + + + + public sealed partial class LyricsWindowSwitchWindow : Window { + public LyricsWindowSwitchWindowViewModel ViewModel { get; private set; } = Ioc.Default.GetRequiredService(); + public LyricsWindowSwitchWindow() { InitializeComponent(); @@ -37,6 +41,19 @@ namespace BetterLyrics.WinUI3.Views AppWindow.IsShownInSwitchers = false; this.SetIsAlwaysOnTop(true); SetTitleBar(PlaceholderGrid); + + AppWindow.Changed += AppWindow_Changed; + } + + private void AppWindow_Changed(Microsoft.UI.Windowing.AppWindow sender, Microsoft.UI.Windowing.AppWindowChangedEventArgs args) + { + if (args.DidVisibilityChange) + { + if (sender.IsVisible) + { + ViewModel.RootGridOpacity = 1; + } + } } } }