Exemplo n.º 1
0
        /// <summary>
        /// Loads the items.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="migratedItemsOwner">The migrated items owner.</param>
        protected void LoadItems(XmlReader reader, FeedSourceEntry migratedItemsOwner)
        {
            if (feedInfo.ItemsList.Count > 0)
            {
                feedInfo.ItemsList.Clear();
            }

            bool success = false;

            if (reader != null)
            {
                try{
                    XmlDocument doc = new XmlDocument();
                    doc.Load(reader);
                    foreach (XmlElement elem in doc.SelectNodes("//item"))
                    {
                        NewsItem item = RssParser.MakeRssItem(this, new XmlNodeReader(elem));

                        // We do this because the flagged items are stored in one "feed",
                        // but gets displayed one node per flag status. If one item is unread,
                        // all flag nodes gets the "unread" state.
                        item.BeenRead = true;

                        item.FeedDetails = this.feedInfo;
                        if (migrationRequired)
                        {
                            item = MigrateItem(item, migratedItemsOwner);
                        }

                        if (item != null)
                        {
                            feedInfo.ItemsList.Add(item);
                        }
                    }

                    success = true;
                }catch (Exception e) {
                    ExceptionManager.GetInstance().Add(RssBanditApplication.CreateLocalFeedRequestException(e, this, this.feedInfo), migratedItemsOwner);
                }
            }

            OnItemsLoaded(success);
        }