预定的Toast通知到期 [英] Scheduled Toast Notification Expiration

查看:60
本文介绍了预定的Toast通知到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在预定的Toast通知中产生类似于Toast通知到期的效果。

I am trying to do have an effect similar to the expiration of a toast notification in the scheduled toast notification.

我要做的是在特定时间安排10个通知作为提醒,这样他们就会向用户显示自定义音频(超过15秒)。我需要为每个提醒播放音频。如果用户错过了提醒,那么
他应该只看到显示的最新提醒。

What I'm trying to do is to schedule 10 notifications at specific times as reminder so they would appear to the user with a custom audio (longer than 15 seconds). I need the audio to play for each reminder. If the user miss a reminder it wouldn't matter he should only see the latest reminder shown.

使用到期属性将超时设置为下一个提醒之前的1秒做的伎俩。由于到期属性不可用,因此使用预定的Toast通知我尝试使用相同的组添加新的Toast&标记并将
的SuppressPopup属性设置为true。这不起作用,因为除非用户与真实的用户互动,否则不会出现这个鬼吐司弹出窗口。有没有过期属性的另一种方法吗?

Using the expiration property setting the timeout to 1 second before the next reminder would do the trick. With scheduled toast notifications since the expiration property isn't available I tried to add a new toast using the same group & tag and having the SuppressPopup property set to true. That didn't work since this ghost toast popup won't appear unless the user interact with the real one. Is there another way to do this without the expiration property?

BTW,我没有得到在正常吐司中具有超时功能的实用程序,因为我没有看到原因用户希望在应用程序运行时在通知中心接收通知。第二,开发人员应该能够通过使用ToastNotificationHistory类随意删除通知中心的通知。

BTW, I don't get the utility of having the timeout functionality in a normal toast since first I don't see a reason the user would want to receive a notification in the notification center while the application is running. And second, the developer should be able to remove the notification from the notification center at will by using the ToastNotificationHistory class.

另一个相关问题,也就是因为到期时间不是不可用,我需要吐司通知才能在预定播放时(或在指定时间内)播放声音,如果它晚于它显示静音或幽灵通知
或不显示它一点都不再次使用到期时间,通过将到期时间设置为所需的时间,然后在此之后添加另一个重影通知或者不添加任何内容。由于预定通知没有到期时间
如果用户在计划之前关闭机器并在预定时间后30分钟将其关闭,则会显示通知,并且音频将像预定时间一样播放。对此的解决方案是通过用户登录添加触发
的后台任务,该任务将删除旧通知。但我不确定先发生什么。是否会显示通知然后显示后台任务或后台任务是否优先?

Another related question, also since the expiration time isn't available, I need the toast notification to play the sound only on the time it was scheduled to show (or within a specified time) if it's later than that it either show a silent or ghost notification or not show it at all. Again with an expiration time that would work by setting the expiration time to what is needed and either adding another ghost notification after that or just not adding anything. Since there is no expiration time for scheduled notifications if the user shutdown the machine before a schedule and turn it back on 30 minutes after the scheduled time the notification would appear and the audio will play as if this was the scheduled time. A solution for this would be to add a background task triggered by user login that would delete old notifications. But I'm not sure what would start first. Would the notifications appear and then the background tasks or would the background tasks be given priority?

谢谢,

Khaled

Thanks,
Khaled

推荐答案

嘿哈立德!我们实际上是在下一版本的Windows 10中将过期时间属性添加到 ScheduledToastNotification
!因此,将来你可以像普通的
ToastNotificatio 那样使用它。

Hey Khaled! We're actually adding the expiration time property to ScheduledToastNotification in the next release of Windows 10! So in the future you'll be able to utilize it just like you can on the normal ToastNotification.

但同时,对于您的方案,您应该只能在通知上设置相同的标记/组,然后较新的只会替换当前的标记/组。

But in the meantime, for your scenario, you should be able to simply set the same tag/group on the notifications, and then the newer ones will simply replace the current ones.

您说你试过这个,但是出于某种原因你将 SuppressPopup 设置为true?你不应该这样做,因为它听起来你想要它弹出(和播放音频)。

You said you tried this, but you set SuppressPopup to true for some reason? You shouldn't do this, since it sounds like you want it to pop up (and play the audio).

你提到能够使用 ToastNotificationHistory删除通知的。对于预定和正常的吐司,您也可以这样做。请注意,如果通知尚未显示,则必须使用
RemoveFromSchedul e方法,就像添加到计划中一样。但是一旦吐司出现了,你就把它从历史中删除了。

You mentioned being able to remove the notification by using ToastNotificationHistory. You can do that too, for both scheduled and normal toasts. Note that if the notification hasn't appeared yet, you have to use the RemoveFromSchedule methods just like how you add to the schedule. But then once the toast has appeared, you remove it from the History.

对于你的最后一个问题......如果机器关闭并且错过预定的间隔超过5分钟,预定的通知将被删除。因此,如果计划在晚上9:30关闭,但是用户在9:45
PM之前没有打开机器,那么它将被丢弃。但如果他们在晚上9点34分开机,它就会出现。至于在此之前使用后台任务运行,后台任务在通知发送之前执行的可能性很小。

For your final question... If the machine is turned off and misses the scheduled interval by more than 5 minutes, the scheduled notification will be dropped. So if it was scheduled to go off at 9:30 PM, but the user doesn't turn their machine on till 9:45 PM, then it'll be dropped. But if they turned the machine on at 9:34 PM, it'll appear. As for using a background task to run before this happens, it's very unlikely the background task would execute before the notification gets delivered.


这篇关于预定的Toast通知到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆