ProjektGlueckspiel/WpfApp1/MainWindow.xaml.cs
2025-06-11 14:06:59 +02:00

70 lines
1.7 KiB
C#

using System.Reflection.Emit;
using System.Text;
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.Navigation;
using System.Windows.Shapes;
namespace WpfApp1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
int[] ZufallsZahlen = new int[6];
public MainWindow()
{
InitializeComponent();
Zufallszahlen();
InLabels();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
private void Zufallszahlen()
{
Random random = new Random();
int index = 0;
while (index < 6)
{
int zahl = random.Next(1, 50);
if (ZufallsZahlen.Contains(zahl))
{
}
else
{
ZufallsZahlen[index] = zahl;
index++;
}
}
}
private void InLabels()
{
Label0.Content = ZufallsZahlen[0].ToString();
Label1.Content = ZufallsZahlen[1].ToString();
Label2.Content = ZufallsZahlen[2].ToString();
Label3.Content = ZufallsZahlen[3].ToString();
Label4.Content = ZufallsZahlen[4].ToString();
Label5.Content = ZufallsZahlen[5].ToString();
}
private void Mybutton_Click(object sender, RoutedEventArgs e)
{
Mybutton.Background = new SolidColorBrush(Colors.Red);
}
}
}