Ejemplo n.º 1
0
 /// <summary>
 /// Attach Albums Commands
 /// </summary>
 /// <param name="client">Spotify Sdk Client</param>
 /// <param name="responses">Album Responses</param>
 public static void AttachListAlbumsCommands(
     this ISpotifySdkClient client,
     NavigationResponse <AlbumResponse> responses)
 {
     if (client.Config.IsAttachListAlbumsCommands && responses?.Items != null)
     {
         responses.Items.ForEach(item => client.AttachGetAlbumCommands(item, client.Config.IsAttachListAlbumsCommands));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Attach Get Track Commands
        /// </summary>
        /// <param name="client">Spotify Sdk Client</param>
        /// <param name="response">Track Response</param>
        /// <param name="overrideIsAttach">Override Is Attach?</param>
        public static void AttachGetTrackCommands(
            this ISpotifySdkClient client,
            TrackResponse response,
            bool?overrideIsAttach = null)
        {
            var isAttach = GetConfig(client.Config.IsAttachGetTrackCommands, overrideIsAttach);

            if (isAttach && response != null)
            {
                // Track Command
                if (client.CommandActions.Track != null)
                {
                    response.Command = new GenericCommand <TrackResponse>(
                        client.CommandActions.Track);
                }
                // Add User Playback Command
                response.AddUserPlaybackCommand = new GenericCommand <IPlaybackResponse>(
                    client.AddUserPlaybackHandler);
                // Add User Playback Queue Command
                response.AddUserPlaybackQueueCommand = new GenericCommand <IPlayItemResponse>(
                    client.AddUserPlaybackQueueHandler);
                // Add Playlist Item Command
                if (client.CommandActions.AddPlaylistItem != null)
                {
                    response.AddPlaylistItemCommand = new GenericCommand <IPlayItemResponse>(
                        client.CommandActions.AddPlaylistItem);
                }
                // Album Commands
                if (response?.Album != null)
                {
                    client.AttachGetAlbumCommands(response.Album, isAttach);
                }
                // Artist Commands
                if (response?.Artists != null)
                {
                    response.Artists.ForEach(item => client.AttachGetArtistCommands(item, isAttach));
                }
                if (response?.Artist != null)
                {
                    client.AttachGetArtistCommands(response?.Artist, isAttach);
                }
            }
        }