public void LoadPlaylist(Playlist playlist) { EventAggregator.Publish(new StopMessage()); PlaylistManagementService.Clear(); GoBack(); var playlistItemCollection = new PlaylistItemCollection(); playlistItemCollection.AddRange(playlist.Entries.Select(e => e.AsPlaylistItem(SubsonicService))); PlaylistManagementService.LoadPlaylist(playlistItemCollection); }
private async Task UpdatePlaylist(Playlist playlist) { var songIds = GetSongIdsForActivePlaylist().ToList(); var songIdsInPlaylist = playlist.Entries.Select(entry => entry.Id).ToList(); var songIdsToAdd = songIds.Where(songId => !songIdsInPlaylist.Contains(songId)); var songIndexesToRemove = songIdsInPlaylist.Where(songId => !songIds.Contains(songId)) .Select(songId => songIdsInPlaylist.IndexOf(songId)); await SubsonicService.UpdatePlaylist(playlist.Id, songIdsToAdd, songIndexesToRemove) .WithErrorHandler(ErrorHandler) .OnSuccess(OnSaveFinished) .Execute(); }