Book Image

Windows Phone 7 Silverlight Cookbook

By : Jonathan Marbutt, Robb Schiefer
Book Image

Windows Phone 7 Silverlight Cookbook

By: Jonathan Marbutt, Robb Schiefer

Overview of this book

Silverlight has revolutionized development using Microsoft technologies. It is an excellent tool for mobile application development. The XAML-based markup and familiar C# code are the perfect combination for building apps efficiently and with minimum hassle.Packed full of recipes containing comprehensive instructions for the tasks required to build modern compelling smartphone apps using Silverlight.Starting with application design and architecture, you will quickly move on to more technical features and APIs you can implement to make your app stand out. You will use the Camera API to scan barcode, location services to pinpoint the user’s GPS coordinates and accelerometer to provide feedback based on movement of the phone. All of these features can be provided in a slick user interface through the power of Silverlight. Animations, behaviors and XAML provide all you need and more.
Table of Contents (18 chapters)
Windows Phone 7 Silverlight Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a notifications helper


A notification helper can help to reduce the duplication involved with making different types of push notifications. As discussed, there are three types of push notifications you send: tile, toast, and raw. Each sends a binary payload to the Microsoft servers with some similar attributes. We will create a simple helper to abstract the calls and reduce duplication.

Getting ready

Create a folder named Framework in the SurfTileNotifications.Service project and a new class in the folder named Wp7NotificationsHelper. We will start by creating an enumeration of the push types called NotificationType:

public enumNotificationType
{
Tile,
Toast,
Raw
}

Notifications also have a batch interval value which determines the immediacy of the notification. This value is different for each notification type:

 

Immediate (0 milliseconds)

Delayed (7.5 minutes)

Delayed (15 minutes)

Tile

01

11

21

Toast

02

12

22

Raw

03

13

23

You can see that there is a pattern to the...