Gestion repa Ok

This commit is contained in:
adri
2019-01-24 22:24:05 +01:00
parent 9e06f31677
commit ceffc1446e
107 changed files with 5340 additions and 621 deletions

View File

@@ -16,11 +16,15 @@ namespace ProjetTheAlone.Converter
object parameter,
System.Globalization.CultureInfo culture)
{
if (value != null && value is byte[])
if (value != null && value is byte?[])
{
byte[] bytes = value as byte[];
MemoryStream stream = new MemoryStream(bytes);
byte?[] bytes = value as byte?[];
byte[] bb = Array.ConvertAll<byte?, byte>(bytes,
delegate (byte? b)
{
return b.Value;
});
MemoryStream stream = new MemoryStream(bb);
BitmapImage image = new BitmapImage();
image.BeginInit();
@@ -38,7 +42,26 @@ namespace ProjetTheAlone.Converter
object parameter,
System.Globalization.CultureInfo culture)
{
throw new Exception("The method or operation is not implemented.");
if (value != null)
{
byte?[] data;
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create((BitmapImage)value));
using (MemoryStream ms = new MemoryStream())
{
encoder.Save(ms);
byte[] bb = ms.ToArray();
data = Array.ConvertAll<byte, byte?>(bb,
delegate (byte b)
{
return b;
});
return data;
}
}
return null;
}
}
}