The launchers and choosers framework enables Windows Phone applications to provide a set of common tasks to their users, such as placing phone calls, sending email, and taking pictures.
The Windows Phone application model isolates every application in its own sandbox, both for execution (including memory isolation) and file storage. Applications are not able to directly access common stores of information, such as the contacts list, to directly invoke other applications, such as the phone or messaging. To enable scenarios that require common tasks such as these, Windows Phone exposes a set of launcher and chooser APIs that allow applications indirect access to these useful phone features. The launcher and chooser APIs invoke distinct built-in applications that replace the currently running application. When implemented correctly, the launchers and choosers framework can provide the end user with a seamless experience in which it is not apparent that they are switching between applications.
You can think of a:
- Launcher as a “fire and forget” action, where you launch a specific functionality of Windows Phone such as sending SMS, opening a Web page, or placing a phone call.
- Chooser as an “open file dialog” action, where you want to choose some piece of information from the phone and drive it back to your application, for example, pick an email address or contact, or choose a picture.
The following is the complete list of choosers and launchers that Windows Phone 7 supports:
Launchers
- EmailComposeTask - Allows an application to launch the email application with a new message displayed; use this to allow users to send email from your application
- MarketplaceDetailTask - Allows an application to launch the Windows Phone Marketplace client application and display the details page for the specified product.
- MarketplaceHubTask - Allows an application to launch the Windows Phone Marketplace client application.
- MarketplaceReviewTask - Allows an application to launch the Windows Phone Marketplace client application and display the review page for the specified product.
- MarketplaceSearchTask - Allows an application to launch the Windows Phone Marketplace client application and display the search results from the specified search terms.
- MediaPlayerLauncher - Allows an application to launch the media player
- PhoneCallTask - Allows an application to launch the Phone application; use this to allow users to make a phone call from your application
- SaveEmailAddressTask - Allows an application to launch the contacts application; use this to allow users to save an email address from your application to a new or existing contact
- SavePhoneNumberTask - Allows an application to launch the contacts application; use this to allow users to save a phone number from your application to a new or existing contact
- SearchTask - Allows an application to launch the Web Search application
- SmsComposeTask – Allows and application to launch the SMS application
- WebBrowserTask - Allows an application to launch the Web Browser application
Choosers
- EmailAddressChooserTask - Allows an application to launch the Contacts application; use this to obtain the email address of a contact selected by the user
- CaptureCameraTask - Allows an application to launch the Camera application; use this to allow users to take a photo from your application
- PhoneNumberChooserTask - Allows an application to launch the Contacts application; use this to obtain the phone number of a contact selected by the user
- PhotoChooserTask - Allows an application to launch the Photo Chooser application; use this to allow users to select a photo
Note: |
|---|
| Please note, that throughout this lab you will handle some of the choosers and launchers that Windows Phone has to offer. For this Beta release, the Windows Phone Emulator doesn’t expose the full functionality of the phone, and therefore some of the launcher and chooser experiences are not complete. |
Objectives
At the end of the lab you will:
- Be familiar with the choosers and launchers concept as implemented in the Windows Phone 7 application model
- Understand how and when to use launchers and choosers
- Have created a Silverlight application that uses choosers and launchers to store contact information and use it to send SMS, perform a Web search, and browse the Internet
Prerequisites
The following is required to complete this hands-on lab:
- Microsoft Visual Studio 2010 Express for Windows Phone for Windows Phone or Microsoft Visual Studio 2010
- Windows Phone Developer Tools
Note:All of these Tools can be downloaded together in a single package from http://developer.windowsphone.com
Setup
For convenience, much of the code used in this hands-on lab is available as Visual Studio code snippets. To install the code snippets:
- Run the .vsi installer located in the lab's Source\Setup folder.
Note:If you have issues running the code snippets installer you can install the code snippets manually by copying all the .snippet files located in the Source\Setup\CodeSnippets folder of the lab to the following folder: My Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets
Using the Code Snippets
With code snippets, you have all the code you need at your fingertips. The lab document will tell you exactly when you can use them. For example,

Figure 1 Using Visual Studio code snippets to insert code into your project
To add this code snippet in Visual Studio, you simply place the cursor where you would like the code to be inserted, start typing the snippet name (without spaces or hyphens), watch as IntelliSense picks up the snippet name, and then press the Tab key twice when the snippet you want is selected. The code will be inserted at the cursor location.

Figure 2 1. Start typing the snippet name

Figure 3 2. Press Tab to select the highlighted snippet

Figure 4 3. Press Tab again to expand the snippet
To insert a code snippet using the mouse rather than the keyboard, right-click where you want to insert the code snippet, select Insert Snippet followed by My Code Snippets and then select the relevant snippet from the list.
To learn more about Visual Studio IntelliSense Code Snippets, including how to create your own, see http://msdn.microsoft.com/en-us/library/ms165392.aspx.
Exercises
This hands-on lab comprises the following exercises:
- Introduction to the Windows Phone Launchers
- Introduction to the Windows Phone Choosers
Estimated time to complete this lab: 45 minutes.