Windows Phone开发之获取摄像头

引入命名空间:

Using Microsoft.Phone.Tasks;
代码段:
       void cameraCaptureTask_Completed(object sender, PhotoResult e)
       {
           BitmapImage bmp = new BitmapImage();
           bmp.SetSource(e.ChosenPhoto);//获取返回的图片
           image1.Source = bmp;
       }
       
       private void button1_Click(object sender, RoutedEventArgs e)
       { 
           CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
           cameraCaptureTask.Show();//打开摄像头程序
           cameraCaptureTask.Completed +=
           new EventHandler<PhotoResult>(cameraCaptureTask_Completed);//拍照完返回
            
       }


你可能感兴趣的:(Windows Phone开发之获取摄像头)