Ejemplo n.º 1
0
        /// <summary>
        /// Actual updating of items happens here.
        /// </summary>
        void DoUpdateItems()
        {
            if (_feed == null)
            {
                return;
            }

            List <RssChannel> channels;

            lock (this)
            {
                channels = GeneralHelper.EnumerableToList <RssChannel>(_feed.Channels);
            }

            foreach (RssChannel channel in channels)
            {
                // Obtain or create channel.
                EventSourceChannel sourceChannel = base.GetChannelByName(channel.Title, true);
                sourceChannel.ItemsUpdateEnabled = false;
                sourceChannel.Address            = channel.Link.ToString();

                List <EventBase> newItems = new List <EventBase>();
                foreach (RssItem item in channel.Items)
                {
                    RssNewsEvent eventItem = new RssNewsEvent(item);
                    eventItem.Initialize(sourceChannel);
                    newItems.Add(eventItem);
                }

                // Add all by default to the "Default" channel, since RSS feeds never seem to bother with proper inner channels.
                sourceChannel.AddItems(newItems);
            }
        }
        /// <summary>
        /// Actual updating of items happens here.
        /// </summary>
        void DoUpdateItems()
        {
            if (_feed == null)
            {
                return;
            }

            List<RssChannel> channels;
            lock (this)
            {
                channels = GeneralHelper.EnumerableToList<RssChannel>(_feed.Channels);
            }

            foreach (RssChannel channel in channels)
            {
                // Obtain or create channel.
                EventSourceChannel sourceChannel = base.GetChannelByName(channel.Title, true);
                sourceChannel.ItemsUpdateEnabled = false;
                sourceChannel.Address = channel.Link.ToString();

                List<EventBase> newItems = new List<EventBase>();
                foreach (RssItem item in channel.Items)
                {
                    RssNewsEvent eventItem = new RssNewsEvent(item);
                    eventItem.Initialize(sourceChannel);
                    newItems.Add(eventItem);
                }

                // Add all by default to the "Default" channel, since RSS feeds never seem to bother with proper inner channels.
                sourceChannel.AddItems(newItems);
            }
        }