文件/文件夹选择器需要授予初始权限,一旦授予,就将文件添加到将来的访问列表中 .
private async void ChooseFile()
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".wmv");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add(file, "Test");
}
else
{
// The file picker was dismissed with no file selected to save
}
}
如何获取文件和播放媒体
foreach (AccessListEntry itm in StorageApplicationPermissions.FutureAcces