From fd520543825f0457053c04baecc7a088afab3ed5 Mon Sep 17 00:00:00 2001 From: sonyps5201314 Date: Tue, 2 Apr 2024 14:52:17 +0800 Subject: [PATCH] fix the order of SelectedItems --- DependenciesGui/DependencyExportList.xaml.cs | 6 ++++++ DependenciesGui/DependencyImportList.xaml.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/DependenciesGui/DependencyExportList.xaml.cs b/DependenciesGui/DependencyExportList.xaml.cs index da030a9..252eaa1 100644 --- a/DependenciesGui/DependencyExportList.xaml.cs +++ b/DependenciesGui/DependencyExportList.xaml.cs @@ -50,6 +50,12 @@ private void ExportListCopySelectedValues(object sender, RoutedEventArgs e) { selectedExports.Add((import as DisplayPeExport)); } + if (SelectedIndex != 0) + { + var firstSelectedItem = selectedExports[0]; + selectedExports.Remove(firstSelectedItem); + selectedExports.Insert(SelectedIndex, firstSelectedItem); + } var result = MessageBox.Show("Only copy the function names?", "Copy", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Cancel); if (result == MessageBoxResult.Cancel) diff --git a/DependenciesGui/DependencyImportList.xaml.cs b/DependenciesGui/DependencyImportList.xaml.cs index 91b3bb3..729883d 100644 --- a/DependenciesGui/DependencyImportList.xaml.cs +++ b/DependenciesGui/DependencyImportList.xaml.cs @@ -70,6 +70,12 @@ private void ImportListCopySelectedValues(object sender, RoutedEventArgs e) { selectedImports.Add((import as DisplayPeImport)); } + if (SelectedIndex != 0) + { + var firstSelectedItem = selectedImports[0]; + selectedImports.Remove(firstSelectedItem); + selectedImports.Insert(SelectedIndex, firstSelectedItem); + } var result = MessageBox.Show("Only copy the function names?", "Copy", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Cancel); if (result == MessageBoxResult.Cancel)