/数据/我的文件/
我想在我的 Hololens 应用程序中打开上面的数据路径,它位于我的应用程序文件夹 (HoloApp/Data/myFiles) 的本地。据我了解,这样做的主要方法是使用 FileOpenPickers。我仔细阅读了API,并试图让我可以使用的最基本的、精简的、简单的 FOP。
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
Task task = new Task(
async () =>
{
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
Debug.Log("Picked file: " + file.Name);
}
else
{
Debug.Log("Cancelled");
}
});
task.Start();
task.Wait();
我已经为此苦苦挣扎了一周以上,但运气不佳(我很抱歉在 UWP 应用程序开发中表现得很糟糕。)非常感谢任何建议、链接和鼓励
这是最新的回报:
抛出异常:mscorlib.ni.dll 中的“System.Exception”
程序“[4084] hololensapplication.exe”已退出,代码为 -1073741189 (0xc000027b)。
Microsoft 开发中心对此错误代码也没有太大帮助。
编辑:
private async void OpenPdfButton_Click()
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.FileTypeFilter.Add(".pdf");
StorageFile file = await openPicker.PickSingleFileAsync();
}
崩溃与
抛出异常:mscorlib.ni.dll 中的“System.Exception”
程序“[4268] hololensapplication.exe”已退出,代码为 -1073741189 (0xc000027b)。