码迷,mamicode.com
首页 > Windows程序 > 详细

Windows Phone 7 中常用Task

时间:2014-09-24 22:56:47      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   os   ar   sp   on   c   log   

      1、//PhoneCallTask :打电话

private void btnPhoneCall_Click(object sender, RoutedEventArgs e)
{
    PhoneCallTask task = new PhoneCallTask();
    task.PhoneNumber = "110";
    task.DisplayName = "秋月光璇";
    task.Show();
}

     2、//SmsComposeTask:发送短信 

     private void btnComposeSms_Click(object sender, RoutedEventArgs e)

{
    SmsComposeTask task = new SmsComposeTask();
    task.To = "110";
    task.Body = "你好!.";
    task.Show();
}

3、//EmailComposeTask:发送邮件 

EmailComposeTask task = new EmailComposeTask();
task.To = "252456098@qq.com";
task.Cc = "ycproc@163.com";
task.Subject = "秋月光璇测试";
task.Body = "Hello world!";
task.Show();


4、//WebBrowserTask:开启Web浏览器
private void btnLaunchWebBrowser_Click(object sender, RoutedEventArgs e)
{
    WebBrowserTask task = new WebBrowserTask();

    task.URL = "<a href="http://http://www.cnblogs.com/qiuyueguangxuan/">http://www.cnblogs.com/qiuyueguangxuan</a>";
    task.Show();
}

5、//SearchTask:搜索功能
private void btnLaunchSearch_Click(object sender, RoutedEventArgs e)
{
    SearchTask task = new SearchTask();
    task.SearchQuery = "秋月光璇";
    task.Show();
}

6、//MediaPlayerLauncher:启动媒体播放器
MediaPlayerLauncher task = new MediaPlayerLauncher();
task.Media = new Uri(@"http://www.baidu.com/11.wmv");
task.Show();


7、//CameraCaptureTask: 拍照的task
private void button1_Click(object sender,RoutedEventArgs e)
{
    CameraCaptureTask camerTask=new CameraCaptureTask();
    camerTask.Completed+=new EventHandler<PhotoResult>(cameraTask_Completed);
    cameraTask.Show();
}

void cameraTask_Completed(object sender, PhotoResult e)
{
    //执行拍照完成后的代码
    BitmapImage image=new BitmapImage();
    image.SetSource(e.ChosenPhoto);
    image1.Source=image;
}


8、//PhotoChooserTask 调用图片程序,选择图片,并且可以静心裁剪
PhotoChooserTask photo=new PhotoChooserTask();
public MultipleMediaTask()//构造函数
{
    InitializeComponent();
    photoCompleted += new EventHandler<PhotoResult>(photo_Completed);
}

void photo_Completed(object sender, PhotoResult e)
{
    BitmapImage image=new BitmapImage();
    image.SetSource(e.ChosenPhoto);
    image1.Source=image;
}

9、//SaveEmailAddressTask 调用联系人程序,并将设置的Email Address保存到选定的联系人或新建联系人
private void EmailSaveBtn_Click(object sender, RoutedEventArgs e)
{
    SaveEmailAddressTask emailsave = new SaveEmailAddressTask();
    emailsave.Email = "888888888888@qq.com"; emailsave.Completed += new EventHandler<TaskEventArgs>(emailsave_Completed);
    emailsave.Show();
}
void emailsave_Completed(object sender, TaskEventArgs e)
{
    //处理保存完毕后执行代码
}

10、//EmailAddressChooserTask 打开联系人程序,选取联系人Email Address</p>
private void EmailChooser_Click(object sender, RoutedEventArgs e)
{
    EmailAddressChooserTask emailchooser = new EmailAddressChooserTask();
    emailchooser.Completed += new EventHandler&lt;EmailResult&gt;(emailchooser_Completed);
    emailchooser.Show();
}

void emailchooser_Completed(object sender, EmailResult e)
{
    this.PageTitle.Text = e.Email;
}








 

Windows Phone 7 中常用Task

标签:style   blog   http   os   ar   sp   on   c   log   

原文地址:http://www.cnblogs.com/qiuyueguangxuan/p/3991474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!