private void btnStart_Click(object sender, RoutedEventArgs e) { stopwatch.Start(); dispatcher.Start(); stopwatch.Restart(); ComboBoxItem selectedDifficulty = (ComboBoxItem)btnLevel.SelectedItem; string difficulty = selectedDifficulty.Content.ToString(); Console.WriteLine(difficulty); Sudoku = new SudokuGenerator(difficulty); Sudoku.StartGame(); Sudoku.SetUndoStack(); Sudoku.SetRedoStack(); InsertIntoGameBoard(Sudoku); numberOfGames++; TextBoxSolutionsNumber.Text = $"True Solutions:{numberOfTrueGames}"; }
private void menuLoad_Click(object sender, RoutedEventArgs e) { if (TextBoxFileName.Text != "") { string partialName = TextBoxFileName.Text; DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(@"D:\"); FileInfo[] filesInDir = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*"); stopwatch.Start(); dispatcher.Start(); stopwatch.Restart(); ComboBoxItem selectedDifficulty = (ComboBoxItem)btnLevel.SelectedItem; string difficulty = selectedDifficulty.Content.ToString(); Console.WriteLine(difficulty); Sudoku = new SudokuGenerator(difficulty); Sudoku.SetUndoStack(); Sudoku.SetRedoStack(); int i = 0; while (i < filesInDir.Length && !LoadJson(filesInDir[i].FullName)) { i++; } if (i >= filesInDir.Length) { TextBoxError.Text = "Invalid FileName!"; } else { InsertIntoGameBoard(Sudoku); numberOfGames++; TextBoxSolutionsNumber.Text = $"True Solutions:{numberOfTrueGames}"; } } else { TextBoxError.Text = "Invalid FileName!"; } }