上篇Windows Phone开发经验谈(11)-10种选择器详细介绍我详细介绍了10种选择器的使用方法,那么启动器是什么呢?其实很好理解启动器就是选择器少了返回值。它不会返回结果给程序本身,接下来我详细介绍下各个启动器的用法。
目前WindowsPhone启动器一共有15个:
在SDK7.0的时候支持下面10个
EmailComposeTask :调用手机绑定邮箱发送邮件
MarketplaceDetailTask :打开市场上导航到具体的软件(一般用于软件推荐)
MarketplaceHubTask :导航到Marketplace,Application或者Music。
MarketplaceReviewTask :导航到应用本身的应用评分界面(会提高自己软件的评分哦)
MarketplaceSearchTask :市场搜索功能(可以用于找自己名字制作的软件)
MediaPlayerLauncher :调用手机播放器来播放音乐、视频。
PhoneCallTask :拨打电话
SearchTask :调用bing搜索
SmsComposeTask:发送短信
WebBrowserTask :打开浏览器浏览某网址
但是到了SDK7.5又添加了5个,我们学习总是跟不上微软更新的步伐
BingMapsDirectionsTask :一个基于bing地图的路径导航,属性有两个(起点和终点),值类型为LabeledMapLocation
BingMapsTask :bing地图调用,你可以设置地图的中间点、缩放级别或者领用bing地图搜索
ConnectionSettingsTask :快速导航到WP的网络设置(包括WIFI、数据连接、蓝牙和飞行模式)
ShareLinkTask :调用你绑定的账户(Live、Facebook、Twitter)分享消息
ShareStatusTask :分享状态,其实和上面ShareLinkTask类似
1、EmailComposeTask
EmailComposeTask emailComposeTask = new EmailComposeTask();//标题 emailComposeTask.Subject = "message subject";emailComposeTask.Body = "message body";//正文 emailComposeTask.To = "recipient@example.com";//收件人 emailComposeTask.Cc = "cc@example.com";//抄送 emailComposeTask.Bcc = "bcc@example.com";//密送 emailComposeTask.Show();
2、MarketplaceDetailTask
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask(); marketplaceDetailTask.ContentIdentifier = "384ba16d-d30f-44a5-9a8e-e395eea269df"; marketplaceDetailTask.Show();
3、MarketplaceHubTask
MarketplaceHubTask marketplaceHubTask = new MarketplaceHubTask(); marketplaceHubTask.ContentType = MarketplaceContentType.Music; //marketplaceHubTask.ContentType = MarketplaceContentType.Applications; marketplaceHubTask.Show();
4、MarketplaceReviewTask
MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask(); marketplaceReviewTask.Show();
5、MarketplaceSearchTask
MarketplaceSearchTask marketplaceSearchTask = new MarketplaceSearchTask(); //marketplaceSearchTask.ContentType = MarketplaceContentType.Applications; marketplaceSearchTask.ContentType = MarketplaceContentType.Music; marketplaceSearchTask.SearchTerms = "be what you wanna be"; marketplaceSearchTask.Show();
6、MediaPlayerLauncher
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher(); //mediaPlayerLauncher.Media = new Uri("Trouble Is A Friend.mp3", UriKind.Relative);mediaPlayerLauncher.Media = new Uri("Wildlife.wmv", UriKind.Relative); mediaPlayerLauncher.Location = MediaLocationType.Install; mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop; mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Portrait; mediaPlayerLauncher.Show();
7、PhoneCallTask
PhoneCallTask phoneCallTask = new PhoneCallTask(); phoneCallTask.PhoneNumber = "13778765123"; phoneCallTask.DisplayName = "song"; phoneCallTask.Show();
8、SearchTask
SearchTask searchTask = new SearchTask(); searchTask.SearchQuery = "松"; searchTask.Show();
9、SmsComposeTask
SmsComposeTask smsComposeTask = new SmsComposeTask(); smsComposeTask.To = "13222222"; smsComposeTask.Body = "Try this new application. It's great!"; smsComposeTask.Show();
10、WebBrowserTask
WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.Uri = new Uri("http://cracker.cnblogs.com", UriKind.Absolute); webBrowserTask.Show();
11、BingMapsDirectionsTask
BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask(); GeoCoordinate spaceNeedleLocation = new GeoCoordinate(0,0); LabeledMapLocation spaceNeedleLML1 = new LabeledMapLocation("Somewhere", spaceNeedleLocation); LabeledMapLocation spaceNeedleLML2 = new LabeledMapLocation("fuzhou", null); bingMapsDirectionsTask.End = spaceNeedleLML2; bingMapsDirectionsTask.Start = spaceNeedleLML1; bingMapsDirectionsTask.Show();
12、BingMapsTask
BingMapsTask bingMapsTask = new BingMapsTask(); bingMapsTask.Center = new GeoCoordinate(47.6204,-122.3493); //bingMapsTask.SearchTerm = "fuzhou"; bingMapsTask.ZoomLevel = 50;bingMapsTask.Show();
13、ConnectionSettingsTask
ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; //connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.AirplaneMode; //connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth; //connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Cellular; connectionSettingsTask.Show();
14、ShareLinkTask
ShareLinkTask shareLinkTask = new ShareLinkTask(); shareLinkTask.Title = "豆浆咖啡"; shareLinkTask.LinkUri = new Uri("http://cracker.cnblogs.com", UriKind.Absolute); shareLinkTask.Message = "Here are some great code samples for Windows Phone."; shareLinkTask.Show();
15、ShareStatusTask
ShareStatusTask shareStatusTask = new ShareStatusTask(); shareStatusTask.Status = "I'm developing a Windows Phone application!"; shareStatusTask.Show();