Launcher启动器:启动Windows Phone 7内置应用程序。启动器只是负责把相应的应用程序启动起来就可以了。
Lanucher 在使用时跟Chooser 相同,必须要注意应用程式生命周期;而Lanucher 主要的功能是呼叫Windows Phone 7 中其他的功能;例如说拨打电话、WebBrowser 等功能,使用Lanucher 时同样的,必须要引入Microsoft .Phone.Tasks 的命名空间,下面笔者列出Lanucher 的各项功能
包括以下几个:
EmailComposeTask: 启动发送Email的应用程序。
MediaPlayerLauncher: 启动MeidaPlayer应用程序。
PhoneCallTask: 启动打电话应用程序。
SearchTask: 启动搜索应用程序。
SmsComposeTask: 启动发短信应用程序。
WebBrowserTask: 启动IE。
MarketplaceDetailTask: 启动Marketplace客户端应用程序,并显示指定应用的详细信息。
MarketplaceHubTask: 启动Marketplace客户端应用程序。
MarketplaceReviewTask: 启动Marketplace客户端应用程序的审查页面。
MarketplaceSearchTask: 启动Marketplace客户端应用程序的搜索页面。
1、EmailComposeTask
EmailComposeTask 让您可以呼叫出系统预设的寄送Email 功能,并且在呼叫之前,能够设定收件人,邮件内容等讯息,例如笔者做了以下的介面,执行的时候会出现像右图这样的错误讯息,这是因为内建的开发用模拟器没有设定email 相关的帐号,因此无法做寄送email 的动作;不过不要紧,等有了实机之后就可以将应用程式部属到机器上做实际的测试的
而程式码的部分也是相当的简单,例如下面这样子
EmailComposeTask ect = new EmailComposeTask();
ect.To = txtEmailAddress.Text;
ect.Subject = txtSubject.Text;
ect.Body = txtMailBody.Text;
ect.Show();

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel 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="Lanucher Demo" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="EmailCompose" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<ScrollViewer Grid.Row="1">
<StackPanel x:Name="ContentPanel" >
<TextBlock Margin="3,1,1,1" Height="33" x:Name="textBlock1" Text="收件人郵件地址" />
<TextBox x:Name="txtEmailAddress" Height="69" TextWrapping="Wrap" Text="TextBox" />
<TextBlock Margin="3,1,1,1" Height="33" Name="textBlock2" Text="郵件主旨" />
<TextBox Height="69" Name="txtSubject" Text="TextBox" TextWrapping="Wrap"/>
<TextBlock Margin="3,1,1,1" Height="33" Name="textBlock3" Text="郵件內容" />
<TextBox Height="274" Name="txtMailBody" Text="TextBox" TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
<!--ContentPanel - place additional content here-->
</Grid>
<!--Sample code showing usage of ApplicationBar-->
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar.check.rest.png" Text="OK" x:Name="btnOK" Click="btnOK_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/appbar.cancel.rest.png" Text="Cancel" x:Name="btnCancel" />
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
namespace LanucherDemo
{
public partial class EmailCompose : PhoneApplicationPage
{
public EmailCompose()
{
InitializeComponent();
txtEmailAddress.InputScope = new InputScope
{
Names = {new InputScopeName() { NameValue = InputScopeNameValue.EmailNameOrAddress }}
};
}
private void btnOK_Click(object sender, EventArgs e)
{
EmailComposeTask ect = new EmailComposeTask();
ect.To = txtEmailAddress.Text;
ect.Subject = txtSubject.Text;
ect.Body = txtMailBody.Text;
ect.Show();
}
}
}