コード例 #1
0
        /// <summary>
        /// Add a list of Albums to a specified playlist
        /// </summary>
        /// <param name="albumsToAdd"></param>
        /// <param name="playlist"></param>
        public static void AddAlbumsToPlaylist(IEnumerable <Album> albumsToAdd, AlbumPlaylist playlist)
        {
            playlist.AddAlbums(albumsToAdd);

            // Report the change
            DataReporter?.PlaylistUpdated(playlist);
        }
コード例 #2
0
        /// <summary>
        /// Add a list of Songs to a specified playlist
        /// </summary>
        /// <param name="songsToAdd"></param>
        /// <param name="playlist"></param>
        public static void AddSongsToPlaylist(IEnumerable <Song> songsToAdd, SongPlaylist playlist)
        {
            playlist.AddSongs(songsToAdd);

            // Report the change
            DataReporter?.PlaylistUpdated(playlist);
        }
コード例 #3
0
        /// <summary>
        /// Delete the specified SongPlaylistItem items from its parent playlist
        /// </summary>
        /// <param name="thePlaylist"></param>
        /// <param name="items"></param>
        public static void DeletePlaylistItems(Playlist thePlaylist, IEnumerable <PlaylistItem> items)
        {
            // Delete the items from the playlist
            thePlaylist.DeletePlaylistItems(items);

            // Adjust the track numbers
            thePlaylist.AdjustTrackNumbers();

            // Report the change
            DataReporter?.PlaylistUpdated(thePlaylist);
        }
コード例 #4
0
        /// <summary>
        /// Move the selected items up or down the list
        /// </summary>
        /// <param name="items"></param>
        /// <param name="moveUp"></param>
        private static void MoveItems(IEnumerable <PlaylistItem> items, bool moveUp)
        {
            // Record the currently selected song so its track number can be checked after the move
            PlaylistItem currentPlaylistItem = (NowPlayingViewModel.CurrentSongIndex == -1) ? null
                                : NowPlayingViewModel.NowPlayingPlaylist.PlaylistItems[NowPlayingViewModel.CurrentSongIndex];

            if (moveUp == true)
            {
                NowPlayingViewModel.NowPlayingPlaylist.MoveItemsUp(items);
            }
            else
            {
                NowPlayingViewModel.NowPlayingPlaylist.MoveItemsDown(items);
            }

            // Now adjust the index of the selected song
            AdjustSelectedSongIndex(currentPlaylistItem);

            // Report that the playlist has been updated - don't use NowPlayingDataAvailable as that will clear the selections
            DataReporter?.PlaylistUpdated();
        }
コード例 #5
0
 /// <summary>
 /// Called when a PlaylistUpdatedMessage has been received. Pass it on to the reporter
 /// </summary>
 /// <param name="message"></param>
 private static void PlaylistUpdated(Playlist updatedPlaylist) => DataReporter?.PlaylistUpdated(updatedPlaylist);
コード例 #6
0
        /// <summary>
        /// Move a set of selected items up the specified playlist and update the track numbers
        /// </summary>
        /// <param name="thePlaylist"></param>
        /// <param name="items"></param>
        public static void MoveItemsUp(Playlist thePlaylist, IEnumerable <PlaylistItem> items)
        {
            thePlaylist.MoveItemsUp(items);

            DataReporter?.PlaylistUpdated(thePlaylist);
        }