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.TimersWindow = ((Project_ChessWithInterface.TimerDialog)(target)); return; case 2: this.WhiteTime_txt = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.WhiteLabel = ((System.Windows.Controls.Label)(target)); return; case 4: this.BlackTime_txt = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.BlackLabel = ((System.Windows.Controls.Label)(target)); return; case 6: this.Submit_btn = ((System.Windows.Controls.Button)(target)); #line 14 "..\..\TimerDialog.xaml" this.Submit_btn.Click += new System.Windows.RoutedEventHandler(this.SubmitBtn_Click); #line default #line hidden return; } this._contentLoaded = true; }