Adding Multitasking to Your Application

Version: 1.0.0

Description

The Windows Phone codenamed "Mango" release introduces agents that let applications run tasks in the background periodically or when the phone is idle. Mango also introduces APIs to manipulate the tiles in the start menu locally without requiring push notifications. This hands-on-lab will show you how to add a Background Service Agent to your application and use this agent to update the secondary tiles for task management application where tiles display a count of overdue tasks.

Overview

The original Windows® Phone developer tools did not allow your applications to perform operations while inactive. This limited the range of experiences you could deliver in your application. Windows Phone Codenamed Mango allows your application to perform operations even while inactive by using background agents. Background agents are created by adding a new type of project to your application’s solution in order to contain the agent’s logic. Your application can then register the background agent with the operating system and have it schedule the agent to run while your application is dormant. This effectively allows for multitasking in applications you develop using Windows Phone Codenamed Mango. In addition, Windows Phone Codenamed Mango allows an application to pin multiple tiles associated with it, all of which lead to different locations inside the application when tapped.

This lab uses the “Tidy” application to demonstrate these new features by going through the necessary steps for implementing and registering a background agent on behalf of your application. We will use a background agent in order to update the application’s tiles while it is not active.

Objectives

This lab provides instructions to help you achieve the following:

  • Understand how to pin multiple application tiles to the start area
  • Understand how to manage an application’s pinned tiles
  • Implement a background agent in your application

Prerequisites

The following prerequisites will ensure that you gain the most you can from this hands-on lab:

  • Microsoft Visual Studio 2010 or Microsoft Visual C# Express 2010, and the Windows® Phone Developer Tools available at https://go.microsoft.com/?linkid=9772716
  • Knowledge on how to create applications for Windows Phone 7

Lab Structure

This lab contains a single exercise with the following tasks:

  1. Pinning project tiles to the start area and managing a project’s pinned tiles
  2. Creating a new background agent project, adding the agent’s logic and exposing the background agent through your application

Estimated completion time

Completing this lab should take between 30 and 50 minutes.