wp7上启动器使用方法
启动器类似于android 里头的Intent封装类。通过设定其参数实现跳转不同页面并将参数带进目标页面中,下面介绍8种启动器:
1. BING搜索启动器
SearchTask searchTask = new SearchTask();
searchTask.SearchQuery = "sxc";
searchTask.Show();
2. 拨号启动器
PhoneCallTask phoneTask = new PhoneCallTask();
phoneTask.DisplayName = "pang"; //显示名称
phoneTask.PhoneNumber = "12345"; //电话号码
phoneTask.Show();
3.短信发送启动器
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.Body = "哈哈。我用了短信启动器了哦"; //主题
smsComposeTask.To = "123566"; //地点
smsComposeTask.Show();
4.Email发送启动器
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = "这是 subject";
emailComposeTask.Body = "这是body";
emailComposeTask.To = "sxchao2009@163.com";
emailComposeTask.Cc = "sxchao2008@gmail.com"; 这是抄送.收到邮件的人:抄送对象+目标对象
emailComposeTask.Show();
5.marketplace hub启动器,直接跳转到zune商店或者marketplace application列表,仅仅是跳到该页面。
MarketplaceHubTask marketplaceHub = new MarketplaceHubTask();
marketplaceHub.ContentType = MarketplaceContentType.Music; 或者MarketplaceContentType.Application
marketplaceHub.Show();
6. 跳转到marketplace某个应用的详细介绍。 其中ContentIdentifier 属性为程序唯一标识号,搜索类型为app(包含游戏和application)
MarketplaceDetailTask detail = new MarketplaceDetailTask();
detail.ContentIdentifier = "程序唯一标识号";
detail.ContentType = MarketplaceContentType.Applications;
detail.Show();
7.MarketplaceReview 貌似是 marketplace商城的预览?木有属性。只有show()方法
MarketplaceReviewTask review = new MarketplaceReviewTask();
review.Show();
8. marketplace市场搜索启动器 。 关键字属性为:searchTerms。 类型为 MarketplaceContentType.Applications。该属性包含游戏和应用。
MarketplaceSearchTask search = new MarketplaceSearchTask();
search.ContentType = MarketplaceContentType.Applications;
search.SearchTerms = "plants";
search.Show();
9. MediaPlayerLauncher 用于播放视频或者音乐
mediaPlayerLauncher.Controls = MediaPlaybackControls.All; //显示所以控件
mediaPlayerLauncher.Location = MediaLocationType.Install; //资源文件存放在安装目录下。
mediaPlayerLauncher.Media = new Uri("2.wmv", UriKind.Relative); //取相对地址
mediaPlayerLauncher.Show();