/数据/我的文件/
我想在我的 Hololens 应用程序中打开上面的数据路径,该路径位于我的应用程序文件夹 (HoloApp/Data/myFiles) 的本地。据我了解,执行此操作的主要方法是使用 FileOpenPickers。我读过API's https://learn.microsoft.com/en-us/uwp/api/Windows.Storage.Pickers.FileOpenPicker并试图获得我可以使用的最基本的、精简的、简单的 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)。
The 对于这个错误代码也没有多大帮助。
EDIT:
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)。
你不能
根据HoloLens shell 当前的限制 https://developer.microsoft.com/en-us/windows/mixed-reality/current_limitations_for_apps_using_apis_from_the_shell您无法使用内置的本机文件选择器(因为它不存在)。
文件资源管理器和本地文件系统
Windows Holographic 应用程序模型当前未公开文件系统的概念。有已知的文件夹,但没有像 Windows 桌面或移动设备上那样的内置本地文件资源管理器应用程序。应用程序可以将文件保存到其本地状态文件夹。应用程序还可以将文件保存到已注册的文件选择器应用程序(例如 OneDrive)。
您可以使用第三方文件选择器(例如如上所述的 OneDrive),但这将是一个单独的 DLL,而不是 Windows.Storage
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)