由于最新的Insider版本(14352)TrySetWallpaperImageAsync / TrySetLockScreenImageAsync不再有效。之前工作正常。 API有变化吗?该方法返回false,但UserProfilePersonalizationSettings.IsSupported()
返回true。
我正在从Unsplash下载图片并将其保存到ApplicationData.Current.LocalFolder
这是我的代码:
HttpResponseMessage response = await client.GetAsync(uri);
if (response != null && response.StatusCode == HttpStatusCode.Ok)
{
var imageFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);
using (IRandomAccessStream stream = await imageFile.OpenAsync(FileAccessMode.ReadWrite))
{
await response.Content.WriteToStreamAsync(stream);
}
StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync(filename);
UserProfilePersonalizationSettings settings = UserProfilePersonalizationSettings.Current;
await settings.TrySetWallpaperImageAsync(file);
}
没有错误,图像保存在正确的目录中。
答案 0 :(得分:0)
实际上,经过我的研究,我发现api并没有在Windows的内部构建上工作。我有另一台笔记本电脑,它不在内幕程序上,并且设置相同的代码壁纸工作正常:D 我确实在反馈中心报告了这个问题。希望你做同样的事情,我们所能做的就是等待修复