Windows 10(UWP)中的TimeTrigger/Scheduler不到15分钟
发布时间:2020-12-14 02:27:03 所属栏目:Windows 来源:网络整理
导读:我发现使用TimeTrigger是 Windows 10(UWP)上预定后台任务的方式.但是看起来我们需要给出的最小数量是15分钟.只是想知道,警报和提醒如何适用于Windows 10,即使我们计划在接下来的1分钟内运行它. 我正在寻找一个应该在特定时间内触发任务的解决方案,其中包括不
我发现使用TimeTrigger是
Windows 10(UWP)上预定后台任务的方式.但是看起来我们需要给出的最小数量是15分钟.只是想知道,警报和提醒如何适用于Windows 10,即使我们计划在接下来的1分钟内运行它.
我正在寻找一个应该在特定时间内触发任务的解决方案,其中包括不到15分钟. 任何人都可以对此有所了解吗? 解决方法
报警&时钟应用程序使用预定的Toast通知而不是后台任务.
以下是在10秒内安排祝酒的示例代码. namespace UWPApp { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { private Random random = new Random((int)DateTime.Now.Ticks); const string TOAST = @" <toast> <visual> <binding template=""ToastGeneric""> <text>Sample</text> <text>This is a simple toast notification example</text> <image placement = ""AppLogoOverride"" src=""oneAlarm.png"" /> </binding> </visual> <actions> <action content = ""check"" arguments=""check"" imageUri=""check.png"" /> <action content = ""cancel"" arguments=""cancel""/> </actions> <audio src =""ms-winsoundevent:Notification.Reminder""/> </toast>"; public MainPage() { this.InitializeComponent(); } private void Button_Click(object sender,RoutedEventArgs e) { var when = DateTime.Now.AddSeconds(10); var offset = new DateTimeOffset(when); Windows.Data.Xml.Dom.XmlDocument xml = new Windows.Data.Xml.Dom.XmlDocument(); xml.LoadXml(TOAST); ScheduledToastNotification toast = new ScheduledToastNotification(xml,offset); toast.Id = random.Next(1,100000000).ToString(); ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast); } } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows下安装RabbitMQ
- Windows中的Jenkins以俄语显示UI
- windows-10 – Windows 10移动设备错误:DEP6200
- 你如何在Windows中复制巨大的(数百万)目录树?
- windows-server-2003 – 如何控制默认管理共享的权限?
- windows-server-2003 – 使用SQL Server重新安装Windows Se
- windows-server-2008 – 更新Windows Production Webserver
- windows – 从网络安装程序
- Windows2003下php5.4安装配置教程(Apache2.4)
- windows-server-2008 – 您当前的安全设置不允许下载此文件
推荐文章
站长推荐
- windows – 如何在一个方向上“静默”TCP连接?
- 如何在Windows 8 WInJS应用程序中启动IE10中的UR
- winapi – 如何从Powershell事件订阅者操作??设置
- 在Windows上处理Perl中的unicode目录和文件名
- windows-phone-8 – windows phone 8 Map API Ge
- windows-server-2003 – 终端服务器磁盘性能
- Windows Azure移动服务与Azure云服务有何不同?
- windows-server-2008 – Server 2008 R2到Server
- .net – 如何使用命令行实用程序编辑exe的资源(文
- 相机 – Windows Phone 8镜头增强现实
热点阅读