Ejemplo n.º 1
0
        /// <summary>
        /// Attach Get User Currently Playing Commands
        /// </summary>
        /// <param name="client">Spotify Sdk Client</param>
        /// <param name="response">Currently Playing Response</param>
        public static void AttachGetUserCurrentlyPlayingCommands(
            this ISpotifySdkClient client,
            CurrentlyPlayingResponse response)
        {
            var isAttach = client.Config.IsAttachGetUserCurrentlyPlayingCommands;

            if (isAttach && response != null)
            {
                // Attach User Currently Playing Item Commands
                client.AttachUserCurrentlyPlayingItemCommands(response, isAttach);
                // Attach Device Commands
                client.AttachGetDeviceCommands(response.Device, isAttach);
                // Toggle Shuffle For User’s Playback
                response.UserPlaybackShuffleCommand = new GenericCommand <CurrentlyPlayingResponse>(
                    client.UserPlaybackShuffleHandler);
                // Set Repeat Mode On User’s Playback
                response.UserPlaybackRepeatCommand = new GenericCommand <CurrentlyPlayingResponse>(
                    client.UserPlaybackRepeatHandler);
                // Set Repeat Off For User’s Playback
                response.UserPlaybackRepeatOffCommand = new GenericCommand <CurrentlyPlayingResponse>(
                    client.UserPlaybackRepeatOffHandler);
                // Set Repeat Track For User’s Playback
                response.UserPlaybackRepeatTrackCommand = new GenericCommand <CurrentlyPlayingResponse>(
                    client.UserPlaybackRepeatTrackHandler);
                // Set Repeat Context For User’s Playback
                response.UserPlaybackRepeatContextCommand = new GenericCommand <CurrentlyPlayingResponse>(
                    client.UserPlaybackRepeatContextHandler);
                // Set Seek For User's Playback
                response.UserPlaybackSeekCommand = new GenericCommand <int>(
                    client.UserPlaybackSeekHandler);
                // Set Volume For User's Playback
                response.UserPlaybackVolumeCommand = new GenericCommand <int>(
                    client.UserPlaybackVolumeHandler);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Attach List Devices Commands
 /// </summary>
 /// <param name="client">Spotify Sdk Client</param>
 /// <param name="responses">Navigation Response of Device Response</param>
 public static void AttachListDevicesCommands(
     this ISpotifySdkClient client,
     NavigationResponse <DeviceResponse> responses)
 {
     if (client.Config.IsAttachListDevicesCommands && responses?.Items != null)
     {
         responses.Items.ForEach(item => client.AttachGetDeviceCommands(item, client.Config.IsAttachListDevicesCommands));
     }
 }