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 InsertIntoGameBoard(SudokuGenerator sudoku)
 {
     for (int i = 0; i < 9; i++)
     {
         for (int j = 0; j < 9; j++)
         {
             string        fieldContent = sudoku.Grid[i, j].Value == 0 ? "" : sudoku.Grid[i, j].Value.ToString();
             StringBuilder fieldName    = new StringBuilder("TextBox");
             fieldName.Append(i);
             fieldName.Append(j);
             TextBox cell = (TextBox)FindName(fieldName.ToString());
             cell.Text = fieldContent;
             if (sudoku.Grid[i, j].Constant == true)
             {
                 cell.IsReadOnly = true;
             }
             else
             {
                 cell.IsReadOnly = false;
             }
         }
     }
 }
 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!";
     }
 }