2013-04-03 47 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