Fixed PlaylistDetailViewModels's "Playlist" object not properly synchronizing (events, locking) to the playlist manager's current playlist at constructor time.
This commit is contained in:
@@ -47,7 +47,16 @@ public partial class PlaylistDetailViewModel : ViewModelBase
|
||||
public Playlist? Playlist
|
||||
{
|
||||
get => _playlist;
|
||||
private set => SetProperty(ref _playlist, value);
|
||||
private set
|
||||
{
|
||||
_playlist?.PlaylistUpdated -= OnPlaylistUpdated;
|
||||
_playlist = _playlistManager.CurrentPlaylist;
|
||||
_playlist?.PlaylistUpdated += OnPlaylistUpdated;
|
||||
|
||||
IsPlaylistLocked = Playlist?.IsLocked ?? false;
|
||||
|
||||
SetProperty(ref _playlist, value);
|
||||
}
|
||||
}
|
||||
|
||||
private PlaylistSong? _playingSong;
|
||||
@@ -273,14 +282,9 @@ public partial class PlaylistDetailViewModel : ViewModelBase
|
||||
Playlist.MoveSong(oldIndex, newIndex);
|
||||
}
|
||||
|
||||
private void OnPlaylistChanged(object? sender, EventArgs e)
|
||||
private void OnPlaylistChanged(object? sender, PlaylistChangedEventArgs e)
|
||||
{
|
||||
Playlist?.PlaylistUpdated -= OnPlaylistUpdated;
|
||||
Playlist = _playlistManager.CurrentPlaylist;
|
||||
Playlist?.PlaylistUpdated += OnPlaylistUpdated;
|
||||
|
||||
IsPlaylistLocked = Playlist?.IsLocked ?? false;
|
||||
|
||||
Playlist = e.NewPlaylist;
|
||||
UpdateFilteredSongs();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user