diff --git a/Lotto_Wpf/Lotto_Wpf/MainWindow.xaml.cs b/Lotto_Wpf/Lotto_Wpf/MainWindow.xaml.cs
index 59d66f2..80d93e6 100644
--- a/Lotto_Wpf/Lotto_Wpf/MainWindow.xaml.cs
+++ b/Lotto_Wpf/Lotto_Wpf/MainWindow.xaml.cs
@@ -1,24 +1,46 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-namespace test_4
+namespace LottoNumberBoard
{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
public partial class MainWindow : Window
{
+ private HashSet selectedNumbers = new();
+
public MainWindow()
{
InitializeComponent();
}
+
+ 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
+ {
+ selectedNumbers.Add(number);
+ btn.Background = Brushes.LightGreen;
+ }
+
+ UpdateResultDisplay();
+ }
+ }
+
+ private void UpdateResultDisplay()
+ {
+ var sorted = new List(selectedNumbers);
+ sorted.Sort();
+ ResultTextBlock.Text = string.Join(", ", sorted);
+ }
}
-}
\ No newline at end of file
+}