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();