Ejemplo n.º 1
0
        public override void OnButtonUp(DeckDevice deckDevice)
        {
            var auth_result = Task.FromResult(Spotify.Auth()).Result;

            if (!auth_result.Result)
            {
                return;
            }
            switch (Key)
            {
            case SpotifyMediaKeys.PlayPause:


                Task.FromResult(Spotify.ResumePlayBack());
                break;

            case SpotifyMediaKeys.Stop:


                Task.FromResult(Spotify.PausePlayBack());
                break;

            case SpotifyMediaKeys.VolumePlus:


                Task.FromResult(Spotify.setVolume(VolumeSensibility));
                break;

            case SpotifyMediaKeys.VolumeMinus:


                Task.FromResult(Spotify.setVolume(-VolumeSensibility));
                break;

            case SpotifyMediaKeys.PlayList:
                var val = Task.Run(() => Spotify.getPlayListById(PlayListId));
                Task.FromResult(Spotify.PlayPlaylist(val.Result));
                break;

            case SpotifyMediaKeys.Next:

                Task.FromResult(Spotify.SkipNext());
                break;

            case SpotifyMediaKeys.Back:
                Task.FromResult(Spotify.SkipPrevius());
                break;

            case SpotifyMediaKeys.VolumeOff:
                //  Task.FromResult(Spotify.MuteDesmute());
                var result = Task.FromResult(Spotify.MuteDesmute().Result);
                IDeckHelper.setVariable(result.Result, atual_item, deckDevice);
                break;
            }
        }