diff --git a/Directory.Packages.props b/Directory.Packages.props index f2fd119b5d..bcedfd1c10 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -45,12 +45,12 @@ - - - + + + - + \ No newline at end of file diff --git a/ICSharpCode.ILSpyX/AssemblyListManager.cs b/ICSharpCode.ILSpyX/AssemblyListManager.cs index 35e1021ce9..772062c9e2 100644 --- a/ICSharpCode.ILSpyX/AssemblyListManager.cs +++ b/ICSharpCode.ILSpyX/AssemblyListManager.cs @@ -113,14 +113,16 @@ public bool RenameList(string selectedAssemblyList, string newListName) public void SaveList(AssemblyList list) { this.settingsProvider.Update( - delegate (XElement root) { + root => { XElement? doc = root.Element("AssemblyLists"); if (doc == null) { doc = new XElement("AssemblyLists"); root.Add(doc); } - XElement? listElement = doc.Elements("List").FirstOrDefault(e => (string?)e.Attribute("name") == list.ListName); + + XElement? listElement = doc.Elements("List") + .FirstOrDefault(e => (string?)e.Attribute("name") == list.ListName); if (listElement != null) listElement.ReplaceWith(list.SaveAsXml()); else @@ -163,13 +165,9 @@ public void ClearAll() { AssemblyLists.Clear(); this.settingsProvider.Update( - delegate (XElement root) { + root => { XElement? doc = root.Element("AssemblyLists"); - if (doc == null) - { - return; - } - doc.Remove(); + doc?.Remove(); }); } diff --git a/ILSpy/Analyzers/AnalyzerTreeView.xaml b/ILSpy/Analyzers/AnalyzerTreeView.xaml index 28bba030c8..d23119f127 100644 --- a/ILSpy/Analyzers/AnalyzerTreeView.xaml +++ b/ILSpy/Analyzers/AnalyzerTreeView.xaml @@ -12,8 +12,7 @@ ShowRoot="False" BorderThickness="0" Root="{Binding Root}" - toms:MultiSelectorExtensions.SelectionBinding="{Binding SelectedItems}" - SelectedItem="{Binding SelectedItem, Mode=TwoWay}" + toms:MultiSelectorExtensions.SelectionBinding="{Binding SelectedItems, Mode=TwoWay}" SelectionChanged="AnalyzerTreeView_OnSelectionChanged"> diff --git a/ILSpy/Analyzers/AnalyzerTreeViewModel.cs b/ILSpy/Analyzers/AnalyzerTreeViewModel.cs index 7a746c0889..5c666d38f4 100644 --- a/ILSpy/Analyzers/AnalyzerTreeViewModel.cs +++ b/ILSpy/Analyzers/AnalyzerTreeViewModel.cs @@ -17,8 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; using System.ComponentModel.Composition; using System.Linq; using System.Windows; @@ -38,8 +36,6 @@ namespace ICSharpCode.ILSpy.Analyzers [Export] public class AnalyzerTreeViewModel : ToolPaneModel { - private AnalyzerTreeNode selectedItem; - public const string PaneContentId = "analyzerPane"; public AnalyzerTreeViewModel() @@ -52,14 +48,20 @@ public AnalyzerTreeViewModel() public AnalyzerRootNode Root { get; } = new(); - public AnalyzerTreeNode SelectedItem { - get => selectedItem; - set => SetProperty(ref selectedItem, value); - } - public ICommand AnalyzeCommand => new DelegateCommand(AnalyzeSelected); - public ObservableCollection SelectedItems { get; } = []; + private AnalyzerTreeNode[] selectedItems = []; + + public AnalyzerTreeNode[] SelectedItems { + get => selectedItems ?? []; + set { + if (SelectedItems.SequenceEqual(value)) + return; + + selectedItems = value; + OnPropertyChanged(); + } + } private void AnalyzeSelected() { @@ -87,7 +89,7 @@ void AddOrSelect(AnalyzerTreeNode node) } target.IsExpanded = true; - this.SelectedItem = target; + this.SelectedItems = [target]; } public void Analyze(IEntity entity) diff --git a/ILSpy/App.xaml.cs b/ILSpy/App.xaml.cs index d00eb42045..0665244f3f 100644 --- a/ILSpy/App.xaml.cs +++ b/ILSpy/App.xaml.cs @@ -216,9 +216,6 @@ protected override void OnStartup(StartupEventArgs e) } MainWindow = new MainWindow(); - MainWindow.Loaded += (sender, args) => { - ExportProvider.GetExportedValue().Initialize(); - }; MainWindow.Show(); } diff --git a/ILSpy/AssemblyTree/AssemblyListPane.xaml b/ILSpy/AssemblyTree/AssemblyListPane.xaml index 7222fdabff..e413985d7c 100644 --- a/ILSpy/AssemblyTree/AssemblyListPane.xaml +++ b/ILSpy/AssemblyTree/AssemblyListPane.xaml @@ -7,6 +7,7 @@ xmlns:treeNodes="clr-namespace:ICSharpCode.ILSpy.TreeNodes" xmlns:assemblyTree="clr-namespace:ICSharpCode.ILSpy.AssemblyTree" xmlns:toms="urn:TomsToolbox" + xmlns:viewModels="clr-namespace:ICSharpCode.ILSpy.ViewModels" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance assemblyTree:AssemblyTreeModel}" AutomationProperties.Name="Assemblies and Classes" @@ -15,8 +16,8 @@ AllowDrop="True" BorderThickness="0" Visibility="Visible" Root="{Binding Root}" - SelectedItem="{Binding SelectedItem, Mode=TwoWay}" - toms:MultiSelectorExtensions.SelectionBinding="{Binding SelectedItems}"> + toms:MultiSelectorExtensions.SelectionBinding="{Binding SelectedItems, Mode=TwoWay}" + viewModels:Pane.IsActive="{Binding IsActive}">