private async void Button_Click(object sender, RoutedEventArgs e) { try { Button btn = sender as Button; Models.Video video = ListVideo.First(x => x.Id.Equals(btn.Tag)); video.IsLike = true; conn.AddVideo(video); } catch { await new MessageDialog("Something wrong !").ShowAsync(); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var searchYoutube = e.Parameter as SearchResource.ListRequest; var searchResult = await searchYoutube.ExecuteAsync(); searchResult.Items.ToList().ForEach(item => { switch (item.Id.Kind) { case "youtube#video": ListVideo.Add(new Models.Video() { Id = item.Id.VideoId, Title = item.Snippet.Title, Img = item.Snippet.Thumbnails.Default__.Url }); break; case "youtube#chanel": ListChanel.Add(new Models.Chanel() { Id = item.Id.VideoId, Title = item.Snippet.Title, Img = item.Snippet.Thumbnails.Default__.Url }); break; case "youtube#playlist": ListPlaylist.Add(new Models.Playlist() { Id = item.Id.VideoId, Title = item.Snippet.Title, Img = item.Snippet.Thumbnails.Default__.Url }); break; } }); }