Windows Phone 7.1 新增Task

 

Wp7.1中又新增加了多个Task,可以实现对BingMap、铃声音使的操作。另外还有一些原来的Task的功能也得到了加强。

1.       BingMapsTask:用来调用Bingmaps,并且可以标记中心点、搜索、设置显示比例。与BingMaps控件相似但是可用api功能比较弱。

_tskBingmap = new BingMapsTask();

            _tskBingmap.Center = new GeoCoordinate(30.24, 120.123);

            _tskBingmap.SearchTerm = "West Lake";

            _tskBingmap.ZoomLevel = 10;

            _tskBingmap.Show();

 

2.       BingmapsDirectionsTask:用来调用BingMaps,并且可以标记两点间的行驶方向。

_tskBMDirections = new BingMapsDirectionsTask();

_tskBMDirections.Start = new LabeledMapLocation("Start", new GeoCoordinate(30.24, 120.123));

_tskBMDirections.End = new LabeledMapLocation("End", new GeoCoordinate(30.25, 120.223));

_tskBMDirections.Show();

3.       GameInvite:可以打开游戏邀请界面,从而实现多人游戏。

_tskGame = new GameInviteTask();

            _tskGame.Completed += new EventHandler<TaskEventArgs>(_tskGame_Completed);

            _tskGame.SessionId = "<my session id>";

            _tskGame.Show();

 

4.       SaveRingToneTask:将得到的音频文件保存到系统的铃声列表中,并且可以选择铃音。

对于要保存的铃声音是有一定要求的:

只能是MP3WMA 文件

播放时长必须小时40

文件不能带有数字权限保护

文件大小必须小于1M

_tskSaveRingTone = new SaveRingtoneTask();

_tskSaveRingTone.Completed += new EventHandler<TaskEventArgs>(_tskSaveRingTone_Completed);

_tskSaveRingTone.DisplayName = "相爱的泪水";

_tskSaveRingTone.IsoStorePath = new Uri("appdata:/mytone.mp3", UriKind.Absolute);

_tskSaveRingTone.IsShareable = true;

_tskSaveRingTone.Show();

 

其他的一些Task也完善了相应的功能。比如PhoneNumberChooserTaskEmailAddressChooserTask都可以通过DisplayName获取相应的人名了

示例代码:http://www.52winphone.com/bbs/viewthread.php?tid=746&extra=page%3D1

原文地址:https://www.cnblogs.com/randylee/p/2075383.html