private static Uri imgUri = new Uri("ms-appx:///pic1.jpg");

    private async void btnSetWallpaper_Click(object sender, RoutedEventArgs e)
{
var msg = new MessageDialog("");
if (!UserProfilePersonalizationSettings.IsSupported())
{
//msg = new MessageDialog("人品太差,不支持哦!");
msg.Content = "人品太差,不支持哦!";
await msg.ShowAsync();
}
//获取文件
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(imgUri); //设置背景
UserProfilePersonalizationSettings setting = UserProfilePersonalizationSettings.Current;
bool b = await setting.TrySetWallpaperImageAsync(file);
if (b)
{
msg.Content = "set ok!";
await msg.ShowAsync();
}
else
{
msg.Content = "can not set Wallpaper !";
await msg.ShowAsync();
} }

设置锁屏图片

private async void btnSetLockScreen_Click(object sender, RoutedEventArgs e)

{

var msg = new MessageDialog("");

if (!UserProfilePersonalizationSettings.IsSupported())

{

//msg = new MessageDialog("人品太差,不支持哦!");

msg.Content = "人品太差,不支持哦!";

await msg.ShowAsync();

}

//获取文件

StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(imgUri);

        //设置背景
UserProfilePersonalizationSettings setting = UserProfilePersonalizationSettings.Current;
bool b = await setting.TrySetLockScreenImageAsync(file);
if (b)
{
msg.Content = "set ok!";
await msg.ShowAsync();
}
else
{
msg.Content = "can not set lock screen!";
await msg.ShowAsync();
} }

最新文章

  1. socket读写返回值的处理
  2. Makefile变量
  3. centos6.5 中文
  4. pyhton类集成
  5. 修改 eclipse 文件编码格式
  6. 互斥锁Mutex与信号量Semaphore的区别
  7. SUN-LDAP6.3_RHEL 5.0-卸载LDAP
  8. [android]android开发中的运行错误之:adb.exe
  9. cmake 没有那个目录
  10. pytorch_SRU(Simple Recurrent Unit)
  11. .net core 部署在iis上
  12. Kafka相关内容总结(Kafka集群搭建手记)
  13. zookeeper和kafka的使用
  14. Linux常用命令之帮助和用户管理命令
  15. golang channle阻塞
  16. 【并查集】Connectivity @ABC049&ARC065/upcexam6492
  17. python爬虫之urllib
  18. Consul常用命令
  19. linux下configure,make,make install的意义
  20. Robot Framework+AutoItLibrary+AutoIt使用

热门文章

  1. Jmeter 测试 JMS (Java Message Service)/ActiveMQ 性能
  2. elipse安装php
  3. mysql group replication观点及实践
  4. 【Kettle】4、SQL SERVER到SQL SERVER数据转换抽取实例
  5. mysql优化——explain详解
  6. consul日常操作命令
  7. September 30th 2017 Week 39th Saturday
  8. SQL Server错误处理
  9. 针对 Linux 环境下 gdb 动态调试获取的局部变量地址与直接运行程序时不一致问题的解决方案
  10. 【转】Android 旋转动画,停止和持续旋转