NotificationsExtensions.Toasts.ToastContent.GetXml C# (CSharp) Method

GetXml() public method

Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local toast notification's constructor on either Windows.UI.Notifications.ToastNotification or Windows.UI.Notifications.ScheduledToastNotification.
public GetXml ( ) : XmlDocument
return Windows.Data.Xml.Dom.XmlDocument
        public XmlDocument GetXml()
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(GetContent());

            return doc;
        }

Usage Example

Example #1
0
        public static void Simple(string textline1, string title = "HFR10")
        {
            var content = new ToastContent();
            content.Visual = new ToastVisual()
            {
                TitleText = new ToastText()
                {
                    Text = title,
                },
                BodyTextLine1 = new ToastText()
                {
                    Text = textline1,
                }
            };
            content.Audio = new ToastAudio()
            {
                Src = new Uri("ms-winsoundevent:Notification.IM")
            };

            XmlDocument doc = content.GetXml();

            // Generate WinRT notification
            var toast = new ToastNotification(doc);
            toast.ExpirationTime = DateTimeOffset.Now.AddSeconds(30);
            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
All Usage Examples Of NotificationsExtensions.Toasts.ToastContent::GetXml