Browse Source

Allow selecting current assembly list via double click in ManageAssemblyListsDialog

pull/2069/head
Siegfried Pammer 5 years ago
parent
commit
b43a3ad059
  1. 1
      ILSpy/ILSpy.csproj
  2. 13
      ILSpy/ViewModels/ManageAssemblyListsViewModel.cs
  3. 9
      ILSpy/Views/ManageAssemblyListsDialog.xaml

1
ILSpy/ILSpy.csproj

@ -58,6 +58,7 @@ @@ -58,6 +58,7 @@
<PackageReference Include="DataGridExtensions" Version="2.1.1" />
<PackageReference Include="System.Reflection.Metadata" Version="1.8.1" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
</ItemGroup>
<ItemGroup>

13
ILSpy/ViewModels/ManageAssemblyListsViewModel.cs

@ -49,6 +49,7 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -49,6 +49,7 @@ namespace ICSharpCode.ILSpy.ViewModels
ResetCommand = new DelegateCommand(ExecuteReset);
DeleteCommand = new DelegateCommand(ExecuteDelete, CanExecuteDelete);
CreatePreconfiguredAssemblyListCommand = new DelegateCommand<PreconfiguredAssemblyList>(ExecuteCreatePreconfiguredAssemblyList);
SelectAssemblyListCommand = new DelegateCommand(ExecuteSelectAssemblyList, CanExecuteSelectAssemblyList);
PreconfiguredAssemblyLists = new List<PreconfiguredAssemblyList>(ResolvePreconfiguredAssemblyLists());
}
@ -115,6 +116,7 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -115,6 +116,7 @@ namespace ICSharpCode.ILSpy.ViewModels
public ICommand RenameCommand { get; }
public ICommand DeleteCommand { get; }
public ICommand CreatePreconfiguredAssemblyListCommand { get; }
public ICommand SelectAssemblyListCommand { get; }
private void ExecuteNew()
{
@ -323,6 +325,17 @@ namespace ICSharpCode.ILSpy.ViewModels @@ -323,6 +325,17 @@ namespace ICSharpCode.ILSpy.ViewModels
}
}
}
private bool CanExecuteSelectAssemblyList()
{
return SelectedAssemblyList != null;
}
private void ExecuteSelectAssemblyList()
{
MainWindow.Instance.sessionSettings.ActiveAssemblyList = SelectedAssemblyList;
this.parent.Close();
}
}
public class PreconfiguredAssemblyList

9
ILSpy/Views/ManageAssemblyListsDialog.xaml

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
Title="{x:Static properties:Resources.ManageAssemblyLists}"
Style="{DynamicResource DialogWindow}"
WindowStartupLocation="CenterOwner"
@ -35,7 +36,13 @@ @@ -35,7 +36,13 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ListBox Name="listView" Margin="0 8" Grid.ColumnSpan="4" SelectedItem="{Binding SelectedAssemblyList}"
SelectionMode="Single" ItemsSource="{Binding AssemblyLists}" />
SelectionMode="Single" ItemsSource="{Binding AssemblyLists}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="MouseDoubleClick">
<b:InvokeCommandAction Command="{Binding SelectAssemblyListCommand}" />
</b:EventTrigger>
</b:Interaction.Triggers>
</ListBox>
<StackPanel Grid.Column="5" Grid.RowSpan="2" Margin="4, 8">
<Button Margin="2 2 2 10" Command="{Binding NewCommand}" CommandParameter="{Binding ., RelativeSource={RelativeSource AncestorType=Window}}" Content="{x:Static properties:Resources._New}"/>

Loading…
Cancel
Save