Date: 31.01.2017 7:44:13
попробуйте так:
public static BitmapImage ArrayToBitmapImage(byte[] byteArray)
{
using (var stream = new InMemoryRandomAccessStream())
{
stream.WriteAsync(byteArray.AsBuffer()).GetResults();
var image = new BitmapImage();
stream.Seek(0);
image.SetSource(stream);
return image;
}
}
Date: 01.02.2017 7:33:57
Совет все равно дельный. Надо позаботиться, чтобы поток не уничтожался. Может, попробовать просто убрать using.
Date: 03.02.2017 7:46:22
можно еще так попробовать:
static InMemoryRandomAccessStream stream;
public static BitmapImage ArrayToBitmapImage(byte[] byteArray)
{
stream = new InMemoryRandomAccessStream();
stream.WriteAsync(byteArray.AsBuffer()).GetResults();
var image = new BitmapImage();
stream.Seek(0);
await image.SetSourceAsync(stream);
return image;
}
Автор: VadimTagil