27 lines
620 B
C#
27 lines
620 B
C#
using Microsoft.Win32;
|
|
|
|
namespace CRAWLER.Services;
|
|
|
|
internal interface IFilePickerService
|
|
{
|
|
IReadOnlyList<string> PickPdfFiles(bool multiselect);
|
|
}
|
|
|
|
internal sealed class FilePickerService : IFilePickerService
|
|
{
|
|
public IReadOnlyList<string> PickPdfFiles(bool multiselect)
|
|
{
|
|
var dialog = new OpenFileDialog
|
|
{
|
|
Filter = "PDF (*.pdf)|*.pdf",
|
|
Multiselect = multiselect,
|
|
CheckFileExists = true,
|
|
CheckPathExists = true
|
|
};
|
|
|
|
return dialog.ShowDialog() == true
|
|
? dialog.FileNames
|
|
: Array.Empty<string>();
|
|
}
|
|
}
|