Notification Toast Message Service - using DispatcherTimer

The toast notification control is built using the Popup control. The style/formatting of the control can be adjusted to suit your needs. The control is configured to be displayed at the bottom-right corner of your application.


It makes use of the DispatcherTimer to ping the WCF service for new messages periodically. The WCF service method generates messages with random numbers to demonstrate the arrival of new information.

  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class NotificationService : INotificationService
        public List GetNotifications()
            //sending some random messages
            return new List()
               new NotificationMessage(){Message= string.Format("There are {0} pending request/s in your queue.",new Random().Next(50))},
               new NotificationMessage(){Message=string.Format("There are {0} request/s awaiting your approval.",new Random().Next(10))}

 You can replace the above code with the actual logic required in your case.

The service returns a list of NotificationMessage objects which acts as the data context to the control.
    public class NotificationMessage
        public string Message{get;set;}

You can further extend the NotificationMessage class to include message type(warning, information, error), message priority etc.

I have attached the sample for your reference.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now