public FeedItemViewModel(FeedItem feedItem) { this.feedItem = feedItem.ThrowIfNull(); feedItemsFeed = new StaticFeedViewModel(this.feedItem.Feed); }
private void ProcessFeed() { SyndicationFeed feedData; try { feedData = LoadFeedDataFromUrl(feed.Url); } catch (FeedDataLoadException ex) { InteractionService.ShowMessage(ex.Message); return; } feed.Title = string.IsNullOrEmpty(feedData.Title?.Text) ? feed.Url : feedData.Title.Text; DateTime feedLastUpdated = feedData.LastUpdatedTime.UtcDateTime; // SqlServerCe can't handle DateTime.MinValue, which is value given if LastUpdatedTime // is absent from feed. if (feedLastUpdated > DateTime.MinValue) { feed.LastUpdated = feedLastUpdated; } foreach (var feedDataItem in feedData.Items) { FeedItem newItem = new FeedItem(); newItem.Title = feedDataItem.Title?.Text; newItem.Url = feedDataItem.Links?.First()?.GetAbsoluteUri().ToString(); newItem.Summary = feedDataItem.Summary?.Text; newItem.Content = feedDataItem.Content?.ToString(); DateTime itemPublishDate = feedDataItem.PublishDate.UtcDateTime; // SqlServerCe can't handle DateTime.MinValue, see above. if (itemPublishDate > DateTime.MinValue) { newItem.PublishDate = itemPublishDate; } newItem.PopulateHtmlFields(); feed.FeedItems.Add(newItem); } NotifyPropertyChanged(""); }