/*
         * Starts the test set with the given information.
         * If the files are read successfully, starts the test.
         * Otherwise, displays an error dialog.
         */
        private void startTestSet(Info.CategoryInfo categoryInfo, Info.TestSetInfo testSetInfo, int numRounds, int numQuestionsPerRound)
        {
            // Read the test set
            TestSet testSet = TestFileReader.readTestSet(categoryInfo, testSetInfo);

            // If the test set files were read successfully
            if (testSet != null)
            {
                // Remove the bad questions
                testSet.removeIncompleteOrInvalidQuestions();

                // Randomize the questions
                testSet.randomizeQuestions();

                // Calculate the total number of questions
                int numQuestions = numRounds * numQuestionsPerRound;

                // If there are enough questions in the test set
                if (numQuestions <= testSet.numQuestionsAvailable())
                {
                    // Set the number of rounds and questions
                    testSet.numRounds            = numRounds;
                    testSet.numQuestionsPerRound = numQuestionsPerRound;

                    // Go to the test start page
                    contentWindow.Content = new TestStartPage(contentWindow, testSet);
                }

                // If there are not enough questions in the test set
                else
                {
                    MessageBox.Show(
                        "Only " + testSet.numQuestionsAvailable() + " questions are available for \"" + testSetInfo.testSetStringLong + "\"." +
                        " You have selected " + numQuestions + " questions.",
                        "Not Enough Questions Available",
                        MessageBoxButton.OK,
                        MessageBoxImage.Warning
                        );

                    updatePage();
                    setDefaults(categoryInfo, testSetInfo);
                }
            }

            // If the test set files were not read
            else
            {
                MessageBox.Show(
                    "The test files for \"" + testSetInfo.testSetStringLong + "\" could not be found." +
                    "\n\nMake sure that the test files are located in the Tests folder." +
                    " If this error persists, redownload the application.",
                    "Test Files Not Found",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                    );

                updatePage();
                setDefaults(categoryInfo);
            }
        }
        /*
         * Returns false if any of the question data is incomplete or invalid.
         * (Does not check the user answer.)
         */
        public bool isQuestionDataCompleteAndValid()
        {
            // Text
            if (TestFileReader.IsNullOrWhiteSpace(text))
            {
                return(false);
            }
            if (text.Contains('\"'))
            {
                return(false);
            }

            // Answer options - keys
            foreach (char answerOption in "abcd")
            {
                if (answerOptions.ContainsKey(answerOption) == false)
                {
                    return(false);
                }
            }

            // Answer options - values
            foreach (String answerOption in answerOptions.Values)
            {
                if (TestFileReader.IsNullOrWhiteSpace(answerOption))
                {
                    return(false);
                }

                if (answerOption.Contains('\"'))
                {
                    return(false);
                }
            }

            // Correct answer
            if (answerOptions.Keys.Contains(correctAnswer) == false)
            {
                return(false);
            }

            // Correct answer explanation
            if (TestFileReader.IsNullOrWhiteSpace(correctAnswerExplanation))
            {
                return(false);
            }
            if (correctAnswerExplanation.Contains('\"'))
            {
                return(false);
            }

            return(true);
        }