/// <summary>
    /// Set the repeat state in Spotify.
    /// </summary>
    /// <param name="state">The repeat state to set to</param>
    public void SetRepeat(Repeat state)
    {
        RepeatState repeatState = SpotifyAPI.Web.Enums.RepeatState.Off;

        switch (state)
        {
        case Repeat.Disabled:
            repeatState = SpotifyAPI.Web.Enums.RepeatState.Off;
            break;

        case Repeat.Playlist:
            repeatState = SpotifyAPI.Web.Enums.RepeatState.Context;
            break;

        case Repeat.Track:
            repeatState = SpotifyAPI.Web.Enums.RepeatState.Track;
            break;
        }

        RepeatState = state;
        m_webAPI.SetRepeatMode(repeatState);
        OnRepeatChanged?.Invoke(RepeatState);

        Analysis.Log($"Set Repeat state to {state.ToString()}");
    }
Example #2
0
 public PlaybackService()
 {
     _playlistService = new PlaylistService(this);
     _playlistService.OnPlaylistEndReached  += () => OnPlaylistEndReached?.Invoke();
     _playlistService.OnPlaylistChanged     += () => OnPlaylistChanged?.Invoke();
     _playlistService.OnCurrentMediaChanged += onCurrentMediaChanged;
     _playlistService.OnRepeatChanged       += (v) => OnRepeatChanged?.Invoke(v);
     PlayingType = PlayingType.NotPlaying;
 }
 private void SetRepeatInternal(Repeat state)
 {
     RepeatState = state;
     OnRepeatChanged?.Invoke(RepeatState);
     Analysis.Log($"Set Repeat mode to {state.ToString()}");
 }