Windows Phone 启动器

http://msdn.microsoft.com/zh-CN/library/gg278408(v=vs.92)#BKMK_Launchers

using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System;
using System.Windows;

namespace PhoneAppBingRoadMap
{
    public partial class MainPage : PhoneApplicationPage
    {
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
        }
        //如何使用 Windows Phone Bing 地图路线任务
        //http://msdn.microsoft.com/zh-CN/library/hh394024(v=vs.92)
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //您至少必须指定一个 Start 或 End,否则当您调用 Show 方法时会引发异常。
            BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
            LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", null);
            bingMapsDirectionsTask.End = spaceNeedleLML;
            bingMapsDirectionsTask.Show();
        }
        //如何使用 Windows Phone Bing 地图任务
        //http://msdn.microsoft.com/zh-CN/library/hh394026(v=vs.92)
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            BingMapsTask bingMapTask = new BingMapsTask();
            bingMapTask.SearchTerm = "coffee";
            bingMapTask.ZoomLevel = 2d;
            bingMapTask.Show();
        }
        //如何使用 Windows Phone 连接设置任务
        //http://msdn.microsoft.com/zh-CN/library/hh394011(v=vs.92)
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
            connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Cellular;
            connectionSettingsTask.Show();
        }
        //如何使用 Windows Phone 电子邮件撰写任务
        //http://msdn.microsoft.com/zh-CN/library/hh394003(v=vs.92)
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            EmailComposeTask emailComposeTask = new EmailComposeTask();
            emailComposeTask.Subject = "邮件主题";
            emailComposeTask.Body = "邮件正文";
            emailComposeTask.To = "shoujianren@126.com;shoujianren@163.com";
            emailComposeTask.Cc = "chaosong@126.com;chaosong@163.com";
            emailComposeTask.Bcc = "mijianchaosong@126.com; mijianchaosong@163.com";
            emailComposeTask.Show();
        }
        //如何使用 Windows Phone 商城详细信息任务
        //http://msdn.microsoft.com/zh-CN/library/hh394017(v=vs.92)
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
            marketplaceDetailTask.ContentIdentifier = "c14e93aa-27d7-df11-a844-00237de2db9e";
            marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
            marketplaceDetailTask.Show();
        }
        //如何使用 Windows Phone 商城中心任务
        //http://msdn.microsoft.com/zh-CN/library/hh394015(v=vs.92)
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            MarketplaceHubTask marketplaceHubTask = new MarketplaceHubTask();
            marketplaceHubTask.ContentType = MarketplaceContentType.Music;
            marketplaceHubTask.Show();
        }
        //如何使用 Windows Phone 商城评价任务
        //http://msdn.microsoft.com/zh-CN/library/hh394030(v=vs.92)
        private void Button_Click_7(object sender, RoutedEventArgs e)
        {
            //跳转到应用商城对本应用进行评价
            MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
            marketplaceReviewTask.Show();
        }
        //如何使用 Windows Phone 商城搜索任务
        //http://msdn.microsoft.com/zh-CN/library/hh394001(v=vs.92)
        private void Button_Click_8(object sender, RoutedEventArgs e)
        {
            MarketplaceSearchTask marketplaceSearchTask = new MarketplaceSearchTask();
            marketplaceSearchTask.SearchTerms = "acclerometer xna";
            marketplaceSearchTask.Show();
        }
        //如何使用 Windows Phone 媒体播放器启动器
        //http://msdn.microsoft.com/zh-CN/library/hh394004(v=vs.92)
        private void Button_Click_9(object sender, RoutedEventArgs e)
        {
            MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
            mediaPlayerLauncher.Media = new Uri("勇敢很好.mp3", UriKind.Relative);
            mediaPlayerLauncher.Location = MediaLocationType.Install;
            mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop;
            mediaPlayerLauncher.Orientation = MediaPlayerOrientation.Landscape;
            mediaPlayerLauncher.Show();
            //对于独立存储中存储的媒体文件,请使用 MediaLocationType.Data。对于应用程序项目中包含的媒体文件,
            //请使用 MediaLocationType.Install。它们捆绑在 .xap 文件中,并存储在应用程序的安装目录中。
        }
        //如何使用 Windows Phone 通话任务
        //http://msdn.microsoft.com/zh-CN/library/hh394025(v=vs.92)
        private void Button_Click_10(object sender, RoutedEventArgs e)
        {
            //如果手机没有 SIM 卡,则应用程序会提示用户添加 SIM 卡。
            PhoneCallTask phoneCallTask = new PhoneCallTask();
            phoneCallTask.DisplayName = "grj";
            phoneCallTask.PhoneNumber = "13917500649";
            phoneCallTask.Show();

            //PhoneNumberChooserTask phoneNumberChooserTask = new PhoneNumberChooserTask();
            //phoneNumberChooserTask.Completed += (obj, args) =>
            //{
            //    if (args.TaskResult == TaskResult.OK)
            //    {
            //        MessageBox.Show(args.DisplayName + ": " + args.PhoneNumber);
            //    }
            //};
            //phoneNumberChooserTask.Show();

            //SavePhoneNumberTask savePhoneNumberTask = new SavePhoneNumberTask();
            //savePhoneNumberTask.PhoneNumber = "123456789";
            //savePhoneNumberTask.Completed += (obj, args) =>
            //{
            //    if (args.TaskResult == TaskResult.OK)
            //    {
            //        //args.Error
            //    }
            //};
            //savePhoneNumberTask.Show();
        }
        //如何使用 Windows Phone 搜索任务
        //http://msdn.microsoft.com/zh-CN/library/hh394010(v=vs.92)
        private void Button_Click_11(object sender, RoutedEventArgs e)
        {
            SearchTask searchTask = new SearchTask();
            searchTask.SearchQuery = "xbox game";
            searchTask.Show();
        }
        //如何使用 Windows Phone 共享链接任务
        //http://msdn.microsoft.com/zh-CN/library/hh394009(v=vs.92)
        private void Button_Click_12(object sender, RoutedEventArgs e)
        {
            ShareLinkTask shareLinkTask = new ShareLinkTask();
            shareLinkTask.Title = "Cnblogs";
            shareLinkTask.LinkUri = new Uri("http://www.cnblogs.com/", UriKind.Absolute);
            shareLinkTask.Message = "coding change the world";
            shareLinkTask.Show();
        }
        //如何使用 Windows Phone 共享状态任务
        //http://msdn.microsoft.com/zh-CN/library/hh394027(v=vs.92)
        private void Button_Click_13(object sender, RoutedEventArgs e)
        {
            ShareStatusTask shareStatusTask = new ShareStatusTask();
            shareStatusTask.Status = "获取或设置共享状态消息";
            shareStatusTask.Show();
        }
        //如何使用 Windows Phone 短信撰写任务
        //http://msdn.microsoft.com/zh-CN/library/hh394005(v=vs.92)
        private void Button_Click_14(object sender, RoutedEventArgs e)
        {
            SmsComposeTask smsComposeTask = new SmsComposeTask();
            smsComposeTask.To = "13917500649;15911162317";
            smsComposeTask.Body = "短信内容";
            smsComposeTask.Show();
        }
        //如何使用 Windows Phone Web 浏览器任务
        //http://msdn.microsoft.com/zh-CN/library/hh394020(v=vs.92)
        private void Button_Click_15(object sender, RoutedEventArgs e)
        {
            WebBrowserTask webBrowserTask = new WebBrowserTask();
            webBrowserTask.Uri = new Uri("http://www.cnblogs.com/", UriKind.Absolute);
            webBrowserTask.Show();
        }


    }
}

PhoneAppBingRoadMap.rar

转载于:https://www.cnblogs.com/grj1046/p/3291728.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值