From 3d67131d7262689b576af623fa284e8df3165c39 Mon Sep 17 00:00:00 2001 From: celeron533 Date: Tue, 25 Jun 2024 15:10:30 +0800 Subject: [PATCH] Remove WindowsAPICodePack Rewrite the FolderPickupService. The old method does not work in .NET8 --- DicomGrep/DicomGrep.csproj | 1 - DicomGrep/Services/FolderPickupService.cs | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/DicomGrep/DicomGrep.csproj b/DicomGrep/DicomGrep.csproj index e6b624e..6ba63ef 100644 --- a/DicomGrep/DicomGrep.csproj +++ b/DicomGrep/DicomGrep.csproj @@ -62,7 +62,6 @@ - diff --git a/DicomGrep/Services/FolderPickupService.cs b/DicomGrep/Services/FolderPickupService.cs index 2b40fde..8a8d4a3 100644 --- a/DicomGrep/Services/FolderPickupService.cs +++ b/DicomGrep/Services/FolderPickupService.cs @@ -1,7 +1,7 @@ -using Microsoft.WindowsAPICodePack.Dialogs; -using System; +using System; using System.Collections.Generic; using System.Text; +using Microsoft.Win32; namespace DicomGrep.Services { @@ -12,16 +12,14 @@ public class FolderPickupService { public bool SelectFolder(ref string folderPath) { - CommonOpenFileDialog openFileDialog = new CommonOpenFileDialog + var openFileDialog = new OpenFolderDialog { - IsFolderPicker = true, - DefaultDirectory = folderPath + DefaultDirectory = folderPath, }; - // note: may slow to stop debugging when running from Visual Studio - if (CommonFileDialogResult.Ok == openFileDialog.ShowDialog()) + if (true == openFileDialog.ShowDialog()) { - folderPath = openFileDialog.FileName; + folderPath = openFileDialog.FolderName; return true; } else