void webclient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { // process the feed if (!e.Cancelled) { if (e.Error == null && e.Result != null) { FeedInfo info = null; XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; using (XmlReader reader = XmlReader.Create(e.Result, settings)) { GenericFeedParser parser = new GenericFeedParser(); info = parser.Parse(reader); } if (info != null) { info.Url = this.FeedUrl; ProcessFeed(info); ChangeStatus(true, String.Empty); } else { // the loader couldn't load the feed ChangeStatus(false, "Could not parse feed"); SendErrorNotification("Could not parse feed."); } } else { if (e.Error != null) { // there was an error returned from the call ChangeStatus(false, "Error retrieving feed"); SendErrorNotification("Error retrieving feed."); } else { // an empty stream. ChangeStatus(false, "Error retrieving feed"); SendErrorNotification("Error retrieving feed."); } } } // restart the timer this.timer.Start(); }
void webclient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { // process the feed if (!e.Cancelled) { if (e.Error == null && e.Result != null) { FeedInfo info = null; XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; using (XmlReader reader = XmlReader.Create(e.Result, settings)) { GenericFeedParser parser = new GenericFeedParser(); info = parser.Parse(reader); } if (info != null) { info.Url = this.FeedUrl; ProcessFeed(info); ChangeStatus(true, String.Empty); } else { // the loader couldn't load the feed ChangeStatus(false, "Could not parse feed"); SendErrorNotification("Could not parse feed."); } } else { if (e.Error != null) { // there was an error returned from the call ChangeStatus(false, "Error retrieving feed"); SendErrorNotification("Error retrieving feed."); } else { // an empty stream. ChangeStatus(false, "Error retrieving feed"); SendErrorNotification("Error retrieving feed."); } } } // restart the timer this.timer.Start(); }