0

/数据/我的文件/

我想在我的 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)。

4

1 回答 1

0

你不能

根据HoloLens shell 当前的限制,您不能使用内置的本机文件选择器(因为它不存在)。

文件资源管理器和本地文件系统

Windows Holographic 应用模型当前不公开文件系统的概念。有已知的文件夹,但没有内置的本地文件资源管理器应用程序,如 Windows 桌面或移动设备。应用程序可以将文件保存到其本地状态文件夹。应用程序还可以将文件保存到已注册的文件选择器应用程序,例如 OneDrive。

您可以使用第三方文件选择器(如前所述的 OneDrive),但这将是一个单独的 DLL,而不是 Windows.Storage

于 2017-06-30T16:41:40.123 回答