예제 #1
0
파일: Spotify.cs 프로젝트: dbartoss/spotify
        public async Task <FeaturedPlaylistsResponse> GetFeaturedPLaylists()
        {
            FeaturedPlaylistsResponse playlists = null;
            HttpResponseMessage       response  = await client.GetAsync(URL + "/featured-playlists");

            if (response.IsSuccessStatusCode)
            {
                playlists = JsonConvert.DeserializeObject <FeaturedPlaylistsResponse>(await response.Content.ReadAsStringAsync());
            }

            return(playlists);
        }
예제 #2
0
        public PlaylistsPage(FeaturedPlaylistsResponse featuredPlaylists)
        {
            InitializeComponent();
            TitleBlock.Text = featuredPlaylists.Message;

            featuredPlaylists.Playlists.Items.ForEach(playlist =>
            {
                var playlistCard = new PlaylistCardComponent(playlist.Name, playlist.Images[0].Url, playlist.Uri);
                Frame frame      = new Frame();
                frame.Navigate(playlistCard);
                Playlists.Children.Add(frame);
            });
        }
예제 #3
0
        /// <summary>
        /// The NavigateToPlaylistsPage
        /// </summary>
        /// <param name="sender">The sender <see cref="object" /></param>
        /// <param name="e">The e <see cref="RoutedEventArgs" /></param>
        private async void NavigateToPlaylistsPage(object sender, RoutedEventArgs e)
        {
            FeaturedPlaylistsResponse featuredPlaylists = await _spotify.GetFeaturedPLaylists();

            CurrentPage.Content = new PlaylistsPage(featuredPlaylists);
        }