/// <summary> /// Redirects user to play sudoku window with selected puzzle /// </summary> public void OpenSelectedPuzzle() { if (g_selectedTxBx.Text != ".") { string difficulty = ""; switch (g_selectedTxBx.Name[1]) { case '0': difficulty = "Beginner"; break; case '1': difficulty = "Moderate"; break; case '2': difficulty = "Advanced"; break; case '3': difficulty = "Extreme"; break; default: break; } string index = g_selectedTxBx.Name[3].ToString(); if (g_selectedTxBx.Name.Length > 4) { for (int k = 4; k < g_selectedTxBx.Name.Length; k++) { index += g_selectedTxBx.Name[k].ToString(); } } PlaySudoku play = new PlaySudoku(difficulty, g_puzzles[int.Parse(index)]) { Owner = Owner }; Hide(); play.ShowDialog(); Close(); } }
/// <summary> /// Calls the PlaySudoku class, sending the difficulty setting selected so that a puzzle with that difficulty can be selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Play_Sudoku_Click(object sender, RoutedEventArgs e) { WindowStartupLocation = WindowStartupLocation.CenterOwner; PlaySudoku playSudoku; Hide(); if (Difficulty_ComboBox.SelectedIndex == 0)//Beginner { playSudoku = new PlaySudoku("Beginner", "") { Owner = this }; playSudoku.ShowDialog(); } else if (Difficulty_ComboBox.SelectedIndex == 1)//Moderate { playSudoku = new PlaySudoku("Moderate", "") { Owner = this }; playSudoku.ShowDialog(); } else if (Difficulty_ComboBox.SelectedIndex == 2)//Advanced { playSudoku = new PlaySudoku("Advanced", "") { Owner = this }; playSudoku.ShowDialog(); } else //Extreme { playSudoku = new PlaySudoku("Extreme", "") { Owner = this }; playSudoku.ShowDialog(); } Show(); }