Bild aus datenbank hinzufügen
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -19,9 +20,33 @@ namespace Casino
|
||||
/// </summary>
|
||||
public partial class Slots : Window
|
||||
{
|
||||
private BitmapImage ByteArrayToImage(byte[] bytes)
|
||||
{
|
||||
BitmapImage image = new BitmapImage();
|
||||
using (MemoryStream ms = new MemoryStream(bytes))
|
||||
{
|
||||
image.BeginInit();
|
||||
image.CacheOption = BitmapCacheOption.OnLoad;
|
||||
image.StreamSource = ms;
|
||||
image.EndInit();
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
public Slots()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void LoadCard()
|
||||
{
|
||||
Database db = new Database();
|
||||
byte[] img = db.GetCardImage(1);
|
||||
|
||||
kartenBild.Source = ByteArrayToImage(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user