簡體   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