Merge branch 'main' of https://git.bib.de/PBG2H25AGE/WIR-MACHEN-ALLE-ARM
This commit is contained in:
@@ -35,5 +35,6 @@
|
||||
<Image Grid.Column="7" Grid.Row="1" x:Name="Dealer_Bild_2"/>
|
||||
|
||||
<Button Grid.Row="0" Content="Hauptmenü" HorizontalAlignment="Center" Click="Hauptmenue" Width="100"/>
|
||||
<TextBox Grid.Column="4" HorizontalAlignment="Left" Height="101" Margin="10,169,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Einsatz" VerticalAlignment="Top" Width="193" Background="Blue" PreviewTextInput="TextBox_OnPreviewTextInput" PreviewKeyDown="TextBox_OnPreviewKeyDown" DataObject.Pasting="TextBox_Pasting" Grid.ColumnSpan="2"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -60,5 +61,35 @@ namespace Casino
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private static readonly Regex _regex = new Regex("[^0-9]+€"); // Regex to match non-numeric input
|
||||
|
||||
//nur nummern
|
||||
private void TextBox_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
e.Handled = !_regex.IsMatch(e.Text);
|
||||
}
|
||||
|
||||
// Keine Spaces
|
||||
private void TextBox_OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Space)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
//das man nichts reinkopieren kann außer Zahlen
|
||||
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
|
||||
{
|
||||
if (e.DataObject.GetDataPresent(typeof(String)))
|
||||
{
|
||||
var text = (String)e.DataObject.GetData((typeof(String)));
|
||||
if (!_regex.IsMatch((string)text))
|
||||
{
|
||||
e.CancelCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
<Image Grid.Column="5" Grid.Row="2" x:Name="Bild_2"/>
|
||||
<Image Grid.Column="7" Grid.Row="2" x:Name="Bild_3"/>
|
||||
<Image Grid.Column="9" Grid.Row="2" x:Name="Bild_4"/>
|
||||
<Button Grid.Row="0" Content="Hauptmeü" HorizontalAlignment="Center" Click="Hauptmenue" Width="100"/>
|
||||
<Button Grid.Row="0" Content="Hauptmenü" HorizontalAlignment="Center" Click="Hauptmenue" Width="100"/>
|
||||
<TextBox Grid.Column="5" HorizontalAlignment="Left" Height="51" Grid.Row="1" Width="193" Background="DimGray" PreviewTextInput="TextBox_PreviewTextInput" PreviewKeyDown="TextBox_PreviewKeyDown" DataObject.Pasting="TextBox_Pasting"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -20,7 +21,7 @@ namespace Casino
|
||||
/// </summary>
|
||||
public partial class Busfahrer : Window
|
||||
{
|
||||
|
||||
|
||||
|
||||
public Busfahrer()
|
||||
{
|
||||
@@ -35,7 +36,7 @@ namespace Casino
|
||||
byte[] img = db.GetCardImage(Bild);
|
||||
|
||||
Bild_4.Source = ByteArrayToImage(img);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ namespace Casino
|
||||
image.StreamSource = ms;
|
||||
image.EndInit();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -65,5 +67,38 @@ namespace Casino
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
//Numberfield
|
||||
private static readonly Regex _regex = new Regex("^[0-9]"); // Regex to match non-numeric input
|
||||
|
||||
//nur nummern
|
||||
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
e.Handled = !_regex.IsMatch(e.Text);
|
||||
}
|
||||
|
||||
// Keine Spaces
|
||||
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Space)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
//das man nichts reinkopieren kann außer Zahlen
|
||||
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
|
||||
{
|
||||
if (e.DataObject.GetDataPresent(typeof(String)))
|
||||
{
|
||||
var text = (String)e.DataObject.GetData((typeof(String)));
|
||||
if (!_regex.IsMatch((string)text))
|
||||
{
|
||||
e.CancelCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace Casino
|
||||
|
||||
private void Busfahrer_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Busfahrer slotsWindow = new Busfahrer();
|
||||
slotsWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user