private 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; } try { var request = new MSYoutubeRequest(_settings); var items = request.GetAsync(YoutubeUrl, new Uri(url), onYoutubeLoading); if (items == null) { Entries = new ObservableCollection <Feed>(); } else { if (String.IsNullOrEmpty(Title)) { Title = items.Title; } Entries = GetMembers(items); } } catch { Entries = new ObservableCollection <Feed>(); } if (onEntriesReady != null) { onEntriesReady(Entries); } }
private void FillEntriesUser(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var youtubeUrl = YoutubeUrl; var request = new MSYoutubeRequest(_settings); var uri = new Uri(String.Format("https://gdata.youtube.com/feeds/api/users/{0}/playlists?v=2", youtubeUrl.UserId)); var items = request.GetAsync(YoutubeUrl, uri, onYoutubeLoading); if (items == null) { return; } Entries = new ObservableCollection <Feed>(); try { if (!String.IsNullOrEmpty(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); } }