This commit is contained in:
Zhe Fang
2025-07-26 07:51:27 -04:00
parent 79e6995384
commit 8b38aa1e33
5 changed files with 38 additions and 11 deletions

View File

@@ -50,10 +50,10 @@ namespace BetterLyrics.WinUI3
_logger = Ioc.Default.GetRequiredService<ILogger<App>>();
UnhandledException += App_UnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
//UnhandledException += App_UnhandledException;
//AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
//AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
//TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
}
protected override void OnLaunched(LaunchActivatedEventArgs args)

View File

@@ -50,10 +50,10 @@ namespace BetterLyrics.WinUI3
_dockWindowHeight = _settingsService.DockWindowHeight;
OnIsImmersiveModeChanged(_settingsService.IsImmersiveMode);
_playbackService.SongInfoChanged += PlaybackService_SongInfoChanged;
_playbackService.IsPlayingChanged += PlaybackService_IsPlayingChanged;
}
private void PlaybackService_SongInfoChanged(object? sender, Events.SongInfoChangedEventArgs e)
private void PlaybackService_IsPlayingChanged(object? sender, Events.IsPlayingChangedEventArgs e)
{
AutoHideOrShowWindow();
}
@@ -103,7 +103,7 @@ namespace BetterLyrics.WinUI3
if (IsDockMode || IsDesktopMode)
{
if (_hideWindowWhenNotPlaying && _playbackService.SongInfo == null)
if (_hideWindowWhenNotPlaying && !_playbackService.IsPlaying)
{
if (IsDockMode)
{

View File

@@ -259,10 +259,10 @@ namespace BetterLyrics.WinUI3.ViewModels
private void PlayTrack(Track? track)
{
_timelineController.Pause();
_mediaPlayer.Source = null;
if (track == null)
{
_timelineController.Pause();
_mediaPlayer.Source = null;
_smtc.IsEnabled = false;
}
else
@@ -279,6 +279,10 @@ namespace BetterLyrics.WinUI3.ViewModels
{
updater.Thumbnail = ImageHelper.ByteArrayToRandomAccessStreamReference(pictureData);
}
else
{
updater.Thumbnail = null;
}
updater.Update();
}
}

View File

@@ -327,7 +327,24 @@
</StackPanel>
</Grid>
<SemanticZoom Margin="0,48,0,0">
<StackPanel
Margin="12,58,12,0"
VerticalAlignment="Top"
Orientation="Horizontal"
Spacing="12">
<Button>
<Button.Content>
<StackPanel Orientation="Horizontal">
<TextBlock Text="添加到播放列表" />
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="{x:Bind TracksByTitleCVS.View.Count, Mode=OneWay}" />
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text=" 项" />
</StackPanel>
</Button.Content>
</Button>
<Button Content="多选" />
</StackPanel>
<SemanticZoom Margin="0,96,0,0">
<SemanticZoom.ZoomedInView>
<ListView
x:Name="SongListView"
@@ -431,7 +448,7 @@
Style="{StaticResource GhostButtonStyle}">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="MusicGalleryPageRemoveFromPlayingQueue" Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xE738;}" />
<MenuFlyoutItem Click="RemoveFromPlayingQueueMenuFlyoutItem_Click" x:Uid="MusicGalleryPageRemoveFromPlayingQueue" Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xE738;}" />
</MenuFlyout>
</Button.Flyout>
</Button>

View File

@@ -72,5 +72,11 @@ namespace BetterLyrics.WinUI3.Views
if (ViewModel.PlayingTrack == null) return;
PlayingQueueListView.ScrollIntoView(ViewModel.PlayingTrack, ScrollIntoViewAlignment.Leading);
}
private void RemoveFromPlayingQueueMenuFlyoutItem_Click(object sender, RoutedEventArgs e)
{
var track = (Track)((FrameworkElement)sender).DataContext;
ViewModel.TrackPlayingQueue.Remove(track);
}
}
}