Browse Source

Fix #1813: Windows/Reset layout empties output window

pull/1835/head
Siegfried Pammer 6 years ago
parent
commit
5206244254
  1. 9
      ILSpy/Commands/DecompileInNewViewCommand.cs
  2. 5
      ILSpy/Docking/DockWorkspace.cs

9
ILSpy/Commands/DecompileInNewViewCommand.cs

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
using System;
using System.Linq;
using System.Windows.Threading;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.Docking;
using ICSharpCode.ILSpy.Properties;
@ -42,7 +43,12 @@ namespace ICSharpCode.ILSpy.Commands @@ -42,7 +43,12 @@ namespace ICSharpCode.ILSpy.Commands
public void Execute(TextViewContext context)
{
if (context.SelectedTreeNodes != null) {
var nodes = context.SelectedTreeNodes.OfType<IMemberTreeNode>().Select(FindTreeNode).ToArray();
ILSpyTreeNode[] nodes;
if (context.TreeView != MainWindow.Instance.treeView) {
nodes = context.SelectedTreeNodes.OfType<IMemberTreeNode>().Select(FindTreeNode).ToArray();
} else {
nodes = context.SelectedTreeNodes.OfType<ILSpyTreeNode>().ToArray();
}
DecompileNodes(nodes);
} else if (context.Reference?.Reference is IEntity entity) {
if (MainWindow.Instance.FindTreeNode(entity) is ILSpyTreeNode node) {
@ -67,6 +73,7 @@ namespace ICSharpCode.ILSpy.Commands @@ -67,6 +73,7 @@ namespace ICSharpCode.ILSpy.Commands
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(DispatcherPriority.Background, (Action)MainWindow.Instance.RefreshDecompiledView);
}
}
}

5
ILSpy/Docking/DockWorkspace.cs

@ -25,6 +25,7 @@ using System.Linq; @@ -25,6 +25,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.ViewModels;
@ -167,7 +168,7 @@ namespace ICSharpCode.ILSpy.Docking @@ -167,7 +168,7 @@ namespace ICSharpCode.ILSpy.Docking
public DecompilerTextViewState GetState()
{
return GetTextView().GetState();
return GetTextView()?.GetState();
}
public Task<T> RunWithCancellation<T>(Func<CancellationToken, Task<T>> taskCreation)
@ -209,8 +210,10 @@ namespace ICSharpCode.ILSpy.Docking @@ -209,8 +210,10 @@ namespace ICSharpCode.ILSpy.Docking
foreach (var pane in ToolPanes) {
pane.IsVisible = false;
}
CloseAllDocuments();
sessionSettings.DockLayout.Reset();
InitializeLayout(MainWindow.Instance.DockManager);
MainWindow.Instance.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)MainWindow.Instance.RefreshDecompiledView);
}
}
}

Loading…
Cancel
Save