Display local toast notification

后端 未结 2 1423
有刺的猬
有刺的猬 2021-02-04 11:52

I want to develop a universal app for Windows Phone 8.1 which contains a local “Notification”.

What I want to do is to show all messages to the user (error, information,

2条回答
  •  一个人的身影
    2021-02-04 12:46

    You could use a local notification that appears when your app is running.

    ToastTemplateType toastTemplateXml = ToastTemplateType.ToastImageAndText01; 
    XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplateXml);
    

    You'll then need to populate the XML returned by GetTemplateContent

    
        
            
                
                
            
        
    
    

    Supply the content of your toast in the XML DOM. The image is relevant only for Windows 8.1.

    Specify it's launch parameters

    ((XmlElement)toastNode).SetAttribute("launch", "{\"type\":\"toast\",\"param1\":\"1\",\"param2\":\"2\"}");
    

    Create the toast object:

    ToastNotification toast = new ToastNotification(toastXml);
    

    and finally display the toast.

    ToastNotificationManager.CreateToastNotifier().Show(toast);
    

    Also, If you want to use a third party control to display the toast then you could consider writing a Windows Phone 8.1 Silverlight app.

提交回复
热议问题