Windows store apps 为什么没有显示祝酒词?
在windows 8.1应用程序中,我尝试使用以下代码发出toast通知:Windows store apps 为什么没有显示祝酒词?,windows-store-apps,windows-applications,win-universal-app,windows-store,Windows Store Apps,Windows Applications,Win Universal App,Windows Store,在windows 8.1应用程序中,我尝试使用以下代码发出toast通知: public class ToastController { #region Public Methods and Operators /// <summary> /// The show. /// </summary> /// <param name="message"> /// The message. /// </p
public class ToastController
{
#region Public Methods and Operators
/// <summary>
/// The show.
/// </summary>
/// <param name="message">
/// The message.
/// </param>
public void Show(string message)
{
// A single string wrapped across three lines of text.
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);
toastXml.GetElementsByTagName("text").First().InnerText = message;
var toast = new ToastNotification(toastXml);
ToastNotifier notifier = ToastNotificationManager.CreateToastNotifier();
notifier.Show(toast);
}
#endregion
}
公共类ToastController
{
#区域公共方法和运算符
///
///表演。
///
///
///信息。
///
公共无效显示(字符串消息)
{
//环绕在三行文本上的单个字符串。
XmlDocument toastXml=ToastNotificationManager.GetTemplateContent(ToastTemplateType.toAssemmage和text01);
toastXml.GetElementsByTagName(“text”).First().InnerText=消息;
var toast=新ToastNotification(toastXml);
ToastNotifier notifier=ToastNotificationManager.CreateToastNotifier();
通知者。显示(土司);
}
#端区
}
但是调用Show()
方法时,我根本看不到任何toast消息。我遗漏了什么吗
更新:我已经能够在使用
本地计算机调试windows应用程序时显示toast消息。但是,在模拟器
中启动时,toast消息仍不显示。请帮忙
我需要设置我的应用程序以启用toast通知:
<VisualElements
...
ToastCapable="true">
</VisualElements>