错误在 Microsoft.Xna.Framework.ni.dll 中发生,但未在用户代码中进行处理
异常在 Microsoft.Xna.Framework.ni.dll 中发生,但未在用户代码中进行处理
rt,保存照片的时候报错!怎么处理呢??
这是我保存图片的代码。求大神指导。
------解决方案--------------------
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);