Browse Source

do not load images on a background thread

pull/37/head
Siegfried Pammer 15 years ago
parent
commit
bba65cf3ae
  1. 32
      ILSpy/TreeNodes/ResourceEntryNode.cs

32
ILSpy/TreeNodes/ResourceEntryNode.cs

@ -45,21 +45,23 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -45,21 +45,23 @@ namespace ICSharpCode.ILSpy.TreeNodes
AvalonEditTextOutput output = new AvalonEditTextOutput();
IHighlightingDefinition highlighting = null;
textView.RunWithCancellation(
token => Task.Factory.StartNew(
() => {
try {
if (LoadImage(output))
highlighting = null;
else if (LoadBaml(output))
highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
} catch (Exception ex) {
output.Write(ex.ToString());
}
return output;
}),
t => textView.Show(t.Result, highlighting)
);
if (LoadImage(output)) {
textView.Show(output, highlighting);
} else {
textView.RunWithCancellation(
token => Task.Factory.StartNew(
() => {
try {
if (LoadBaml(output))
highlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
} catch (Exception ex) {
output.Write(ex.ToString());
}
return output;
}),
t => textView.Show(t.Result, highlighting)
);
}
return true;
}

Loading…
Cancel
Save