首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

错误在 Microsoft.Xna.Framework.ni.dll 中发生,但未在用户代码中进行处理

2013-07-09 
异常在 Microsoft.Xna.Framework.ni.dll 中发生,但未在用户代码中进行处理rt,保存照片的时候报错!怎么处理

异常在 Microsoft.Xna.Framework.ni.dll 中发生,但未在用户代码中进行处理
rt,保存照片的时候报错!怎么处理呢??

  void ct_Completed(object sender, PhotoResult e)
        {
            if (null != e.Error)
            {
                MessageBox.Show("Error");
                return;
            }
            else if (e.TaskResult == TaskResult.OK)
            {
                using (e.ChosenPhoto)
                {
                    MediaLibrary ml = new MediaLibrary();
                    ml.SavePicture("p",e.ChosenPhoto);
                }
             
            }

        }

这是我保存图片的代码。求大神指导。 异常
[解决办法]

IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();

            try
            {

                if (!file.DirectoryExists(albumId.Text))
                {
                    file.CreateDirectory(albumId.Text);
                }

                IsolatedStorageFileStream fs = file.CreateFile(imagePath);

                ImageSource imageSource = imageFile.Source;
                BitmapImage tempImage = imageSource as BitmapImage;


                WriteableBitmap wb = new WriteableBitmap(tempImage);
                wb.SaveJpeg(fs, wb.PixelWidth, wb.PixelHeight, 0, 100);


                fs.Close();

                fs = file.OpenFile(imagePath, FileMode.Open, FileAccess.Read);

                MediaLibrary mLib = new MediaLibrary();
                mLib.SavePicture(imageId.Text, fs);
                fs.Close();

                fs.Dispose();



            }


[解决办法]
调试后就直接报错,报什么错啊?

热点排行