Example #1
0
 public static List<FeedItemSummary> SummarizeFeed(IFeed feed, ParentFeed parentFeed, int itemCount = 3)
 {
     return feed.Items.Reverse().Skip(Math.Max(0, feed.Items.Count - itemCount)).Select(feedItem => new FeedItemSummary
     {
         DatePublished = feedItem.DatePublished,
         Link = feedItem.Link,
         ParentFeed = parentFeed,
         Title = feedItem.Title
     }).OrderByDescending(x => x.DatePublished).ToList();
 }
Example #2
0
        public static List<FeedItemSummary> SummarizeFeed(IFeed feed, int itemCount = 3)
        {
            var parentFeed = new ParentFeed {FeedUri = feed.FeedUri, Link = feed.Link, Title = feed.Title, LastUpdated = DateTime.UtcNow};

            return SummarizeFeed(feed, parentFeed, itemCount);
        }
Example #3
0
        private void ExecuteQuery(ParentFeed feed, bool bind = false)
        {
            _remoteQueryService.BeginQueryFeeds(feed.FeedUri, async =>
            {

                var feedResult = _remoteQueryService.EndQueryFeeds(async);

                var feedItemSummaries = FeedSummarizer.SummarizeFeed(feedResult, feed, feedResult.Items.Count);

                //Synchronize access to the cache
                lock (_cacheLock)
                {
                    //Cache the processed feed to memory
                    if (CacheDictionary.ContainsKey(feedResult.FeedUri))
                        CacheDictionary.Remove(feedResult.FeedUri);
                    CacheDictionary.Add(feedResult.FeedUri,
                                        new KeyValuePair<DateTime, IList<FeedItemSummary>>(DateTime.UtcNow,
                                                                                           feedItemSummaries));
                }

                //Perform a UI bind update if one is requested
                if (bind)
                {
                    UpdateBindings(feedItemSummaries);
                    DispatcherHelper.CheckBeginInvokeOnUI(() => { IsLoading = false; });
                }

            });
        }