added comments and wpf base

This commit is contained in:
4.E Zatko Dominik 2025-10-01 11:42:03 +02:00
parent 74c6a87254
commit ab86652859
146 changed files with 2046 additions and 290 deletions

View file

@ -0,0 +1,57 @@
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 WPF_kmap
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void boxOnClick(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
if (btn == null)
return;
int currentValue = 0;
if (btn.Tag != null)
{
currentValue = (int)btn.Tag;
}
else
{
if (btn.Content.ToString() == "X")
currentValue = -1;
else if (!int.TryParse(btn.Content.ToString(), out currentValue))
currentValue = 0;
}
int newValue;
if (currentValue == -1)
newValue = 0;
else if (currentValue == 0)
newValue = 1;
else
newValue = -1;
btn.Tag = newValue;
btn.Content = newValue == -1 ? "X" : newValue.ToString();
}
}
}