使用非本地映像在Windows Phone 8中设置锁定屏幕

Jas*_*ort 3 lockscreen windows-phone windows-phone-8

我正在尝试使用SetImageUri在Windows Phone 8上设置锁定屏幕,但我无法使用非本地图像.在我的例子中,我有一个单独的程序集和远程服务器(Azure CDN)上的图像.

我已经添加了清单条目,并获得了示例代码中的提供者的用户权限.

这就是代码看起来像imageUri会是这样的:

https://infinitecodex.blob.core.windows.net/nflfanapps/26-WALL-1.png

图像退出并且是有效文件.我尝试将它放在一个单独的图像集中,但仍然会出现此错误.

                // At this stage, the app is the active lock screen background provider.
                var uri = new Uri(imageUri, UriKind.Absolute);

                // Set the lock screen background image.
                Windows.Phone.System.UserProfile.LockScreen.SetImageUri(uri);
Run Code Online (Sandbox Code Playgroud)

我尝试的所有内容都会导致异常:

    Value does not fall within the expected range.
Run Code Online (Sandbox Code Playgroud)

Mar*_*han 5

根据本指南,您只能使用存储在隔离存储中的图像或随应用程序打包的图像:
Windows Phone 8的锁定屏幕背景
没有什么可以阻止您将图像下载到隔离存储并使用Uri将此图像作为锁屏源.

//在此阶段,应用程序是活动锁屏幕背景提供程序.//以下代码示例显示新的URI架构.// ms-appdata指向本地应用程序数据文件夹的根目录.// ms-appx points到本地应用程序安装文件夹,引用XAP package.var schema = isAppResource中捆绑的资源?"ms-appx:///":"ms-appdata:/// Local /";