-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
32 lines (27 loc) · 1.02 KB
/
MainWindow.xaml.cs
File metadata and controls
32 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Windows;
using ChessApp.ViewModels;
namespace ChessApp
{
public partial class MainWindow : Window
{
private ChessViewModel viewModel = new ChessViewModel();
public MainWindow()
{
InitializeComponent();
}
private void CreateButton_Click(object sender, RoutedEventArgs e)
{
viewModel.SelectedPiece = (PieceComboBox.SelectedItem as System.Windows.Controls.ComboBoxItem)?.Content.ToString();
viewModel.SelectedPieceColor = (PieceColorComboBox.SelectedItem as System.Windows.Controls.ComboBoxItem)?.Content.ToString();
viewModel.StartPosition = StartBox.Text.ToUpper();
viewModel.CreatePiece();
ResultText.Text = viewModel.ResultMessage;
}
private void MoveButton_Click(object sender, RoutedEventArgs e)
{
viewModel.TargetPosition = TargetBox.Text.ToUpper();
viewModel.TryMove();
ResultText.Text = viewModel.ResultMessage;
}
}
}