FolderPicker does not work in UWP Windows 10 app (mobile)

I am developing a UWP application for Windows 10. Given the following code example ....

using Windows.Storage;
using Windows.Storage.Pickers;

FolderPicker picker = new FolderPicker() { SuggestedStartLocation = PickerLocationId.PicturesLibrary };

picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".jpeg");
StorageFolder folder = await picker.PickSingleFolderAsync();

if (folder != null) { ... work ... }

... everything works fine on the desktop .

On the mobile device, unfortunately (build 10.0.10549), the first time the method is called, a system dialog box appears in which I can select "My device" as the only parameter. When you click this option, the system-file-explorer-app application starts, after which there is an immediate close / crash / something in this application. So I ended up in my application again with folder == null. When I try to run this fragment again, it PickSingleFolderAsync()throws a UnauthorizedAccessException ("Access denied"). However, if I put a breakpoint on line c PickSingleFolderAsync(), the application does not crash, but, as in the first attempt, the file-explorer application returns immediately without any folder.

zu: https://msdn.microsoft.com/de-de/library/windows/apps/windows.storage.pickers.folderpicker.picksinglefolderasync

+4
1

, 10572 Win10 . folderpicker 10549, 10572 .

05//2015 - VS Win10M VS2015 Update1 RC + Win10M 10581. " ", .

+2

Source: https://habr.com/ru/post/1613033/


All Articles