Phone Tasks in Mango

In this blog post I will have a closer look at different Phone Tasks and their uses. All those tasks can be found in the Microsoft.Phone.Tasks namespace.

Each Task class has a method called “Show()” which is responsible for executing the task.

For the AddressChooserTask I created a new project with a button and a click event. In the click event handler I add the following:

Running the application gives me that result:

When I click my button the application shows me a list of my contacts.

Let’s have a look at another task, the CameraCaptureTask: Same application, just a different button and a different click event:

Obviously testing the CameraCaptureTask on the emulator is not as satisfying as testing it on a real device. Running it in the emulator will show a moving box across the screen edges. To take the snap simply click the Capture button:

Now I am going to look at the EmailAddressChooserTask:

Running this looks quite similar to the AddressChooserTask:

So far no rocket science. Now let’s take a look at the EmailComposeTask. This task will create the email composer UI. You can set different options like ‘To’, ‘CC’, ‘BCC’, Subject or Body of the email. The code in the click event handler looks like this:

Of course the emulator itself does not have an email box, so the result I get when running this looks like this:

The PhoneCallTask:

Of course you can also just pick a number with the PhoneNumberChooserTask:

The next task I am showing is the PhotoChooserTask:

Running in the emulator gives this result:

Let’s have a look at the SearchTask:

The last task I want to look at is the WebBrowserTask:

This will launch the browser with the mentioned URL:

For this blog post I just randomly picked some Tasks that I think are the most used ones.

Here you can find an overview of all tasks that are available.

 

To be continued…

 

Advertisements
  1. No trackbacks yet.

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: