我尝试在媒体库中保存图像
private bool saveImage(WriteableBitmap bmp)
{
using(var mediaLibrary=new MediaLibrary())
{
using (var stream = new MemoryStream())
{
var fileName = string.Format("Gs{0}.jpg", Guid.NewGuid());
bmp.SaveJpeg(stream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
stream.Seek(0, SeekOrigin.Begin);
var picture = mediaLibrary.SavePicture(fileName, stream);
if (picture.Name.Contains(fileName)) return true;
}
}
return false;
}
我即将收到错误:
Microsoft.Phone.Interop.ni.dll中发生未处理的“System.UnauthorizedAccessException”类型异常
其他信息:尝试执行未经授权的操作。
帮助我克服这个问题。
答案 0 :(得分:2)
WMAppManifest.xml将引发UnauthorizedAccessException