private async void FillEntriesChannel(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var url = ""; if (!String.IsNullOrEmpty(YoutubeUrl.ChannelId)) { url = "https://gdata.youtube.com/feeds/api/playlists/" + YoutubeUrl.ChannelId; } else if (!String.IsNullOrEmpty(YoutubeUrl.FeedId)) { url = String.Format("https://gdata.youtube.com/feeds/api/users/{0}/uploads", YoutubeUrl.FeedId); } if (url.Length <= 0) return; MSYoutubeEntry items; try { var request = new MSYoutubeRequest(_settings); items = await request.GetAsync(YoutubeUrl, new Uri(url), onYoutubeLoading); if (items == null) { if (onEntriesReady != null) onEntriesReady(new ObservableCollection<Feed>()); return; } if (String.IsNullOrEmpty(Title)) Title = items.Title; } catch { if (onEntriesReady != null) onEntriesReady(new ObservableCollection<Feed>()); return; } Entries = GetMembers(items); if (onEntriesReady != null) onEntriesReady(Entries); }
private async void FillEntriesUser(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var youtubeUrl = YoutubeUrl; var request = new MSYoutubeRequest(_settings); var items = await request.GetAsync(YoutubeUrl, new Uri(String.Format("https://gdata.youtube.com/feeds/api/users/{0}/playlists?v=2", youtubeUrl.UserId)), onYoutubeLoading); if (items == null) return; Entries = new ObservableCollection<Feed>(); try { if (!String.IsNullOrWhiteSpace(items.AuthorId)) { var favoritesEntry = new YoutubeEntry(this) { Title = "Favorite Videos", Uri = new Uri("http://www.youtube.com/playlist?list=FL" + items.AuthorId), }; Entries.Add(favoritesEntry); } foreach (var member in items.Entries) { var entry = new YoutubeEntry(this) { Title = member.Title, Uri = member.Uri, Description = member.Description }; Entries.Add(entry); } } catch { Entries.Clear(); } if (onEntriesReady != null) onEntriesReady(Entries); }