Introduction

In this article we are going to see what Launchers are and what are the uses of Launcher in developing a Windows Phone 7 Application.

Launcher in Windows Phone 7 is an API used to launch some of the built in applications using which the user can select some task. Once the user selects the application, we can handle the task as per the convenient option to do some manipulations as per the task raised. Some of the example of using the launchers is triggering a contact application to select some contact information.

Launchers have some general steps to launch a particular application and steps are as follows

Let us see the list of Launchers available and the usage of each and every launcher tasks to get some clear idea on when to use each task to get a better performance.

Launchers Tasks

Let us take an example on how to use one of the task and we will see in depth in our upcoming articles one by one. Now let us create a Phone Call task and see how to launch the Phone application to make a call.

Steps

Open Visual Studio 2010 and create a new Silverlight for Windows Phone 7 Application with a valid project name as shown in the screen below.

1.png

Now let us add a button to invoke the PhoneCall Task and call a particular number, write the below code on the click event of the button as shown in the screen below. Also note that we need to add the below Using Directive in order to use the PhoneCall task (using Microsoft.Phone.Tasks; )

XAML Code

<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--<span class="hiddenSpellError" pre="">TitlePanel</span> contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="F5DEBUG WP7 TUTORIALS" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Launchers" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--<span class="hiddenSpellError" pre="">ContentPanel</span> - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Content="Call Karthik!!!" Height="182" HorizontalAlignment="Left" Margin="80,89,0,0" Name="button1" VerticalAlignment="Top" Width="292" Click="button1_Click" />
</Grid>
</
Grid>

Code Behind

private void button1_Click(object sender, RoutedEventArgs e)
{
PhoneCallTask pctask = new PhoneCallTask();
pctask.DisplayName = "Karthikeyan";
pctask.PhoneNumber = "+9196000000096";
pctask.Show();
}

2.png

Now we are done with the code, build and execute the project by pressing F5 and we can see the application opened in Windows Phone 7 Emulator as shown in the screens below.

o1.png

o2.png

o3.png

Conclusion

So in this article we have seen what Launchers are in Windows Phone 7 development and the list of Launchers available. Also we have seen a sample on What PhoneCallTask is and how to use it practically with the Windows Phone 7 application development.