コード例 #1
0
        private void SkipNext()
        {
            DispatcherHelper.CheckBeginInvokeOnUI(async() =>
            {
                if (_trackQueue.Count != 0)
                {
                    var track = _trackQueue.Dequeue();
                    TrackList.Add(new TrackItem
                    {
                        TrackToken       = track.TrackToken,
                        AlbumArtUrl      = track.AlbumArtUrl,
                        SongName         = track.SongName,
                        ArtistName       = track.ArtistName,
                        AlbumName        = track.AlbumName,
                        IsPositive       = track.IsPositive,
                        ThumbUpCommand   = new RelayCommand(() => { }),
                        ThumbDownCommand = new RelayCommand(() => { })
                    });

                    SelectedTrack      = TrackList.LastOrDefault();
                    SelectedTrackIndex = TrackList.IndexOf(SelectedTrack);

                    _playbackService.SetMediaSource(track.ToMediaPlaybackItem());
                    _playbackService.Play();
                }
                else
                {
                    _trackQueue = new Queue <ITrack>(await _pandoraService.RetrievePlaylistAsync(StationToken));
                    SkipNext();
                }
            });
        }