UWP 设置桌面壁纸、锁屏图片
2024-09-01 00:46:07
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();
}
}
最新文章
- socket读写返回值的处理
- Makefile变量
- centos6.5 中文
- pyhton类集成
- 修改 eclipse 文件编码格式
- 互斥锁Mutex与信号量Semaphore的区别
- SUN-LDAP6.3_RHEL 5.0-卸载LDAP
- [android]android开发中的运行错误之:adb.exe
- cmake 没有那个目录
- pytorch_SRU(Simple Recurrent Unit)
- .net core 部署在iis上
- Kafka相关内容总结(Kafka集群搭建手记)
- zookeeper和kafka的使用
- Linux常用命令之帮助和用户管理命令
- golang channle阻塞
- 【并查集】Connectivity @ABC049&;amp;ARC065/upcexam6492
- python爬虫之urllib
- Consul常用命令
- linux下configure,make,make install的意义
- Robot Framework+AutoItLibrary+AutoIt使用
热门文章
- Jmeter 测试 JMS (Java Message Service)/ActiveMQ 性能
- elipse安装php
- mysql group replication观点及实践
- 【Kettle】4、SQL SERVER到SQL SERVER数据转换抽取实例
- mysql优化——explain详解
- consul日常操作命令
- September 30th 2017 Week 39th Saturday
- SQL Server错误处理
- 针对 Linux 环境下 gdb 动态调试获取的局部变量地址与直接运行程序时不一致问题的解决方案
- 【转】Android 旋转动画,停止和持续旋转