diff --git a/Casino/Slots.xaml b/Casino/Slots.xaml
index c28a2ec..0ab1315 100644
--- a/Casino/Slots.xaml
+++ b/Casino/Slots.xaml
@@ -5,10 +5,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Casino"
mc:Ignorable="d"
- Title="Slots" Height="1080" Width="1980">
+ Title="Slots">
-
+
@@ -20,7 +20,7 @@
-
+
@@ -50,6 +50,8 @@
+
+
diff --git a/Casino/Slots.xaml.cs b/Casino/Slots.xaml.cs
index 2340c29..7a94f67 100644
--- a/Casino/Slots.xaml.cs
+++ b/Casino/Slots.xaml.cs
@@ -20,8 +20,11 @@ namespace Casino
///
public partial class Slots : Window
{
-
+ private List _bilder;
+ private Random _random = new Random();
+ Database db = new Database();
+ private List AlleBilder;
public Slots()
{
@@ -29,16 +32,26 @@ namespace Casino
- LoadCard(8);
-
+ _bilder = new List
+ {
+ Bild_11, Bild_12, Bild_13, Bild_14, Bild_15, Bild_16,
+ Bild_21, Bild_22, Bild_23, Bild_24, Bild_25, Bild_26,
+ Bild_31, Bild_32, Bild_33, Bild_34, Bild_35, Bild_36
+ };
+ AlleBilder = new List
+ {
+ db.GetCardImage(2),db.GetCardImage(3),db.GetCardImage(4),
+ db.GetCardImage(5),db.GetCardImage(6),db.GetCardImage(7),
+ db.GetCardImage(8),db.GetCardImage(9),db.GetCardImage(10),
+ };
}
- private void LoadCard(int Bild)
- {
- Database db = new Database();
- byte[] img = db.GetCardImage(Bild);//2-10
- Bild_11.Source = ByteArrayToImage(img);
+
+ private void LoadCard(Image imageControl, int bildId)
+ {
+ byte[] img = AlleBilder.ElementAt(bildId);
+ imageControl.Source = ByteArrayToImage(img);
}
private BitmapImage ByteArrayToImage(byte[] bytes)
@@ -53,5 +66,24 @@ namespace Casino
}
return image;
}
+ private async Task Spin()
+ {
+ for (int i = 0; i < 50; i++)
+ {
+ foreach (var image in _bilder)
+ {
+ int randomBild = _random.Next(2, AlleBilder.Count);
+
+ LoadCard(image, randomBild);
+ }
+
+ await Task.Delay(70);
+ }
+ }
+
+ private async void Spin(object sender, RoutedEventArgs e)
+ {
+ await Spin();
+ }
}
}