StorageProvider
The StorageProvider
is central to file and folder management. It provides methods for file and folder selection, checking platform capabilities, and interacting with stored bookmarks.
The StorageProvider
can be access through an instance of TopLevel
or Window
, for more details on accessing TopLevel
please visit TopLevel page:
var storage = window.StorageProvider;
Properties
CanOpen
Indicates whether it's possible to open a open file picker
on the current platform.
bool CanOpen { get; }
CanSave
Indicates whether it's possible to open a save file picker
on the current platform.
bool CanSave { get; }
CanPickFolder
Indicates whether it's possible to open a folder picker
on the current platform.
bool CanPickFolder { get; }
Methods
OpenFilePickerAsync
Opens a file picker dialog.
Task<IReadOnlyList<IStorageFile>> OpenFilePickerAsync(FilePickerOpenOptions options);
The method returns an array of selected IStorageFile
instances or an empty collection if the user cancels the dialog.
SaveFilePickerAsync
Opens a save file picker dialog.
Task<IStorageFile?> SaveFilePickerAsync(FilePickerSaveOptions options);
The method returns a saved IStorageFile
instance or null if the user cancels the dialog.
OpenFolderPickerAsync
Opens a folder picker dialog.
Task<IReadOnlyList<IStorageFolder>> OpenFolderPickerAsync(FolderPickerOpenOptions options);
The method returns an array of selected IStorageFolder
instances or an empty collection if the user cancels the dialog.
OpenFileBookmarkAsync
Opens a IStorageBookmarkFile
from the bookmark ID.
Task<IStorageBookmarkFile?> OpenFileBookmarkAsync(string bookmark);