Compare commits

...

No commits in common. "main" and "415bb10663d5dffa975790ad62e3ab2f25049a8c" have entirely different histories.

15 changed files with 289 additions and 486 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

260
.gitignore vendored
View File

@ -1,67 +1,11 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
*.pdb
*.dll.config
*.cache
*.suo
# Include dlls if theyre in the NuGet packages directory
!/packages/*/lib/*.dll
# Include dlls if they're in the CommonReferences directory
!*CommonReferences/*.dll
####################
# VS Upgrade stuff #
####################
_UpgradeReport_Files/
###############
# Directories #
###############
bin/
obj/
TestResults/
###################
# Web publish log #
###################
*.Publish.xml
#############
# Resharper #
#############
/_ReSharper.*
*.ReSharper.*
############
# Packages #
############
# its better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
######################
# Logs and databases #
######################
*.log
*.sqlite
# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
@ -69,6 +13,9 @@ Thumbs.db
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@ -76,38 +23,63 @@ Thumbs.db
[Rr]eleases/
x64/
x86/
build/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studo 2015 cache/options directory
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
@ -117,6 +89,8 @@ artifacts/
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
@ -131,14 +105,21 @@ _Chutzpah*
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
@ -151,18 +132,29 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
@ -190,74 +182,182 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Windows Azure Build Output
# Microsoft Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
!?*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
bower_components/
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35931.197 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lotto_Wpf", "Lotto_Wpf\Lotto_Wpf.csproj", "{E54485DB-84A3-45CA-98CB-C10347CA8CC4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lotto_WPF", "Lotto_WPF\Lotto_WPF.csproj", "{11508812-14FF-4C7C-A0C8-D446CE063F66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E54485DB-84A3-45CA-98CB-C10347CA8CC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E54485DB-84A3-45CA-98CB-C10347CA8CC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E54485DB-84A3-45CA-98CB-C10347CA8CC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E54485DB-84A3-45CA-98CB-C10347CA8CC4}.Release|Any CPU.Build.0 = Release|Any CPU
{11508812-14FF-4C7C-A0C8-D446CE063F66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{11508812-14FF-4C7C-A0C8-D446CE063F66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11508812-14FF-4C7C-A0C8-D446CE063F66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11508812-14FF-4C7C-A0C8-D446CE063F66}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AB474776-D9C7-4AE0-9D9B-1DC4F8AB430D}
SolutionGuid = {49FFDDEF-C3C0-40D5-A88F-39460E29B7AC}
EndGlobalSection
EndGlobal

View File

@ -1,7 +1,7 @@
<Application x:Class="Lotto_Wpf.App"
<Application x:Class="Lotto_WPF.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Lotto_Wpf"
xmlns:local="clr-namespace:Lotto_WPF"
StartupUri="MainWindow.xaml">
<Application.Resources>

View File

@ -2,7 +2,7 @@
using System.Data;
using System.Windows;
namespace Lotto_Wpf
namespace Lotto_WPF
{
/// <summary>
/// Interaction logic for App.xaml

12
Lotto_WPF/MainWindow.xaml Normal file
View File

@ -0,0 +1,12 @@
<Window x:Class="Lotto_WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Lotto_WPF"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View File

@ -0,0 +1,24 @@
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 Lotto_WPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

View File

@ -1,39 +0,0 @@
using System;
using System.Linq;
namespace LottoProject
{
public class Lotto
{
public int[] GezogeneZahlen { get; private set; } = new int[6];
public int TrefferAnzahl { get; private set; } = 0;
public Lotto(int[] userZahlen)
{
Ziehen();
TrefferAnzahl = Treffer(userZahlen, GezogeneZahlen);
}
private void Ziehen()
{
Random rnd = new();
for (int i = 0; i < GezogeneZahlen.Length; i++)
{
int zahl;
do
{
zahl = rnd.Next(1, 50);
}
while (GezogeneZahlen.Contains(zahl));
GezogeneZahlen[i] = zahl;
}
}
public int Treffer(int[] user, int[] gezogen)
{
return user.Count(gezogen.Contains);
}
}
}

View File

@ -1,25 +0,0 @@
<Window x:Class="LottoNumberBoard.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Lotto Number Board" Height="600" Width="400">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<DockPanel Margin="10">
<StackPanel DockPanel.Dock="Bottom" Margin="0,10,0,0">
<TextBlock Text="Selected Numbers:" FontWeight="Bold" FontSize="16" />
<TextBlock x:Name="ResultTextBlock" FontSize="14" Foreground="DarkBlue" TextWrapping="Wrap"/>
<TextBlock Text="Startgeld (€):" FontWeight="Bold" Margin="0,10,0,0"/>
<TextBox x:Name="StartgeldTextBox" Text="2000" Width="100" Margin="0,0,0,10"/>
<Button Content="Ziehen" Margin="0,10,0,0" Click="DrawButton_Click" Height="30"/>
<Button Content="Simulation starten" Margin="0,10,0,0" Click="SimulationButton_Click" Height="30"/>
</StackPanel>
<ScrollViewer DockPanel.Dock="Top">
<UniformGrid x:Name="NumberGrid" Columns="7" Rows="7" Margin="0,0,0,10"/>
</ScrollViewer>
</DockPanel>
</ScrollViewer>
</Window>

View File

@ -1,149 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using LottoProject;
using System.Diagnostics;
using System.Threading.Tasks;
namespace LottoNumberBoard
{
public partial class MainWindow : Window
{
private HashSet<int> selectedNumbers = new();
public MainWindow()
{
InitializeComponent();
GenerateNumberButtons();
}
private void GenerateNumberButtons()
{
for (int i = 1; i <= 49; i++)
{
Button btn = new Button
{
Content = i.ToString(),
Tag = i,
Margin = new Thickness(5)
};
btn.Click += NumberButton_Click;
NumberGrid.Children.Add(btn);
}
}
private void NumberButton_Click(object sender, RoutedEventArgs e)
{
if (sender is Button btn && int.TryParse(btn.Content.ToString(), out int number))
{
if (selectedNumbers.Contains(number))
{
selectedNumbers.Remove(number);
btn.ClearValue(Button.BackgroundProperty);
}
else
{
if (selectedNumbers.Count >= 6)
{
MessageBox.Show("Nur 6 Zahlen erlaubt!", "Hinweis", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
selectedNumbers.Add(number);
btn.Background = Brushes.LightGreen;
}
UpdateResultDisplay();
}
}
private void UpdateResultDisplay()
{
var sorted = selectedNumbers.OrderBy(n => n);
ResultTextBlock.Text = "Ausgewählt: " + string.Join(", ", sorted);
}
private void DrawButton_Click(object sender, RoutedEventArgs e)
{
if (selectedNumbers.Count != 6)
{
MessageBox.Show("Bitte wähle genau 6 Zahlen!", "Warnung", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
int[] userZahlen = selectedNumbers.ToArray();
Lotto lotto = new Lotto(userZahlen);
string gezogene = string.Join(", ", lotto.GezogeneZahlen.OrderBy(n => n));
string getroffene = string.Join(", ", userZahlen.Intersect(lotto.GezogeneZahlen).OrderBy(n => n));
int anzahlTreffer = lotto.TrefferAnzahl;
ResultTextBlock.Text += $"\nGezogene Zahlen: {gezogene}";
ResultTextBlock.Text += $"\nTreffer: {anzahlTreffer} ({getroffene})\n";
}
private async void SimulationButton_Click(object sender, RoutedEventArgs e)
{
if (selectedNumbers.Count != 6)
{
MessageBox.Show("Bitte wähle genau 6 Zahlen für die Simulation!", "Warnung", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
int[] meineZahlen = selectedNumbers.ToArray();
int[] trefferVerteilung = new int[7];
int meinGeld;
if (!int.TryParse(StartgeldTextBox.Text, out meinGeld))
{
MessageBox.Show("Bitte gültigen Startgeldbetrag eingeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
int versuche = 1000;
var stopwatch = new Stopwatch();
stopwatch.Start();
await Task.Run(() =>
{
Random rnd = new();
for (int i = 0; i < versuche; i++)
{
HashSet<int> zufallsZahlen = new();
while (zufallsZahlen.Count < 6)
zufallsZahlen.Add(rnd.Next(1, 50));
Lotto lotto = new Lotto(zufallsZahlen.ToArray());
int treffer = lotto.Treffer(meineZahlen, lotto.GezogeneZahlen);
trefferVerteilung[treffer]++;
meinGeld -= 5;
switch (treffer)
{
case 3: meinGeld += 20; break;
case 4: meinGeld += 400; break;
case 5: meinGeld += 20000; break;
case 6: meinGeld += 100000000; break;
}
}
});
stopwatch.Stop();
StringBuilder sb = new();
sb.AppendLine("\nSimulation abgeschlossen:");
for (int i = 0; i < trefferVerteilung.Length; i++)
{
sb.AppendLine($"{i} Treffer: {trefferVerteilung[i]}x");
}
sb.AppendLine($"\nDauer: {stopwatch.Elapsed.TotalSeconds:F2} Sekunden");
sb.AppendLine($"Kontostand: {meinGeld} €");
ResultTextBlock.Text += "\n" + sb.ToString();
}
}
}

View File

@ -1,123 +0,0 @@
Protokoll2.0
1. Das erste Protokoll nicht wieder gefunden sehr wahrscheinlich nicht gespeichert
2. Vs 2022 ist mit Git sehr unübersichtlich musste mit ihnen reden um das zu connacten
3. Eigenes .gitignore von github gemacht es gab kein preset
4. Pushen und sync ist nervig in vs2022 deshalb in vs code geöffnet
5. Wlan ist echt scheiße alles dauert lange (verzögert arbeit) dauert teilweise 10min
6. Duy Ahn Problem (
7. Nach dem sync vom repo aus sicht von Nik (Ungültiges markup)
Man konnte die fehlermeldungen nicht kopieren sondern nur screenshot machen.
8. Es wurden och mal neu geclont dann waren es 6 probleme Duy hatt neu gemacht dann ging es
9. Bei Nik wurde geld doppelt abgezogen es musste eine line gelösht werden weil im switch case -5 im default ist.
10. Probleme von Duy Anh:
Probleme und Lösungen bei der Erstellung einer Lotto-App mit WPF
1. Problem: Wie sieht ein normales Lotto aus?
Lösung: auf internet suchen
________________________________________
2. Problem: Die Benutzeroberfläche (UI) auswählen
Lösung: Eine sehr einfache UI wählen z.B. direkt Zahlen auswählen und spielen, ohne viele Menüs. Das vermeidet viele Fehlerquellen.
________________________________________
3. Problem: Beim Öffnen in Visual Studio 2022 ist alles weiß
Lösung: Einfach das Projekt mit Strg + shift + B (Build) kompilieren. Danach wird alles wieder korrekt angezeigt.
________________________________________
4. Problem: Button reagiert nicht beim Klicken
Lösung: Button so programmieren, dass er die Farbe ändert, wenn er gedrückt wird:
if (selectedNumbers.Contains(number))
{
selectedNumbers.Remove(number);
btn.ClearValue(Button.BackgroundProperty);
}
else
{
selectedNumbers.Add(number);
btn.Background = Brushes.LightGreen;
}
________________________________________
5. Problem: Eine Zahl kann mehrfach ausgewählt werden
Lösung: Prüfen, ob die Zahl schon ausgewählt ist falls ja, wieder abwählen:
if (selectedNumbers.Contains(number))
{
selectedNumbers.Remove(number);
btn.ClearValue(Button.BackgroundProperty);
}
else
{
selectedNumbers.Add(number);
btn.Background = Brushes.LightGreen;
}
________________________________________
6. Problem: Man kann eine Zahl nicht abwählen
Lösung:
if (selectedNumbers.Contains(number))
{
selectedNumbers.Remove(number);
btn.ClearValue(Button.BackgroundProperty);
}
else
{
selectedNumbers.Add(number);
btn.Background = Brushes.LightGreen;
}
11. Probleme von Nik:
1. Problem: Ich musste schon wie der code von WFP auf, denn code von Programm passt.,
Lösung: Ich habe das WPF auf den Code sehr viel angepasst.
2.Problem: Es konnten zu viele Zahlen ausgewellt werden.
if (selectedNumbers.Contains(number))
{
selectedNumbers.Remove(number);
btn.ClearValue(Button.BackgroundProperty);
}
anders
{
if (selectedNumbers.Count >= 6)
{
MessageBox.Show("Nur 6 Zahlen erlaubt!", "Hinweis", MessageBoxButton.OK, MessageBoxImage.Information);
zurückkehren;
}
selectedNumbers.Add(number);
btn.Background = Brushes.LightGreen;
}
3.Problem: Konnte erst nicht pushen.
Lösung: Habe dann Visual Studio Code genommen.
4.Problem: Vergessen, dass man Geld selbst eingeben soll.
Lösung: int meinGeld;
if (!int.TryParse(StartgeldTextBox.Text, out meinGeld))
{
MessageBox.Show("Bitte gültigen Startgeldbetrag eingeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
zurückkehren;
}
12. Wenn man zu viel gespielt hatt wurden die Button abgeschnitten und nur die ergebnisse waren zu sehen. Mann konnte nicht weiter spielen.
Lösung: die lösung war das ich alles in xaml in <ScrollViewer VerticalScrollBarVisibility="Auto"> packen muste

Binary file not shown.

View File

@ -1,61 +1 @@
# WPF Lotto Number Board
Ein einfaches, interaktives Lotto-Programm mit GUI entwickelt mit WPF in C# von **Duy Anh**, **Nik Heise** und **Daniel**.
## Projektbeschreibung
Das Projekt „Lotto Number Board“ ist eine WPF-Anwendung, mit der man:
- 6 Lottozahlen auswählen kann (149)
- eine Ziehung simulieren kann
- eine umfangreiche Simulation mit Startkapital durchführen kann, um die Gewinnchancen und Rendite zu analysieren
## Features
- Auswahl von 6 Zahlen über ein grafisches Button-Grid
- Simulation von 1000 Ziehungen zur Auswertung der Gewinnverteilung
- Startgeld-Verwaltung mit Ausgaben (5€/Spiel) und Gewinnen
- Statistiken über Trefferverteilung und End-Kontostand
- Benutzerfreundliche Oberfläche mit automatischem Scrollbereich
## Technologien
- **WPF (Windows Presentation Foundation)**
- **C#**
- **.NET**
- Multithreading mit `Task.Run`
- UI-Elemente wie `UniformGrid`, `ScrollViewer`, `TextBlock`, `TextBox`, `Button`
## Verwendung
1. Projekt in Visual Studio öffnen.
2. Startgeld in das Textfeld eingeben (z.B. `2000`).
3. 6 Zahlen durch Klick auf Buttons auswählen.
4. Auf **"Ziehen"** klicken für eine einfache Ziehung.
5. Auf **"Simulation starten"** klicken, um 1000 Spiele mit Gewinn-/Verlustauswertung zu simulieren.
## Beispielausgabe
Ausgewählt: 3, 14, 22, 27, 35, 44
Gezogene Zahlen: 5, 14, 18, 22, 27, 33
Treffer: 3 (14, 22, 27)
Simulation abgeschlossen:
0 Treffer: 529x
1 Treffer: 303x
2 Treffer: 121x
3 Treffer: 37x
4 Treffer: 10x
5 Treffer: 0x
6 Treffer: 0x
Dauer: 1.45 Sekunden
Kontostand: 1320 €
## Autoren
- **Daniel**
- **Duy Anh**
- **Nik**
## Lizenz
Dies ist ein Lernprojekt im Rahmen unserer Ausbildung. Nutzung auf eigene Gefahr
# Lotto_WPF