locked
How to get the list of Scheduled Toast Notifications from toast notification manager

    Question

  • I am working for create reminder in my application.

    I created the reminder and toast notification also showed.

    And I want to show the total list of created toast notification. I got the list of created notification. 

    Now the problem is I want get the text which i saved in template. I tired to use xml. But I cannot.

    Give me any solution.

    Wednesday, October 15, 2014 10:25 AM

Answers

  • I guess you have to stick to the list. Otherwise the Toast does not know how to display (you can only deliver the content, not the look and feel).

    If you don't like to create the content XML directly, then you can add a reference to the NotificationExtensions.  This library adds a real API around the templates.


    • Edited by Diederik KrolsMVP Wednesday, October 15, 2014 12:00 PM
    • Marked as answer by Shaafs Wednesday, October 15, 2014 12:39 PM
    Wednesday, October 15, 2014 11:58 AM

All replies

  • I assume that you got the list of toasts by calling ToastNotifier.GetScheduledToastNotifications. This returns a list of ScheduledToastNotification instances. Their Content property contains the whole XML.

    You can query that XML e.g. using SelectSingleNode and an XPATH expression. The following two queries return the title and the content text of a toast:

    var firstText = toast.Content.SelectSingleNode("//text[@id=1]").InnerText;
    var secondText = toast.Content.SelectSingleNode("//text[@id=2]").InnerText;

    Of course the exact XPATH expression depends on the template you used.

    • Marked as answer by Shaafs Wednesday, October 15, 2014 11:01 AM
    • Unmarked as answer by Shaafs Wednesday, October 15, 2014 11:33 AM
    Wednesday, October 15, 2014 10:56 AM
  • Thanks Diederik.

    Can i create my own template instead of "ToastTemplateType.ToastImageAndText04".

    Wednesday, October 15, 2014 11:03 AM
  • I guess you have to stick to the list. Otherwise the Toast does not know how to display (you can only deliver the content, not the look and feel).

    If you don't like to create the content XML directly, then you can add a reference to the NotificationExtensions.  This library adds a real API around the templates.


    • Edited by Diederik KrolsMVP Wednesday, October 15, 2014 12:00 PM
    • Marked as answer by Shaafs Wednesday, October 15, 2014 12:39 PM
    Wednesday, October 15, 2014 11:58 AM
  • thanks Diederik Krols.

    I got it.

    Wednesday, October 15, 2014 12:40 PM