Example #1
0
 /// <summary>
 /// Called to handle the command.
 /// Determine the subject of this, either the Now Playing playlist or a user playlist
 /// </summary>
 /// <param name="_"></param>
 public override void HandleCommand(int _)
 {
     // If this is a Now Playing command then the parent of the first selected song will have the NowPlayingPlaylistName
     if ((selectedObjects.ParentPlaylist != null) && (selectedObjects.ParentPlaylist.Name == Playlists.NowPlayingPlaylistName))
     {
         // Process this Now Playing command
         NowPlayingController.DeleteNowPlayingItems(selectedObjects.PlaylistItems);
         commandCallback.PerformAction();
     }
     else
     {
         if (selectedObjects.PlaylistItems.Count > 0)
         {
             if (selectedObjects.Playlists.Count == 1)
             {
                 // Deletion of songs and playlist - confirm first
                 ConfirmationDialogFragment.ShowFragment(CommandRouter.Manager, PlaylistDeleteSelected, "Do you want to delete the Playlist?");
             }
             else
             {
                 // Deletion of items from a playlist
                 PlaylistsController.DeletePlaylistItems(selectedObjects.ParentPlaylist, selectedObjects.PlaylistItems);
                 commandCallback.PerformAction();
             }
         }
         else if (selectedObjects.Playlists.Count == 1)
         {
             // Deletion of a playlist with no songs
             PlaylistsController.DeletePlaylist(selectedObjects.Playlists[0]);
             commandCallback.PerformAction();
         }
     }
 }
Example #2
0
        /// <summary>
        /// Called when the user has decided whether to delete the entire playlist or just the items in it
        /// </summary>
        /// <param name="deletePlaylist"></param>
        private void PlaylistDeleteSelected(bool deletePlaylist)
        {
            if (deletePlaylist == true)
            {
                PlaylistsController.DeletePlaylist(selectedObjects.Playlists[0]);
            }
            else
            {
                PlaylistsController.DeletePlaylistItems(selectedObjects.Playlists[0], selectedObjects.PlaylistItems);
            }

            commandCallback.PerformAction();
        }