读书人

错误在 Microsoft.Xna.Framework.ni.d

发布时间: 2013-07-09 09:50:47 作者: rapoo

异常在 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();



}


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

读书人网 >Windows Mobile

热点推荐