Sunday, May 6, 2012

Windows-8 Toast Notifications

We usually use MessageBox Method to raise the notification to the user. This type of  notifications are Model window type .  But in windows-8 we notify the user about our application Status or Task progress using Toast  . this type of notification wont annoying the user from the current work they are doing. this will display period out time then automatically disappear ( like outlook, MSN messenger alerts).   Basically TOAST means its a small popup dialog window with some status message and Image and/or text.

The  Namespace Windows.UI.Notifications  contains classes that support this Toast.

In this blog I am going to show how to raise the Toast .  Here I am going to use the class called

ToastNotificationManager
Creates ToastNotifier objects that you use to raise toast notifications. This class also provides access to the XML content of the system-provided toast templates so that you can customize that content for use in your notifications.

Before start using this class we need to create a TOAST template, first we need to give permission to our application Toast capable to do that we need to make some changes on  Manifest file as shown below.

image

Next we need to Get Default Toast Template type XML and customize . Here are the list of available templates

image

Next Create the blank windows application and add the following method

image

 

Now call this above method and test it. When you run the application you will see two TOAST.   First Toast will appear immediately the second TOAST will appear after 10 seconds because second toast I have scheduled to show after 10 seconds.

image

 Nandri(thanks)

Sreenivasaragavan Ramadurai

No comments: