Windows phone 8.1 从windows phone 8.1中的FolderPicker获取文件夹
我已尝试使用此代码在Windows Phone上获取文件夹Windows phone 8.1 从windows phone 8.1中的FolderPicker获取文件夹,windows-phone-8.1,Windows Phone 8.1,我已尝试使用此代码在Windows Phone上获取文件夹 FolderPicker folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = PickerLocationId.Downloads; StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null)
FolderPicker folderPicker = new FolderPicker();
folderPicker.SuggestedStartLocation = PickerLocationId.Downloads;
StorageFolder folder = await folderPicker.PickSingleFolderAsync();
if (folder != null)
{
string Token = Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList.Add(folder, folder.Name);
}
但是Windows Phone 8.1不支持PickSingleFolderAsync
,并且PickFolderAndContinue
是一个无效函数
如何将文件夹添加到StorageApplicationPermissions.MostRecentlyUsedList?根据,您会注意到可以通过PickFolder和Continue回调方法(ContinueFolderPicker)检索文件夹
以下是示例中的代码片段:
public void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
{
StorageFolder folder = args.Folder;
if (folder != null)
{
// Application now has read/write access to all contents in the picked folder (including other sub-folder contents)
StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
OutputTextBlock.Text = "Picked folder: " + folder.Name;
}
else
{
OutputTextBlock.Text = "Operation cancelled.";
}
}
希望这有帮助