문제

this might be a stupid question, but I just can't seem to figure out how to access my text files that I embedded in my app. I know several ways to do it for desktop apps (through searching for ways to do it for rt apps) but have never found a way to do it for rt apps. This has been bugging me for MONTHS!

도움이 되었습니까?

해결책

Anything in your app package can be referred to using an ms-appx:/// URI (the three /// are important), and opened with StorageFile.GetFromApplicationUriAsync (a static method, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.getfilefromapplicationuriasync.aspx).

You can also get your package's StorageFolder object through Windows.ApplicationModel.Package.InstalledLocation, see http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.installedlocation.aspx. Then you use StorageFolder.GetFileAsync (http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefolder.getfileasync.aspx) with a relative pathname.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top