public interface IFileDialogs Presentation-scoped selection of file access. Leases, streams and native access remain in C#.
Methods
OpenDirectoriesAsync
ValueTask<PickerResult<IDirectoryLeaseList>> OpenDirectoriesAsync(OpenDirectoryOptions options, CancellationToken cancellationToken = default) Selects one or more directories and acquires access to each for C# filesystem operations.
Remarks
Each lease keeps its directory's access, as IFileDialogs.OpenDirectoryAsync does, until it, the list or the presentation is disposed. The default implementation returns Unavailable with PlatformUnavailableReason.BackendUnavailable; a provider that implements multiple directory selection overrides it and reports the platform.directories.openMultiple capability.
OpenDirectoryAsync
ValueTask<PickerResult<IDirectoryLease>> OpenDirectoryAsync(OpenDirectoryOptions options, CancellationToken cancellationToken = default) Selects directory access for C# filesystem operations. A provider without directory selection reports unavailable.
Remarks
The default implementation returns Unavailable with PlatformUnavailableReason.BackendUnavailable. A provider that implements directory selection overrides this method and also reports that support through its capability declaration, such as IPickerBackend.SupportsDirectorySelection in Runic.Platform.Runtime.
OpenDocumentAsync
ValueTask<PickerResult<IDocumentFileLease>> OpenDocumentAsync(OpenFileOptions options, CancellationToken cancellationToken = default) Selects an existing document for reading and saving back to it.
Remarks
Unlike IFileDialogs.OpenFileAsync, which opens the file once for reading, the lease reads the document again on each IDocumentFileLease.OpenReadAsync and writes it through ISaveFileLease.BeginWriteAsync. Whether those writes can replace the file is reported by the platform.files.save capability; a read-only grant reports PlatformUnavailableReason.AtomicReplaceUnavailable per write. The default implementation returns Unavailable with PlatformUnavailableReason.BackendUnavailable; a provider that implements it overrides it and reports the platform.files.openDocument capability.
OpenFileAsync
ValueTask<PickerResult<IReadFileLease>> OpenFileAsync(OpenFileOptions options, CancellationToken cancellationToken = default) Selects and acquires a single-use read lease.
OpenFilesAsync
ValueTask<PickerResult<IReadFileLeaseList>> OpenFilesAsync(OpenFileOptions options, CancellationToken cancellationToken = default) Selects one or more files and acquires a single-use read lease for each.
Remarks
The selection is all or nothing: if any selected file cannot be opened, every acquired lease is released and the result is Failed. Each lease holds an open file until it or the list is disposed. The default implementation returns Unavailable with PlatformUnavailableReason.BackendUnavailable; a provider that implements multiple selection overrides it and reports the platform.files.openMultiple capability.
SaveDocumentAsync
ValueTask<PickerResult<IDocumentFileLease>> SaveDocumentAsync(SaveFileOptions options, CancellationToken cancellationToken = default) Selects a save destination, as IFileDialogs.SaveFileAsync does, as a document the application can read back and save again, such as for Save As.
Exceptions
ArgumentExceptionThe suggested name is empty or a path.
Remarks
The document does not exist until the first committed write: until then IDocumentFileLease.OpenReadAsync reports PlatformFailureCode.NotFound. The default implementation returns Unavailable with PlatformUnavailableReason.BackendUnavailable; a provider that implements it overrides it and reports the platform.files.openDocument capability.
SaveFileAsync
ValueTask<PickerResult<ISaveFileLease>> SaveFileAsync(SaveFileOptions options, CancellationToken cancellationToken = default) Selects and acquires a save destination.