Browse Source

Adjust SaveCommandCanExecute to match SaveCommandExecuted.

pull/1550/head
Siegfried Pammer 6 years ago
parent
commit
24e492bfe3
  1. 2
      ILSpy/MainWindow.xaml
  2. 6
      ILSpy/MainWindow.xaml.cs

2
ILSpy/MainWindow.xaml

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
Executed="RefreshCommandExecuted" />
<CommandBinding
Command="Save"
CanExecute="SaveCommandExecutedCanExecute"
CanExecute="SaveCommandCanExecute"
Executed="SaveCommandExecuted" />
<CommandBinding
Command="BrowseBack"

6
ILSpy/MainWindow.xaml.cs

@ -899,7 +899,7 @@ namespace ICSharpCode.ILSpy @@ -899,7 +899,7 @@ namespace ICSharpCode.ILSpy
decompilationTask = decompilerTextView.DecompileAsync(this.CurrentLanguage, this.SelectedNodes, new DecompilationOptions() { TextViewState = state });
}
private void SaveCommandExecutedCanExecute(object sender, CanExecuteRoutedEventArgs e)
void SaveCommandCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.Handled = true;
var focusedElement = FocusManager.GetFocusedElement(this) as DependencyObject;
@ -908,7 +908,7 @@ namespace ICSharpCode.ILSpy @@ -908,7 +908,7 @@ namespace ICSharpCode.ILSpy
return;
}
var selectedNodes = SelectedNodes.ToList();
e.CanExecute = selectedNodes.Count == 1 || selectedNodes.TrueForAll(n => n is AssemblyTreeNode);
e.CanExecute = selectedNodes.Count == 1 || (selectedNodes.Count > 1 && selectedNodes.All(n => n is AssemblyTreeNode));
}
void SaveCommandExecuted(object sender, ExecutedRoutedEventArgs e)
@ -919,7 +919,7 @@ namespace ICSharpCode.ILSpy @@ -919,7 +919,7 @@ namespace ICSharpCode.ILSpy
// we will invoke the custom Save logic
if (selectedNodes[0].Save(TextView))
return;
} else if (selectedNodes.All(n => n is AssemblyTreeNode)) {
} else if (selectedNodes.Count > 1 && selectedNodes.All(n => n is AssemblyTreeNode)) {
var initialPath = Path.GetDirectoryName(((AssemblyTreeNode)selectedNodes[0]).LoadedAssembly.FileName);
var selectedPath = SelectSolutionFile(initialPath);

Loading…
Cancel
Save