Example #1
0
        /// <summary>
        /// Called to handle the command.
        /// </summary>
        /// <param name="commandIdentity"></param>
        public override void HandleCommand(int commandIdentity)
        {
            List <string> selectedGenres = new List <string>();

            // If an Artist has been selected then the starting point for generation will be the albums associated with the Artist.
            // If an Album has been selected then that album will be the starting point.
            // If a Song has been selected then that song will be the starting point.
            if (selectedObjects.Artists.Count > 0)
            {
                // Get all the genres associated with all the selected artists
                foreach (Artist selectedArtist in selectedObjects.Artists)
                {
                    foreach (ArtistAlbum artistAlbum in selectedArtist.ArtistAlbums)
                    {
                        selectedGenres.AddRange(artistAlbum.Album.Genre.Split(';').ToList());
                    }
                }
            }
            else if (selectedObjects.ArtistAlbums.Count > 0)
            {
                // Get all the genres associated with the albums from all the selected artistalbums
                foreach (ArtistAlbum selectedArtistAlbum in selectedObjects.ArtistAlbums)
                {
                    selectedGenres.AddRange(selectedArtistAlbum.Album.Genre.Split(';').ToList());
                }
            }
            else if (selectedObjects.Albums.Count > 0)
            {
                // Get all the genres associated with the albums from all the selected albums
                foreach (Album selectedAlbum in selectedObjects.Albums)
                {
                    selectedGenres.AddRange(selectedAlbum.Genre.Split(';').ToList());
                }
            }
            else if (selectedObjects.Songs.Count > 0)
            {
                foreach (Song selectedSong in selectedObjects.Songs)
                {
                    selectedGenres.AddRange(ArtistAlbums.GetArtistAlbumById(selectedSong.ArtistAlbumId).Album.Genre.Split(';').ToList());
                }
            }

            // Make genre list unique
            selectedGenres = selectedGenres.Distinct().ToList();

            AutoplayController.StartAutoplay(selectedObjects.Songs, selectedGenres, commandIdentity == Resource.Id.auto_play);

            commandCallback.PerformAction();
        }
Example #2
0
 /// <summary>
 /// Configure all the controllers
 /// </summary>
 private void ConfigureControllers()
 {
     AlbumsController.GetControllerData();
     ArtistsController.GetControllerData();
     PlaylistsController.GetControllerData();
     LibraryNameDisplayController.GetControllerData();
     FilterManagementController.GetControllerData();
     PlaybackSelectionController.GetControllerData();
     AutoplayController.GetControllerData();
     PlaybackModeController.GetControllerData();
     PlaybackManagementController.GetControllerData();
     MediaControllerController.GetControllerData();
     MediaNotificationController.GetControllerData();
     NowPlayingController.GetControllerData();
 }