-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding initial spec for Reunion Picker API.
- Loading branch information
1 parent
f5a93c3
commit 943b5e3
Showing
1 changed file
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Background | ||
|
||
The current FilePicker API for UWP has several limitations. Some of the top limitations | ||
are as described below: | ||
|
||
**1. Unable to pick files and folders in a single instance of the Picker dialog** | ||
|
||
The Picker dialog allows developers to specify picker mode to be single file or multiple | ||
files. It does not however, allow developers to specify a mode to pick both files and folders. | ||
There has been feedback indicating that this behaviour is limiting, requiring developers | ||
to build their own picker experience. | ||
|
||
**2. Unable to pick multiple folders.** | ||
|
||
The Picker dialog (FolderPicker) does not allow users to pick multiple folders. The developer | ||
experience currently is to select a single folder and repeat the dialog for more folders. This | ||
is a less than ideal experience for application developers. | ||
|
||
The Reunion picker dialog is going to address the above issues. This Reunion API will be based upon the below | ||
APIs in the Windows SDK. The Reunion Picker API will remove the deprecated APIs and add additional methods | ||
for the functionality file and folder picker, multiple folder picker. | ||
|
||
- Windows.Storage.Pickers.FileOpenPicker (https://docs.microsoft.com/en-us/uwp/api/Windows.Storage.Pickers.FileOpenPicker) | ||
- Windows.Storage.Pickers.FileSavePicker (https://docs.microsoft.com/en-us/uwp/api/windows.storage.pickers.filesavepicker) | ||
- Windows.Storage.Pickers.FolderPicker (https://docs.microsoft.com/en-us/uwp/api/windows.storage.pickers.folderpicker) | ||
|
||
# Description | ||
|
||
The goal of this API is to address the gaps in the existing File/Folder picker APIs. The API surface is similar to the existing | ||
Picker APIs in Windows SDK with additional methods to support File + Folder picker and multiple folder picker. The API removes the | ||
deprecated methods from Windows SDK. | ||
|
||
# Examples | ||
|
||
## Show file and folder picker | ||
```c# | ||
var picker = StorageItemPicker::CreateFilePicker(); | ||
picker.Filters.add("*.jpg"); | ||
picker.Filters.add("*.png"); | ||
picker.StartLocation = startLocation; | ||
IReadOnlyList<StorageItem> storageItems = await picker.PickStorageItemAsync(); | ||
|
||
if(0 < storageItems.Count) | ||
{ | ||
} | ||
``` | ||
|
||
## Show single folder picker | ||
```c# | ||
var picker = StorageItemPicker::CreateFolderPicker(); | ||
Windows.Storage.StorageFolder folder = await picker.PickSingleFolderAsync(); | ||
``` | ||
|
||
|
||
## Show multi folder picker | ||
```c# | ||
var picker = StorageItemPicker::CreateFolderPicker(); | ||
IReadOnlyList<Windows.Storage.StorageFolder> folders = picker.PickMultipleFoldersAsync(); | ||
``` | ||
|
||
# Remarks | ||
|
||
# API Notes | ||
|
||
|
||
# API Details | ||
|
||
```c# | ||
namespace Microsoft.Reunion.Storage.Pickers | ||
{ | ||
typedef enum PickerViewMode | ||
{ | ||
List = 0, | ||
Details, | ||
Tiles, | ||
Content | ||
} PickerViewMode; | ||
|
||
runtimeclass StorageItemPicker | ||
{ | ||
/// Static constructor | ||
static FileOpenPicker CreateFileOpenPicker(); | ||
static FileSaveFileAsync CreateFileSavePicker(); | ||
static FolderPicker CreateFolderPicker(); | ||
|
||
String StartLocation{ set; } | ||
String OkButtonText { set; } | ||
String CancelButtonText { set; } | ||
Windows.Foundation.Collections.IMap<String, String> FilterAndDescription{ get; } | ||
PickerViewMode ViewMode{ get; set; } | ||
} | ||
|
||
runtimeclass FileOpenPicker : StorageItemPicker | ||
{ | ||
Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile> PickSingleFileAsync(); | ||
Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Storage.StorageFile>> PickMutipleFilesAsync(); | ||
Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Storage.StorageItem>> PickStorageItemsAsync(); | ||
} | ||
|
||
runtimeclass FileSavePicker : StorageItemPicker | ||
{ | ||
String SuggestedSaveFile{ get; set; } | ||
String DefaultFileExtension{ get; set; } | ||
|
||
Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile> PickSaveFileAsync(); | ||
} | ||
|
||
runtimeclass FolderPicker : StorageItemPicker | ||
{ | ||
Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFolder> PickSingleFolderAsync(); | ||
Windows.Foundation.IAsyncOperation<Windows.Foundation.Collections.IVectorView<Windows.Storage.StorageFolder>> PickMultipleFoldersAsync(); | ||
} | ||
} | ||
``` | ||
|
||
# Appendix |