private void Submit_btn_Click(object sender, RoutedEventArgs e)//An event handler if the submit button is clicked. If AI option is chosen as an opponent - PlayerColorSelection dialog window is displayed. Then Timer dialog window is displayed. After all dialogs are completed the the mainWindow is displayed and this window is closed { if (OpponentSelection_list.SelectedItem != null && GameModeSelection_list.SelectedItem != null) { if (OpponentSelection_list.SelectedItem.ToString() == "AI") { PlayerColorSelectionDialog playerColorSelection = new PlayerColorSelectionDialog(); playerColorSelection.ShowDialog(); } else { Globals.AI = null; } TimerDialog timerDialog = new TimerDialog(); timerDialog.ShowDialog(); if (GameModeSelection_list.SelectedItem.ToString() == "Classical chess") { MainWindow.InitializeBoard(); MainWindow mainWindow = new MainWindow(0); mainWindow.Show(); this.Close(); } else if (GameModeSelection_list.SelectedItem.ToString() == "Fischer random chess (No castling)") { MainWindow.InitializeBoardFischerChess(); MainWindow mainWindow = new MainWindow(1); mainWindow.Show(); this.Close(); } } else { MessageBox.Show("Not all setting were selected."); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ColorSelectionDialog = ((Project_ChessWithInterface.PlayerColorSelectionDialog)(target)); return; case 2: this.label = ((System.Windows.Controls.Label)(target)); return; case 3: this.WhiteKing_btn = ((System.Windows.Controls.Button)(target)); return; case 4: this.BlackKing_btn = ((System.Windows.Controls.Button)(target)); return; } this._contentLoaded = true; }