Browse Source

Fixes #1812

pull/1827/head
pvasilek 6 years ago
parent
commit
141440e47f
  1. 2
      ILSpy/Commands/DecompileInNewViewCommand.cs
  2. 15
      ILSpy/MainWindow.xaml.cs

2
ILSpy/Commands/DecompileInNewViewCommand.cs

@ -62,9 +62,11 @@ namespace ICSharpCode.ILSpy.Commands @@ -62,9 +62,11 @@ namespace ICSharpCode.ILSpy.Commands
{
if (nodes.Length == 0)
return;
var title = string.Join(", ", nodes.Select(x => x.ToString()));
DockWorkspace.Instance.Documents.Add(new ViewModels.DecompiledDocumentModel(title, title) { Language = MainWindow.Instance.CurrentLanguage, LanguageVersion = MainWindow.Instance.CurrentLanguageVersion });
DockWorkspace.Instance.ActiveDocument = DockWorkspace.Instance.Documents.Last();
MainWindow.Instance.SelectNodes(nodes);
MainWindow.Instance.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (Action)delegate {
DockWorkspace.Instance.GetTextView().DecompileAsync(MainWindow.Instance.CurrentLanguage, nodes, new DecompilationOptions());
});

15
ILSpy/MainWindow.xaml.cs

@ -117,10 +117,10 @@ namespace ICSharpCode.ILSpy @@ -117,10 +117,10 @@ namespace ICSharpCode.ILSpy
};
DockWorkspace.Instance.LoadSettings(sessionSettings);
InitializeComponent();
DockWorkspace.Instance.InitializeLayout(DockManager);
DockWorkspace.Instance.PropertyChanged += filter_DockWorkspace_PropertyChanged;
sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
@ -131,6 +131,17 @@ namespace ICSharpCode.ILSpy @@ -131,6 +131,17 @@ namespace ICSharpCode.ILSpy
this.Loaded += MainWindow_Loaded;
}
private void filter_DockWorkspace_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "ActiveDocument") {
if ((sender as DockWorkspace).ActiveDocument is DecompiledDocumentModel doc) {
var view = doc.TextView;
if (view != null)
MainWindow.Instance.SelectNodes(view.GetState().DecompiledNodes);
}
}
}
void SetWindowBounds(Rect bounds)
{
this.Left = bounds.Left;

Loading…
Cancel
Save