c# - 如何在通用 Windows 中更新通知

标签 c# notifications windows-10 uwp

我一直在尝试弄清楚如何在显示 ToastNotification 后对其进行操作,但似乎它的 XML 已修复。如果 ToastNotification 不是合适的工具,那么什么才是合适的工具呢?

我正在尝试在通知中更新计时器,例如就像播放歌曲的进度...

最佳答案

Toast 通知并不是适合您的用例的正确解决方案。
让我们从 Guidelines for toast notifications 开始。 Microsoft 建议对 Toast 通知执行以下操作(摘录该问题的要点):

  • Hide notifications if they are no longer valid. For example, hide a toast about an incoming call if the other party has hung up or the user has already answered on another device. Note that you can only hide notifications when your app is running.

在您的用例中,一旦百分比发生变化,旧信息将不再有效。您应该隐藏这些通知。
另一方面,我们有这样的观点:

  • Don't hide toast notifications unless absolutely necessary.

用户应该能够处理现有的 toast 通知。您的应用不应该处理现有通知的清理!

  • Don't notify the user of something they didn't ask to be notified about. For instance, don't assume that all users want to be notified each time one of their contacts appears online.

请记住,发送新通知将始终弹出一个新窗口。大多数用户可能会在短时间内感到恼火。让您的用户可以选择加入此通知,以及选择哪个级别(开始和结束,每 10% 更新一次,每 5% 更新一次,仅结束):

  • Don't use toast notifications for anything with a high volume of notifications, such as stock price information.

给用户高更新率会让他更加恼火。

最后但并非最不重要的一点是,提供替代方案:

  • Provide alternate ways for users to get the info provided in a toast if it's important. For example, you may want to display related information on your app's live tile or within your app.

让我们继续 Guidelines for tiles and badges 。微软也在这里提出了一些建议。但看看最关键的可能会有所帮助:

How often should your tile update?

If you choose to use a live tile, consider how often the tile should be updated.

For personalized content, such as message counts or whose turn it is in a game, we recommend that you update the tile as the information becomes available, particularly if the user would notice that the tile content was lagging, incorrect, or missing. For nonpersonalized content, such as weather updates, we recommend that the tile be updated no more than once every 30 minutes. This allows your tile to feel up-to-date without overwhelming your user.

对于用例的实时更新来说,这 30 分钟的时间范围太长了。

恕我直言:上传完成歌曲完成等使用不可变的Toast通知。但让用户可以选择加入此通知功能。
对于实时更新(实际百分比),您的用户应该在您的应用内并在那里接收更新。

关于c# - 如何在通用 Windows 中更新通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33621093/

相关文章:

c# - 将数据列中的数据从一个 DataTable 复制到另一个

c# - EntityFramework LINQ 字符串顺序比较

Android:折叠通知中的额外间距

android - 更新通知振动/铃声

android - 确定 Android 通知的 addAction 点击

UWP Frame.GoBack 带参数

python-3.x - 无法从主机访问 dockerized 应用程序上的 API

c# - 是否有一种转换方法接受一个字符并生成一个 ConsoleKey?

c# - 为过滤器的多个条件创建动态 linq 表达式 OData 包含?

java - 当我尝试保存测试计划时,为什么会收到 NoClassDefFound 错误?