我正在尝试从媒体捕获元素中获取图像,当我尝试打开该文件时,此时#34;访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))"发生例外......
try
{
var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("takeImage.png", CreationCollisionOption.ReplaceExisting);
if (file != null)
{
_mediaCapture.CapturePhotoToStorageFileAsync(ImageEncodingProperties.CreatePng(), file);
ImageProperties imgProp = await file.Properties.GetImagePropertiesAsync();
//LINE IS WHERE EXCEPTION HAPPENS..
using (var imgStream = await file.OpenAsync(FileAccessMode.ReadWrite))
{
bitmap = new WriteableBitmap((int)imgProp.Width, (int)imgProp.Height);
bitmap.SetSource(imgStream);
PreviewImage.Source = bitmap;
}
}
}
catch (Exception ex)
{
ex.Message;
}