繁体   English   中英

C# Windows 10 Toast 通知

[英]C# Windows 10 Toast Notifications

我正在尝试在计时器超时后显示 Toast 通知。 该通知适用于我的其中一台 PC,但另一台无法显示。 我调试的时候没有报错。 我还尝试在“设置”>“通知”中设置一些内容,但在允许/不允许显示通知的应用程序列表中,我看不到我的应用程序。

这是我的通知类:

    class NewToastNotification
   {
      public NewToastNotification(string text)
      {
         string Toast = String.Format("<toast>"+
                                          "<visual>+" +
                                                "<binding template=\"ToastImageAndText04\">" +
                                                    "<text id = \"1\" >Toast Test </text>+" +
                                                    "<text id = \"2\" >{0}</text>+" +
                                                    "<text id = \"2\" >{1}</text>+" +
                                                "</binding>+" +
                                          "</visual>+" +
                                     "</toast>", text, DateTime.Now);

         var tileXml = new Windows.Data.Xml.Dom.XmlDocument();
         tileXml.LoadXml(Toast);
         var toast = new ToastNotification(tileXml);
         ToastNotificationManager.CreateToastNotifier("1").Show(toast);
      }
   }

ToastNotificationManager.CreateToastNotifier().Show(toast);

代替

ToastNotificationManager.CreateToastNotifier("1").Show(toast);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM