public static async Task <ObservableCollection <apergiaFeedItem> > getFeedsAsync(string url) { //The web object that will retrieve our feeds.. SyndicationClient client = new SyndicationClient(); //The URL of our feeds.. Uri feedUri = new Uri(url); //Retrieve async the feeds.. var feed = await client.RetrieveFeedAsync(feedUri); //The list of our feeds.. ObservableCollection <apergiaFeedItem> feedData = new ObservableCollection <apergiaFeedItem>(); //Fill up the list with each feed content.. foreach (SyndicationItem item in feed.Items) { apergiaFeedItem af = new apergiaFeedItem(); af.PubDate = item.PublishedDate.DateTime; af.Title = item.Title.Text; af.Summary = extractSummary(item.Summary.Text); try { af.Link = item.Links[0].Uri; } catch (Exception) { } feedData.Add(af); } return(feedData); }
public static async Task<ObservableCollection<apergiaFeedItem>> getFeedsAsync(string url) { //The web object that will retrieve our feeds.. SyndicationClient client = new SyndicationClient(); //The URL of our feeds.. Uri feedUri = new Uri(url); //Retrieve async the feeds.. var feed = await client.RetrieveFeedAsync(feedUri); //The list of our feeds.. ObservableCollection<apergiaFeedItem> feedData = new ObservableCollection<apergiaFeedItem>(); //Fill up the list with each feed content.. foreach (SyndicationItem item in feed.Items) { apergiaFeedItem af = new apergiaFeedItem(); af.PubDate = item.PublishedDate.DateTime; af.Title = item.Title.Text; af.Summary = extractSummary(item.Summary.Text); try { af.Link = item.Links[0].Uri; } catch (Exception) { } feedData.Add(af); } return feedData; }