From abe9867cb18bc66a320a712a7b8ac8dcbe1166b0 Mon Sep 17 00:00:00 2001 From: "NBTEMP\\bib" Date: Mon, 7 Sep 2026 14:12:08 +0200 Subject: [PATCH] Blackjack --- Casino/Blackjack.xaml | 37 +++++++++++++++++++++++++++++ Casino/Blackjack.xaml.cs | 50 +++++++++++++++++++++++++++++++++++++++ Casino/MainWindow.xaml | 1 + Casino/MainWindow.xaml.cs | 8 ++++++- 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 Casino/Blackjack.xaml create mode 100644 Casino/Blackjack.xaml.cs diff --git a/Casino/Blackjack.xaml b/Casino/Blackjack.xaml new file mode 100644 index 0000000..aa61493 --- /dev/null +++ b/Casino/Blackjack.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Casino/Blackjack.xaml.cs b/Casino/Blackjack.xaml.cs new file mode 100644 index 0000000..86a6d46 --- /dev/null +++ b/Casino/Blackjack.xaml.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Casino +{ + /// + /// Interaktionslogik für Blackjack.xaml + /// + public partial class Blackjack : Window + { + public Blackjack() + { + InitializeComponent(); + LoadCard(28); + } + + private void LoadCard(int Bild) + { + Database db = new Database(); + byte[] img = db.GetCardImage(Bild);//2-10 + + Bild_1.Source = ByteArrayToImage(img); + } + + 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; + } + } +} diff --git a/Casino/MainWindow.xaml b/Casino/MainWindow.xaml index 013ee40..b398770 100644 --- a/Casino/MainWindow.xaml +++ b/Casino/MainWindow.xaml @@ -9,6 +9,7 @@