Get file paths for files in Centennial app

与世无争的帅哥 提交于 2019-12-13 11:08:54

问题


When converting an app to a Windows Store app, we add the files as mentioned here. But now - how do we access them? What's their path?

They're not in the special folder created for the package.


回答1:


You can create a folder structure in your project where you can include the files and then since you are already crossing the Centennial Bridge, you can start using the Windows.Storage.StorageFile WinRT API to interact with files.

For example, you can use: StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///folderUnderYourAppRoot/image.bmp")); to get the file which is under the "folderUnderYourAppRoot". This is the generic guidance: https://msdn.microsoft.com/en-us/windows/uwp/files/quickstart-reading-and-writing-files, so you can review it further...



来源:https://stackoverflow.com/questions/39625644/get-file-paths-for-files-in-centennial-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!