简体   繁体   English

WP8 LockScreen.SetImageUri异常

[英]WP8 LockScreen.SetImageUri exception

LockScreen.SetImageUri method fails with ArgumentException when I use the following uri: 当我使用以下uri时,LockScreen.SetImageUri方法失败,并出现ArgumentException:

LockScreen.SetImageUri( new Uri("C:\\Data\\Users\\DefApps\\AppData\\{2F102375-2740-441C-BF2F-808608F47DA1}\\Local\\Wallpapers\\my_wallpaper.jpg",UriKind.Absolute));

I have checked with Windows Phone Power Tools that the image exists and it's size also fits. 我已经使用Windows Phone电动工具检查了该图像的存在,并且它的大小也适合。 The path is correct, because I can create a StorageFile from the above path. 该路径是正确的,因为我可以从上述路径创建一个StorageFile。

So why is this exception thrown by SetImageUri method? 那么,为什么SetImageUri方法会抛出此异常?

If I use the "ms-appdata:///local/Wallpapers/my_wallpaper.jpg" it works correctly, however this kind of uri does not work with StorageFile and StorageFolder. 如果我使用“ ms-appdata:///local/Wallpapers/my_wallpaper.jpg”,则它可以正常工作,但是这种uri不适用于StorageFile和StorageFolder。

"ms-appdata:///local/" is the uri scheme you must use, what do you mean with " this kind of uri does not work with StorageFile and StorageFolder"? “ ms-appdata://// local /”是您必须使用的uri方案,“这种uri在StorageFile和StorageFolder中不起作用”是什么意思? "local" points to your app folder. “本地”指向您的应用文件夹。 If you create a file there, you can access it with that uri scheme. 如果在此处创建文件,则可以使用该uri方案进行访问。 See http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402541%28v=vs.105%29.aspx#BKMK_Localfolder 请参阅http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/ff402541%28v=vs.105%29.aspx#BKMK_Localfolder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM