WP7 Launcher 启动器
2012-04-11 23:42
260 查看
在WindowsPhone中需要调用系统资源的话需要用到启动器(Launcher)和选择器(Choosers)。
其实已经很多人写过了,最近正好用到,再总结下吧…
先写启动器(Launcher),等下周有时间再写选择器(Choosers)。
1,Launchers
其中7.0支持的有10个:
EmailComposeTask
MarketplaceDetailTask
MarketplaceHubTask
MarketplaceReviewTask
MarketplaceSearchTask
MediaPlayerLauncher
PhoneCallTask
SearchTask
SmsComposeTask
WebBrowserTask
7.1新增了5个:
BingMa
BingMa
ConnectionSettingsTask
ShareLinkTask
ShareStatusTask
2,BingMapsDirectionsTask
BingMaName | Description | |
---|---|---|
End | Theendinglocationforwhichdrivingdirectionsaredisplayed. | |
Start | Thestartinglocationforwhichdrivingdirectionsaredisplayed. |
BingMapsDirectionsTaskbingMa psDirectionsTask=newBingMa psDirectionsTask(); GeoCoordinatespaceNeedleLocation=newGeoCoordinate(0,0); LabeledMapLocationspaceNeedleLML1=newLabeledMapLocation("Somewhere",spaceNeedleLocation); LabeledMapLocationspaceNeedleLML2=newLabeledMapLocation("qingdao",null); bingMa psDirectionsTask.End=spaceNeedleLML2; bingMa psDirectionsTask.Start=spaceNeedleLML1; bingMa psDirectionsTask.Show();
其中LabeledMapLocation的第二个参数为地理坐标,如果为NULL的话,bing地图会根据第一个参数的字符串进行搜索
另外如果不设置bingMa
效果:
最后,bingmap在米国貌似不错,天朝比较坑爹…路径导航基本没戏….
还有手机区域语言选中国,基本不工作,选英国、米国都正常…
3,BingMapsTask
BingMaName | Description | |
---|---|---|
Center | Getsorsetsthelocationthatwillbeusedasthecenterpointforthemap. | |
SearchTerm | Getsorsetsthesearchtermthatisusedtofindandtaglocationsonthemap. | |
ZoomLevel | Getsorsetstheinitialzoomlevelofthemap. |
BingMapsTaskbingMa psTask=newBingMa psTask(); bingMa psTask.Center=newGeoCoordinate(47.6204,-122.3493); //bingMa psTask.SearchTerm="qingdao"; bingMa psTask.ZoomLevel=50; bingMa psTask.Show();
其中ZoomLevel是double型,而且必须大于0
效果:
4,ConnectionSettingsTask
ConnectionSettingsTask功能是快速导航到WP的网络设置(包括WIFI、数据连接、蓝牙和飞行模式)
Name | Description | |
---|---|---|
ConnectionSettingsType | Getsorsetsthetypeofnetworkconnectionsettingsthatwillbedisplayed. |
ConnectionSettingsTaskconnectionSettingsTask=newConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType=ConnectionSettingsType.WiFi; //connectionSettingsTask.ConnectionSettingsType=ConnectionSettingsType.AirplaneMode; //connectionSettingsTask.ConnectionSettingsType=ConnectionSettingsType.Bluetooth; //connectionSettingsTask.ConnectionSettingsType=ConnectionSettingsType.Cellular; connectionSettingsTask.Show();
效果就不加了,相当于快捷方式而已
5,EmailComposeTask
EmailComposeTask功能是调用绑定的邮箱发送邮件。Name | Description | |
---|---|---|
Bcc | GetsorsetstherecipientsontheBcclineofthenewemailmessage. | |
Body | Getsorsetsthebodyofthenewemailmessage. | |
Cc | GetsorsetstherecipientsontheCclineofthenewemailmessage. | |
CodePage | Getsorsetsthecharactersetthatwillbeusedtodisplaythemessagecontent. | |
Subject | Getsorsetsthesubjectofthenewemailmessage. | |
To | GetsorsetstherecipientsontheTolineofthenewemailmessage. |
EmailComposeTaskemailComposeTask=newEmailComposeTask(); emailComposeTask.Subject="messagesubject"; emailComposeTask.Body="messagebody"; emailComposeTask.To="recipient@example.com"; emailComposeTask.Cc="cc@example.com"; emailComposeTask.Bcc="bcc@example.com"; emailComposeTask.Show();
标题、正文、收件人、抄送、密送,不多说了..
效果:
6,MarketplaceDetailTask
MarketplaceDetailTask功能是导航到市场上的软件(软件推荐或者提示用户下载其他账户发布的新版本或相关应用的时候很有用)Name | Description | |
---|---|---|
ContentIdentifier | Getsorsetstheuniqueidentifierfortheproducttobedisplayed. | |
ContentType | GetsorsetsthetypeofcontentdisplayedintheWindowsPhoneMarketplaceclientapplication. |
MarketplaceDetailTaskmarketplaceDetailTask=newMarketplaceDetailTask(); marketplaceDetailTask.ContentIdentifier="c14e93aa-27d7-df11-a844-00237de2db9e"; //marketplaceDetailTask.ContentType=MarketplaceContentType.Applications; marketplaceDetailTask.Show();
ContentType默认为MarketplaceContentType.Applications,不用设置就可以
效果:
7,MarketplaceHubTask
MarketplaceHubTask功能很简单,就是导航到Marketplace,可以选择Application或者Music。
Name | Description | |
---|---|---|
ContentType | GetsorsetsthetypeofcontentdisplayedintheWindowsPhoneMarketplaceclientapplication. |
MarketplaceHubTaskmarketplaceHubTask=newMarketplaceHubTask();
marketplaceHubTask.ContentType=MarketplaceContentType.Music;
//marketplaceHubTask.ContentType=MarketplaceContentType.Applications;
marketplaceHubTask.Show();
效果:
8,MarketplaceReviewTask
MarketplaceReviewTask功能是导航到该应用的应用评分界面(一般应用的about里估计会用到)MarketplaceReviewTaskmarketplaceReviewTask=newMarketplaceReviewTask();
marketplaceReviewTask.Show();
效果:
9,MarketplaceSearchTask
MarketplaceSearchTask功能是市场搜索Name | Description | |
---|---|---|
ContentType | GetsorsetsthetypeofcontentdisplayedintheWindowsPhoneMarketplaceclientapplication. | |
SearchTerms | Getsorsetsthesearchterms. |
MarketplaceSearchTaskmarketplaceSearchTask=newMarketplaceSearchTask();
//marketplaceSearchTask.ContentType=MarketplaceContentType.Applications;
marketplaceSearchTask.ContentType=MarketplaceContentType.Music;
marketplaceSearchTask.SearchTerms="bewhatyouwannabe";
marketplaceSearchTask.Show();
ContentType依旧默认为Applications,另外搜索中文乱码…
效果:
10,MediaPlayerLauncher
MediaPlayerLauncher可以调用手机播放器来播放音乐、视频。
Name | Description | |
---|---|---|
Controls | Getsorsetstheflagsthatdeterminewhichcontrolsaredisplayedinthemediaplayerapplication. | |
Location | Setsthelocationofthemediafiletobeplayed.TheMediaLocationTypeenumerationisusedtospecifyeitherisolatedstorageortheapplication’s installationfolder. | |
Media | Getsorsetsthemediaplayedwiththemediaplayerapplication. | |
Orientation | Getsorsetstheorientationinwhichthemediaplayerwillbedisplayedwhenlaunched. |
MediaPlayerLaunchermediaPlayerLauncher=newMediaPlayerLauncher();
//mediaPlayerLauncher.Media=newUri("TroubleIsAFriend.mp3",UriKind.Relative);
mediaPlayerLauncher.Media=newUri("Wildlife.wmv",UriKind.Relative);
mediaPlayerLauncher.Location=MediaLocationType.Install;
mediaPlayerLauncher.Controls=MediaPlaybackControls.Pause|MediaPlaybackControls.Stop;
mediaPlayerLauncher.Orientation=MediaPlayerOrientation.Portrait;
mediaPlayerLauncher.Show();
Location需要选择是在隔离存储空间(MediaLocationType.Data)还是安装目录(MediaLocationType.Install)
效果:
11,PhoneCallTask
PhoneCallTask功能就是拨打电话Name | Description | |
---|---|---|
DisplayName | GetsorsetsthenamethatisdisplayedwhenthePhoneapplicationislaunched. | |
PhoneNumber | GetsorsetsthephonenumberthatisdialedwhenthePhoneapplicationislaunched. |
PhoneCallTaskphoneCallTask=newPhoneCallTask();
phoneCallTask.PhoneNumber="2065550123";
phoneCallTask.DisplayName="Gage";
phoneCallTask.Show();
效果:
12,SearchTask
SearchTask功能是调用搜索(貌似依旧是bing…)Name | Description | |
---|---|---|
SearchQuery | GetsorsetsthesearchquerythattheWebSearchapplicationwillusewhenitislaunched. |
SearchTasksearchTask=newSearchTask();
searchTask.SearchQuery="外汇";
searchTask.Show();
显示结果为网络、本地和图片,终于支持中文了
效果:
13,ShareLinkTask
ShareLinkTask可以调用你绑定的账户(Live、Facebook、Twitter)分享消息Name | Description | |
---|---|---|
LinkUri | GetsorsetsthelinkURIthatwillbedisplayedinthelinksharingdialog. | |
Message | Getsorsetsthemessagethatwillaccompanythelinkwhenitisshared. | |
Title | Getsorsetsthetitleofthelinktobeshared. |
ShareLinkTaskshareLinkTask=newShareLinkTask();
shareLinkTask.Title="CodeSamples";
shareLinkTask.LinkUri=newUri("http://msdn.microsoft.com/en-us/library/ff431744(v=VS.92).aspx",UriKind.Absolute);
shareLinkTask.Message="HerearesomegreatcodesamplesforWindowsPhone.";
shareLinkTask.Show();
不用多说,看名字就知道各个属性咋用了,要是啥时候微博、QQ能加入就NB了…
效果:
14,ShareStatusTask
ShareStatusTask功能是分享状态,其实和上面ShareLinkTask类似。Name | Description | |
---|---|---|
Status | Getsorsetsthestatusmessagetobeshared. |
ShareStatusTaskshareStatusTask=newShareStatusTask();
shareStatusTask.Status="I'mdevelopingaWindowsPhoneapplication!";
shareStatusTask.Show();
还是和上面一样,能加微博就无敌了…
效果:
15,SmsComposeTask
SmsComposeTask功能就是发送短信。Name | Description | |
---|---|---|
Body | GetsorsetsthebodytextofthenewSMSmessage. | |
To | GetsorsetstherecipientlistforthenewSMSmessage. |
SmsComposeTasksmsComposeTask=newSmsComposeTask();
smsComposeTask.To="2065550123";
smsComposeTask.Body="Trythisnewapplication.It'sgreat!";
smsComposeTask.Show();
不多说了..
效果:
16,WebBrowserTask
WebBrowserTask功能就是调用浏览器。Name | Description | |
---|---|---|
Uri | GetsorsetstheURItowhichthewebbrowserapplicationwillnavigatewhenitislaunched. | |
URL | Obsolete.GetsorsetstheURLtowhichthewebbrowserapplicationwillnavigatewhenitislaunched. |
WebBrowserTaskwebBrowserTask=newWebBrowserTask();
//webBrowserTask.URL="http://msdn.microsoft.com";
webBrowserTask.Uri=newUri("http://msdn.microsoft.com",UriKind.Absolute);
webBrowserTask.Show();
url虽然提示过时,不过也能用,不过推荐用Uri。
效果:
15个启动器介绍完毕,下周有时间再写下选择器。
参考:
实例源码:
作者:sun8134 出处:http://sun8134.cnblogs.com/空间:http://sun8134.spaces.live.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
来源:
相关文章推荐
- Ubuntu16.04 桌面左侧(Launcher)启动器与屏幕底部互换
- Windows Phone开发(26):启动器与选择器之MediaPlayerLauncher和SearchTask
- 安卓系统中的桌面启动器Launcher
- 与众不同 windows phone (4) - Launcher(启动器)
- 删除Ubuntu的Gnome界面上无用的启动器(Launcher)
- 与众不同 windows phone (4) - Launcher(启动器)
- Android——Launcher(桌面启动器)相关知识总结贴
- wp7上启动器使用方法
- Windows Phone开发(26):启动器与选择器之MediaPlayerLauncher和SearchTask
- Android launcher启动器
- Windows Phone开发(26):启动器与选择器之MediaPlayerLauncher和SearchTask
- 删除Ubuntu的Gnome界面上无用的启动器(Launcher)
- GridView实现简单的应用启动器Launcher
- qemu-launcher:图形化的QEMU启动器
- 启动器与选择器-常用Task【WP7学习札记之四】
- wp7开发5启动器和选择器
- launcher 桌面启动器的DB文件数据处理操作
- Android启动器(Launcher)开发详解
- Ubuntu 16.04 GNOME在桌面左侧添加启动器(Launcher)
- 启动器和选择器学习-----(6)Extras <wp7 7.1版本中的使用方法>