Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
823cee8252 | ||
|
|
b1c54aeda0 | ||
|
|
83e0119ad4 | ||
|
|
d94ede997c | ||
|
|
1015c3b512 |
@@ -56,5 +56,29 @@ namespace Casino
|
|||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] GetCardImage(int id)
|
||||||
|
{
|
||||||
|
byte[] imageBytes = null;
|
||||||
|
|
||||||
|
using (MySqlConnection conn = new MySqlConnection(myConnectionString))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (MySqlCommand cmd = new MySqlCommand("SELECT bild FROM Karten WHERE kartenid = @id", conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue("@id", id);
|
||||||
|
|
||||||
|
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
imageBytes = (byte[])reader["bild"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageBytes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,10 @@
|
|||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Content="Anmelden" Width="80" Click="Anmelden_Click" Background="#BD9208" FontFamily="Palatino Linotype" FontWeight="SemiBold"/>
|
<Button Content="Anmelden" Width="80" Click="Anmelden_Click" Background="#BD9208" FontFamily="Palatino Linotype" FontWeight="SemiBold"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<MediaElement Name="player"
|
||||||
|
LoadedBehavior="Manual"
|
||||||
|
UnloadedBehavior="Manual" />
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
+10
-3
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -21,11 +22,14 @@ namespace Casino
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Login : Window
|
public partial class Login : Window
|
||||||
{
|
{
|
||||||
|
|
||||||
public Login()
|
public Login()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Anmelden_Click(object sender, RoutedEventArgs e)
|
private void Anmelden_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (checkLogin(TxtName.Text, TxtPasswort.Text))
|
if (checkLogin(TxtName.Text, TxtPasswort.Text))
|
||||||
@@ -36,8 +40,11 @@ namespace Casino
|
|||||||
Close();
|
Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Login fehlgeschlagen!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool checkLogin(string name, string passwort)
|
private bool checkLogin(string name, string passwort)
|
||||||
{
|
{
|
||||||
@@ -46,9 +53,9 @@ namespace Casino
|
|||||||
users = db.SelectTask();
|
users = db.SelectTask();
|
||||||
for (int i = 0; i < users.Count(); i++)
|
for (int i = 0; i < users.Count(); i++)
|
||||||
{
|
{
|
||||||
if (name.Equals(users[0].Name))
|
if (name.Equals(users[i].Name))
|
||||||
{
|
{
|
||||||
if(passwort.Equals(users[0].Passwort)) {
|
if(passwort.Equals(users[i].Passwort)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="MainWindow" Height="450" Width="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Button Content="Slots" HorizontalAlignment="Left" Height="39" Margin="65,114,0,0" VerticalAlignment="Top" Width="93" Click="Slots_Click"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ namespace Casino
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void Slots_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Slots slotsWindow = new Slots();
|
||||||
|
slotsWindow.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,5 +29,7 @@
|
|||||||
<RowDefinition Height="270"></RowDefinition>
|
<RowDefinition Height="270"></RowDefinition>
|
||||||
<RowDefinition Height="200"></RowDefinition>
|
<RowDefinition Height="200"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<Image Grid.Column="1" Grid.Row="1" x:Name="kartenBild"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -19,9 +20,33 @@ namespace Casino
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Slots : Window
|
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()
|
public Slots()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
LoadCard();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void LoadCard()
|
||||||
|
{
|
||||||
|
Database db = new Database();
|
||||||
|
byte[] img = db.GetCardImage(1);
|
||||||
|
|
||||||
|
kartenBild.Source = ByteArrayToImage(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user