DisplayToast

void DisplayToast(string dispalydata)
        {
            ToastTemplateType templateType = ToastTemplateType.ToastText01;
            // GetTemplateContent returns a Windows.Data.Xml.Dom.XmlDocument object containing
            // the toast XML
            XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(templateType);

            // You can use the methods from the XML document to specify all of the
            // required parameters for the toast
            XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
            for (uint i = 0; i < stringElements.Length; i++)
            {
                stringElements.Item(i).AppendChild(toastXml.CreateTextNode(dispalydata));
            }

            //Scenario1OutputText.Text = toastXml.GetXml();

            // Create a toast from the Xml, then create a ToastNotifier object to show
            // the toast
            ToastNotification toast = new ToastNotification(toastXml);

            // If you have other applications in your package, you can specify the AppId of
            // the app to create a ToastNotifier for that application
            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }

你可能感兴趣的:(DisplayToast)