Show MessageBox

This commit is contained in:
Natlinux81
2022-02-25 01:48:33 +01:00
parent 19ef7ba65c
commit aeadef68e6
18 changed files with 53 additions and 35 deletions

Binary file not shown.

View File

@@ -80,7 +80,7 @@
> >
<Grid Margin="15"> <Grid Margin="15">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="135"/> <ColumnDefinition Width="116"/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -100,11 +100,11 @@
FontSize="14" FontSize="14"
FontWeight="Bold" FontWeight="Bold"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Width="150" BorderBrush="#FF157315"
BorderBrush="#FF157315" BorderThickness="3"
BorderThickness="3" Background="Transparent"
Background="Transparent" Style="{StaticResource ModernTextbox}"
Style="{StaticResource ModernTextbox}" /> />
<TextBlock Grid.Row="1" <TextBlock Grid.Row="1"
Margin="0,20" Margin="0,20"
@@ -113,6 +113,7 @@
FontWeight="Bold" FontWeight="Bold"
FontFamily="MV Boli" FontFamily="MV Boli"
Foreground="#FF157315"/> Foreground="#FF157315"/>
<TextBox x:Name="LastTicket" <TextBox x:Name="LastTicket"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Margin="0,20" Grid.Row="1" Margin="0,20" Grid.Row="1"
@@ -120,13 +121,11 @@
Foreground="#FF157315" Foreground="#FF157315"
FontSize="14" FontSize="14"
FontWeight="Bold" FontWeight="Bold"
Width="150" BorderBrush="#FF157315"
BorderBrush="#FF157315" BorderThickness="3"
BorderThickness="3" Background="Transparent"
Background="Transparent" Style="{StaticResource ModernTextbox}" />
Style="{StaticResource ModernTextbox}" /> </Grid>
</Grid>
<Button Style="{StaticResource ModernButton}" <Button Style="{StaticResource ModernButton}"
Height="45" Height="45"

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@@ -28,17 +29,24 @@ namespace LotteryApplication
private void BtnRaffleClick(object sender, RoutedEventArgs e) private void BtnRaffleClick(object sender, RoutedEventArgs e)
{ {
if (FirstTicket.Text != "" && LastTicket.Text != "")
{
int num1 = int.Parse(FirstTicket.Text);
int num2 = int.Parse(LastTicket.Text);
TicketList.Items.Clear();
Random rnd = new Random();
for (int i = 0; i <= 99; i++)
TicketList.Items.Add(rnd.Next(num1, num2));
}
else
{
MessageBox.Show("no valid Ticketnumber!");
}
int num1 = int.Parse(FirstTicket.Text);
int num2 = int.Parse(LastTicket.Text);
TicketList.Items.Clear();
Random rnd = new Random();
for (int i = 0; i <= 99; i++)
TicketList.Items.Add(rnd.Next(num1, num2));
} }
private void BtnExit(object sender, RoutedEventArgs e) private void BtnExit(object sender, RoutedEventArgs e)
@@ -56,5 +64,15 @@ namespace LotteryApplication
{ {
this.WindowState = WindowState.Minimized; this.WindowState = WindowState.Minimized;
} }
//private void FirstTicket_previewtextinput(object sender, TextCompositionEventArgs e)
//{
// e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
//}
//private void LastTicket_previewtextinput(object sender, TextCompositionEventArgs e)
//{
// //e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
//}
} }
} }

View File

@@ -24,7 +24,7 @@
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/> <Setter Property="Background" Value="#FF489448"/>
<Setter Property="Opacity" Value="0.8"/> <Setter Property="Opacity" Value="0.8"/>
<Setter Property="Foreground" Value="#FFAF9BB7"/> <Setter Property="Foreground" Value="#FFAF9BB7"/>
</Trigger> </Trigger>

View File

@@ -12,7 +12,8 @@
<Grid> <Grid>
<Rectangle StrokeThickness="1"/> <Rectangle StrokeThickness="1"/>
<TextBox Margin="1" <TextBox Margin="1"
Text="{TemplateBinding Text}" Text="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent},
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0" BorderThickness="0"
Background="Transparent" Background="Transparent"
VerticalContentAlignment="Center" VerticalContentAlignment="Center"
@@ -27,7 +28,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Padding="5" Padding="5"
Margin="10,0,0,0" Margin="5,0,0,0"
Foreground="#FF73C373"> Foreground="#FF73C373">
<TextBlock.Style> <TextBlock.Style>
<Style TargetType="{x:Type TextBlock}"> <Style TargetType="{x:Type TextBlock}">

View File

@@ -16,5 +16,5 @@ C:\Nathalie\Programmieren\Projekte\LotteryApplication\LotteryApplication\App.xam
193-1891726104 193-1891726104
MainWindow.xaml;Theme\ModernButtonTheme.xaml;Theme\ModernTextBoxTheme.xaml; MainWindow.xaml;Theme\ModernButtonTheme.xaml;Theme\ModernTextBoxTheme.xaml;
False True

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "78002E44A7F27DECE1537F2570F60833B1B8DA6A" #pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DC00031C45A17A4CF23733A38F48550DA65D1C39"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Dieser Code wurde von einem Tool generiert. // Dieser Code wurde von einem Tool generiert.
@@ -50,7 +50,7 @@ namespace LotteryApplication {
#line hidden #line hidden
#line 116 "..\..\..\MainWindow.xaml" #line 117 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox LastTicket; internal System.Windows.Controls.TextBox LastTicket;
@@ -58,7 +58,7 @@ namespace LotteryApplication {
#line hidden #line hidden
#line 154 "..\..\..\MainWindow.xaml" #line 153 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ListBox TicketList; internal System.Windows.Controls.ListBox TicketList;
@@ -127,7 +127,7 @@ namespace LotteryApplication {
return; return;
case 6: case 6:
#line 136 "..\..\..\MainWindow.xaml" #line 135 "..\..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnRaffleClick); ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnRaffleClick);
#line default #line default

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "78002E44A7F27DECE1537F2570F60833B1B8DA6A" #pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DC00031C45A17A4CF23733A38F48550DA65D1C39"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Dieser Code wurde von einem Tool generiert. // Dieser Code wurde von einem Tool generiert.
@@ -50,7 +50,7 @@ namespace LotteryApplication {
#line hidden #line hidden
#line 116 "..\..\..\MainWindow.xaml" #line 117 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox LastTicket; internal System.Windows.Controls.TextBox LastTicket;
@@ -58,7 +58,7 @@ namespace LotteryApplication {
#line hidden #line hidden
#line 154 "..\..\..\MainWindow.xaml" #line 153 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ListBox TicketList; internal System.Windows.Controls.ListBox TicketList;
@@ -127,7 +127,7 @@ namespace LotteryApplication {
return; return;
case 6: case 6:
#line 136 "..\..\..\MainWindow.xaml" #line 135 "..\..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnRaffleClick); ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.BtnRaffleClick);
#line default #line default