Created
February 5, 2018 05:29
-
-
Save ridomin/0f40c4f160a4f82b5b59d3589a632852 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.Toolkit.Uwp.Notifications; | |
| using Windows.UI.Notifications; | |
| using Windows.Data.Xml.Dom; | |
| namespace WpfAdoNetClient | |
| { | |
| public class Notifications | |
| { | |
| public static void Show() | |
| { | |
| ToastTemplateType toastTemplate = ToastTemplateType.ToastText02; | |
| XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate); | |
| XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text"); | |
| toastTextElements[0].AppendChild(toastXml.CreateTextNode("My notification from WPF")); | |
| toastTextElements[1].AppendChild(toastXml.CreateTextNode(DateTime.Now.ToString())); | |
| ToastNotification toast = new ToastNotification(toastXml); | |
| ToastNotificationManager.CreateToastNotifier().Show(toast); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment