本文介绍了尝试设置图像源时发生AG_E_NETWORK_ERROR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在cameraCapture_Completed事件中,我尝试在ImageControl上设置图像捕获.

At cameraCapture_Completed event i try to set the image capture on an ImageControl.

        void cameraCapture_Completed(对象发送方,PhotoResult e)
        {
            if(e.TaskResult == TaskResult.OK)
            {
              Image1.Source =新的BitmapImage(新的Uri(e.OriginalFileName,UriKind.Absolute));
           }
        }

        void cameraCapture_Completed(object sender, PhotoResult e)
        {
           if (e.TaskResult == TaskResult.OK)
           {
              Image1.Source = new BitmapImage( new Uri(e.OriginalFileName,UriKind.Absolute));
           }
        }

加载的图像路径就像

C:\ Data \ Users \ PUBLIC \ Pictures \ CameraRoll \ WP_XXXX_XXX.jpg

C:\Data\Users\PUBLIC\Pictures\CameraRoll\WP_XXXX_XXX.jpg

不幸的是,未设置图像.

Unfortunatelly the Image is NOT set.

在Image1_ImageFailed事件中,我收到错误

And at the Image1_ImageFailed event i get the error

AG_E_NETWORK_ERROR

AG_E_NETWORK_ERROR

我在这里做什么错了?

推荐答案

void cameraCapture_Completed(object sender, PhotoResult e)
{
   if(e.TaskResult == TaskResult.OK)
   {
      //create bitmap object and set its source
      var bitmap = new BitmapImage();
      bitmap.SetSource(e.ChosenPhoto);
      
      //Assign bitmap to image control
      Image1.Source = bitmap;
    }
}


这篇关于尝试设置图像源时发生AG_E_NETWORK_ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 06:39