Esempio n. 1
0
        /// <summary>
        /// Subscribes to a RSS feed
        /// </summary>
        /// <param name="destination">The Uri destination object.</param>
        /// <param name="receiver">The FeedReceiver that will receive the RSS feed.</param>
        public static void Subscribe(Uri destination, FeedReceiver receiver)
        {
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }
            if (receiver == null)
            {
                throw new ArgumentNullException("receiver");
            }

            IFeedInputChannel channel = null;

            if (channels[destination] == null)
            {
                channel = FeedTransport.StaticGetInputChannel(destination);
                if (channel != null)
                {
                    channels.Add(destination, channel);
                    receivers.Add(destination, receiver);
                    feedWorker.AddFeed(destination);
                }
            }
            else
            {
                channel = channels[destination] as IFeedInputChannel;
            }

            channel.BeginReceive(new AsyncCallback(FeedEngine.OnReceiveComplete), destination);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="destination"></param>
        /// <returns></returns>
        public static Feed Receive(Uri destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException();
            }

            IFeedInputChannel channel = FeedTransport.StaticGetInputChannel(destination);

            return(channel.Receive());
        }
Esempio n. 3
0
        /// <summary>
        /// Subscribes to a RSS feed.
        /// </summary>
        /// <param name="destination">The Uri destination object.</param>
        public static void Subscribe(Uri destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException();
            }

            IFeedInputChannel channel = null;

            if (channels[destination] == null)
            {
                channel = FeedTransport.StaticGetInputChannel(destination);
                if (channel != null)
                {
                    channels.Add(destination, channel);
                    feedWorker.AddFeed(destination);
                }
            }
            else
            {
                channel = channels[destination] as IFeedInputChannel;
            }
        }