Добавьте файлы проекта.
This commit is contained in:
26
Services/FilePickerService.cs
Normal file
26
Services/FilePickerService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user