【发布时间】: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 消失并被放置在操作中心。
我是否缺少一个技巧来让它发挥作用?
【问题讨论】: