예제 #1
0
        public void Poll(string url)
        {
            RssPoller   poller  = new RssPoller();
            RssFeedData channel = new RssFeedData();

            Action <object> action = (object obj) =>
            {
                RssParser parser = new RssParser();

                string response = poller.GetReponse(url);
                channel = parser.ParseRSS(response);
            };

            Task t1 = Task.Factory.StartNew(action, "alpha");

            try
            {
                t1.Wait();
            }
            catch (System.Exception ex)
            {
                throw new Exception(ex.Message);
            }

            this.OnRaiseCustomEvent(new PollFinishedEventArgs(channel));
        }
예제 #2
0
        private void Poll(object stateInfo)
        {
            var poller = new RssPoller();

            poller.RaiseCustomEvent += this.ConsolPoller_RaiseCustomEvent;
            poller.Poll(this.url);
        }