Browse Source

Handle exception when downloading children in TocEntry.

pull/14/head
Daniel Grunwald 15 years ago
parent
commit
adac4478bb
  1. 16
      src/AddIns/Misc/HelpViewer/Source/Controls/TocEntry.cs

16
src/AddIns/Misc/HelpViewer/Source/Controls/TocEntry.cs

@ -34,11 +34,17 @@ namespace MSHelpSystem.Controls
client.DownloadStringCompleted += (_, e) => client.DownloadStringCompleted += (_, e) =>
{ {
LoggingService.Debug(string.Format("Help 3.0: title \"{0}\"", Title)); try {
var children = XElement.Parse(e.Result); LoggingService.Debug(string.Format("Help 3.0: title \"{0}\"", Title));
Children = children.Elements("topic") var children = XElement.Parse(e.Result);
.Select(link => new TocEntry(link.Attribute("id").Value) { Title = link.Element("title").Value }) Children = children.Elements("topic")
.ToArray(); .Select(link => new TocEntry(link.Attribute("id").Value) { Title = link.Element("title").Value })
.ToArray();
} catch (TargetInvocationException ex) {
// Exception when fetching e.Result:
LoggingService.Warn(ex);
this.children = defaultChild;
}
client.Dispose(); client.Dispose();
}; };
RaisePropertyChanged("Children"); RaisePropertyChanged("Children");

Loading…
Cancel
Save