【问题标题】:Toast Reminder on C# Windows 10 Desktop App Not Persisting?C# Windows 10 桌面应用程序上的 Toast 提醒不持久?
【发布时间】:2017-01-24 19:11:47
【问题描述】:

我一直在尝试在 Windows 10 桌面应用程序的 toast 上使用场景属性的“提醒”值,但无法让 toast 在桌面上持续存在。

使用 github 上的 desktop toast sample,我尝试使用以下内容将属性和值添加到 toastXml(大约第 116 行):

        IXmlNode toastBase = toastXml.SelectSingleNode("toast");
        XmlAttribute scenarioAttrib = toastXml.CreateAttribute("scenario");
        scenarioAttrib.Value = "reminder";
        toastBase.Attributes.SetNamedItem(scenarioAttrib);

这似乎按预期工作,因为将 toastXml 写入字符串给了我:

        <toast scenario="reminder"><visual><binding template="ToastImageAndText04"><image id="1" src="file:///X:/Users/.../Desktop/CS/bin/Debug/toastImageAndText.png"/><text id="1">Line 0</text><text id="2">Line 1</text><text id="3">Line 2</text></binding></visual></toast>

但是,在 7 秒左右的超时后,桌面上的 toast 消失并被放置在操作中心。

我是否缺少一个技巧来让它发挥作用?

【问题讨论】:

    标签: c# toast


    【解决方案1】:

    我知道这个请求很古老,但你需要一个“动作”来让 Windows 将提醒视为提醒。

    https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/adaptive-interactive-toasts#alarms-reminders-and-incoming-calls

    【讨论】:

      猜你喜欢
      • 2015-04-20
      • 2015-12-23
      • 2017-02-06
      • 1970-01-01
      • 1970-01-01
      • 2012-04-18
      • 2014-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多