IStorageProvider Interface
Definition
public interface IStorageProvider
Methods
| Name | Description |
|---|---|
| OpenFileBookmarkAsync | Open Avalonia.Platform.Storage.IStorageBookmarkFile from the bookmark ID. |
| OpenFilePickerAsync | Opens file picker dialog. |
| OpenFolderBookmarkAsync | Open Avalonia.Platform.Storage.IStorageBookmarkFolder from the bookmark ID. |
| OpenFolderPickerAsync | Opens folder picker dialog. |
| SaveFilePickerAsync | Opens save file picker dialog. |
| SaveFilePickerWithResultAsync | Opens save file picker dialog and returns additional information about the result. |
| TryGetFileFromPathAsync | Attempts to read file from the file-system by its path. |
| TryGetFolderFromPathAsync | Attempts to read folder from the file-system by its path. |
| TryGetWellKnownFolderAsync | Attempts to read folder from the file-system by its path |
OpenFileBookmarkAsync Method
Open Avalonia.Platform.Storage.IStorageBookmarkFile from the bookmark ID.
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageBookmarkFile> OpenFileBookmarkAsync(string bookmark)
Parameters
bookmark string
Bookmark ID.
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageBookmarkFile>
Bookmarked file or null if OS denied request.
OpenFilePickerAsync Method
Opens file picker dialog.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Avalonia.Platform.Storage.IStorageFile>> OpenFilePickerAsync(Avalonia.Platform.Storage.FilePickerOpenOptions options)
Parameters
options Avalonia.Platform.Storage.FilePickerOpenOptions
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Avalonia.Platform.Storage.IStorageFile>>
Array of selected Avalonia.Platform.Storage.IStorageFile or empty collection if user canceled the dialog.
OpenFolderBookmarkAsync Method
Open Avalonia.Platform.Storage.IStorageBookmarkFolder from the bookmark ID.
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageBookmarkFolder> OpenFolderBookmarkAsync(string bookmark)
Parameters
bookmark string
Bookmark ID.
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageBookmarkFolder>
Bookmarked folder or null if OS denied request.
OpenFolderPickerAsync Method
Opens folder picker dialog.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Avalonia.Platform.Storage.IStorageFolder>> OpenFolderPickerAsync(Avalonia.Platform.Storage.FolderPickerOpenOptions options)
Parameters
options Avalonia.Platform.Storage.FolderPickerOpenOptions
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Avalonia.Platform.Storage.IStorageFolder>>
Array of selected Avalonia.Platform.Storage.IStorageFolder or empty collection if user canceled the dialog.
SaveFilePickerAsync Method
Opens save file picker dialog.
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile> SaveFilePickerAsync(Avalonia.Platform.Storage.FilePickerSaveOptions options)
Parameters
options Avalonia.Platform.Storage.FilePickerSaveOptions
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile>
Saved Avalonia.Platform.Storage.IStorageFile or null if user canceled the dialog.
SaveFilePickerWithResultAsync Method
Opens save file picker dialog and returns additional information about the result.
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.SaveFilePickerResult> SaveFilePickerWithResultAsync(Avalonia.Platform.Storage.FilePickerSaveOptions options)
Parameters
options Avalonia.Platform.Storage.FilePickerSaveOptions
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.SaveFilePickerResult>
Avalonia.Platform.Storage.SaveFilePickerResult with saved file and additional dialog information such as selected file type.
TryGetFileFromPathAsync Method
Attempts to read file from the file-system by its path.
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile> TryGetFileFromPathAsync(Uri filePath)
Parameters
filePath Uri
The path of the item to retrieve in Uri format.
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFile>
File or null if it doesn't exist.
Remarks
Uri path is usually expected to be an absolute path with "file" scheme. But it can be an uri with "content" scheme on the Android. It also might ask user for the permission, and throw an exception if it was denied.
TryGetFolderFromPathAsync Method
Attempts to read folder from the file-system by its path.
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder> TryGetFolderFromPathAsync(Uri folderPath)
Parameters
folderPath Uri
The path of the folder to retrieve in Uri format.
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder>
Folder or null if it doesn't exist.
Remarks
Uri path is usually expected to be an absolute path with "file" scheme. But it can be an uri with "content" scheme on the Android. It also might ask user for the permission, and throw an exception if it was denied.
TryGetWellKnownFolderAsync Method
Attempts to read folder from the file-system by its path
public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder> TryGetWellKnownFolderAsync(Avalonia.Platform.Storage.WellKnownFolder wellKnownFolder)
Parameters
wellKnownFolder Avalonia.Platform.Storage.WellKnownFolder
Well known folder identifier.
Returns
System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageFolder>
Folder or null if it doesn't exist.
Properties
| Name | Description |
|---|---|
| CanOpen | Returns true if it's possible to open file picker on the current platform. |
| CanPickFolder | Returns true if it's possible to open folder picker on the current platform. |
| CanSave | Returns true if it's possible to open save file picker on the current platform. |
CanOpen Property
Returns true if it's possible to open file picker on the current platform.
public bool CanOpen { get; set; }
CanPickFolder Property
Returns true if it's possible to open folder picker on the current platform.
public bool CanPickFolder { get; set; }
CanSave Property
Returns true if it's possible to open save file picker on the current platform.
public bool CanSave { get; set; }