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)); }
private void Poll(object stateInfo) { var poller = new RssPoller(); poller.RaiseCustomEvent += this.ConsolPoller_RaiseCustomEvent; poller.Poll(this.url); }