2013-04-03 46 views
1

我写这行代码:错误而读入文件GetFileAsync

file = await Package.Current.InstalledLocation.GetFileAsync("ms-appx:///Images/Hair Cuts/HC_1.jpg"); 

但引发此异常:

WinRT information: An item cannot be found with the specified Name 
(ms-appx:///Images/Hair Cuts/HC_1.jpg). 

该图片在指定的文件夹中。谁能帮忙?

+1

恩,原因是在那里的例外。 – 2013-04-03 20:08:37

+0

图像确实存在于文件夹中。 – Tehreem 2013-04-03 20:10:04

+0

三根斜线///?试试两个。 – Phil 2013-04-03 20:12:13

回答

3

为了检索文件,请尝试使用代码从MSDN documentation

using Windows.Storage; 

StorageFile file = await StorageFile.GetFileFromApplicationUriAsync("ms-appx:///Images/Hair Cuts/HC_1.jpg"); 
+0

工作正常。谢谢 – Tehreem 2013-04-03 20:32:35