Browse Source

Remember decompiled nodes before starting decompilation, this fixes problems with changing tabs while a decompilation is in progress.

pull/2554/head
Siegfried Pammer 4 years ago
parent
commit
9cb0668d17
  1. 7
      ILSpy/TextView/DecompilerTextView.cs
  2. 3
      ILSpy/ViewModels/TabPageModel.cs

7
ILSpy/TextView/DecompilerTextView.cs

@ -152,7 +152,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -152,7 +152,7 @@ namespace ICSharpCode.ILSpy.TextView
{
if (this.DataContext is PaneModel model)
{
model.Title = currentTitle ?? ILSpy.Properties.Resources.NewTab;
model.Title = currentTitle ?? ILSpy.Properties.Resources.Decompiling;
}
}
@ -665,8 +665,8 @@ namespace ICSharpCode.ILSpy.TextView @@ -665,8 +665,8 @@ namespace ICSharpCode.ILSpy.TextView
textOutput.Title = string.Join(", ", nodes.Select(n => n.Text));
}
ShowOutput(textOutput, highlighting);
decompiledNodes = nodes;
ShowOutput(textOutput, highlighting);
}
/// <summary>
@ -815,12 +815,12 @@ namespace ICSharpCode.ILSpy.TextView @@ -815,12 +815,12 @@ namespace ICSharpCode.ILSpy.TextView
return RunWithCancellation(
delegate (CancellationToken ct) { // creation of the background task
context.Options.CancellationToken = ct;
decompiledNodes = context.TreeNodes;
return DecompileAsync(context, outputLengthLimit);
})
.Then(
delegate (AvalonEditTextOutput textOutput) { // handling the result
ShowOutput(textOutput, context.Language.SyntaxHighlighting, context.Options.TextViewState);
decompiledNodes = context.TreeNodes;
})
.Catch<Exception>(exception => {
textEditor.SyntaxHighlighting = null;
@ -835,7 +835,6 @@ namespace ICSharpCode.ILSpy.TextView @@ -835,7 +835,6 @@ namespace ICSharpCode.ILSpy.TextView
output.WriteLine(exception.ToString());
}
ShowOutput(output);
decompiledNodes = context.TreeNodes;
});
}

3
ILSpy/ViewModels/TabPageModel.cs

@ -96,6 +96,7 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -96,6 +96,7 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView();
tabPage.Content = textView;
}
tabPage.Title = Properties.Resources.Decompiling;
return action(textView);
}
@ -106,6 +107,7 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -106,6 +107,7 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView();
tabPage.Content = textView;
}
tabPage.Title = Properties.Resources.Decompiling;
return action(textView);
}
@ -116,6 +118,7 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -116,6 +118,7 @@ namespace ICSharpCode.ILSpy.ViewModels
textView = new DecompilerTextView();
tabPage.Content = textView;
}
tabPage.Title = Properties.Resources.Decompiling;
action(textView);
}
}

Loading…
Cancel
Save