using Google.Apis.YouTube.v3; using Google.Apis.YouTube.v3.Data; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Imaging; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 namespace FoxTube.Controls { /// /// An empty page that can be used on its own or navigated to within a Frame. /// public sealed partial class PlaylistCard : Page { Playlist item; string playlistId; public PlaylistCard(string id) { this.InitializeComponent(); Initialize(id); } public async void Initialize(string id) { PlaylistsResource.ListRequest request = SecretsVault.NoAuthService.Playlists.List("snippet,contentDetails"); request.Id = id; PlaylistListResponse response = await request.ExecuteAsync(); item = response.Items[0]; playlistId = id; title.Text = item.Snippet.Title; channelName.Text = item.Snippet.ChannelTitle; counter.Text = item.ContentDetails.ItemCount.ToString(); date.Text = item.Snippet.PublishedAt.ToString(); ChannelsResource.ListRequest r = SecretsVault.NoAuthService.Channels.List("snippet"); r.Id = item.Snippet.ChannelId; try { thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url)); avatar.ProfilePicture = new BitmapImage(new Uri((await r.ExecuteAsync()).Items[0].Snippet.Thumbnails.Medium.Url)); } catch { } } private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) { Height = e.NewSize.Width * 0.75; } private void Button_Click(object sender, RoutedEventArgs e) { Methods.MainPage.GoToPlaylist(item.Id); } } }