Notifications & Metro Style apps in Windows8 : Local Toast

As explained in the previous post about notifications in Windows8, notifications can be local or from the Cloud ( push ) .

In this post, we will be discussing the local notifications.

Start a new project

       Visual Studio 11 Developer Preview –> New Project –> JavaScript –> Blank Application

open

Define the notification

      In the ‘js’ folder, let’s add a new item: a javascript file called toast.

js folder

      You should first choose a template for your toast, you can refer to Toast Template Type.

      Back to the toast.js where we will write the following code :

toast code

“This example uses the ToastImageAndText01 template, which consists of a large image with, to its right, a single string wrapped across three lines of text.

To specify the content, we retrieve the collection of text elements then enumerates through that collection, assigning a string to each of those elements . It then retrieves the image element and assigns it an image and alt text.” Windows dev center – Metro Style apps

See the toast in action

    We need to let the application send the toast.

    In the ‘ default.html’ file, add a reference to the toast script :

    script

 

Voila ! Quick and easy Sourire

Advertisements

About rabeb

Rabeb is a software engineer , fan of the latest .Net technologies, playing with Metro style applications for Win8 at work . In her spare time,she plays with Metro Style apps for Windows Phone.

Posted on December 18, 2011, in Metro Style, Notifications, Windows 8 and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: