public frmQuizManager(TriviaQuizData quizIn)
        {
            InitializeComponent();

            quizData = quizIn;
            ini = quizIn.Ini;
            unsavedChanges = false;
            currentKeyword = quizData.Keyword;

            FinishInit();
        }
        public frmQuizManager(ref frmNewQuizWizard quizWizardIn, ref IniLoader iniIn)
        {
            InitializeComponent();

            ini = iniIn;
            if (quizWizardIn.WizardUsed) quizData = new TriviaQuizData(ref quizWizardIn, ref ini);
            else quizData = null;
            unsavedChanges = quizWizardIn.WizardUsed;
            currentKeyword = null;

            FinishInit();
        }
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (txtKeyword.BackColor == Color.Red)
            {
                if (txtKeyword.Text.Length < 3)
                {
                    MessageBox.Show("The keyword is too short. It must be at least three characters long.",
                                    "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtKeyword.Focus();
                    return;
                }
                foreach (char checkChar in txtKeyword.Text.ToUpper())
                    if (!((checkChar >= 'A' && checkChar <= 'Z') || (checkChar >= '0' && checkChar <= '9')))
                    {
                        MessageBox.Show("The keyword may only contain letters and numbers.",
                                        "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        txtKeyword.Focus();
                        return;
                    }
                if (ini.IniSectionExists(txtKeyword.Text))
                {
                    MessageBox.Show("The keyword you have specified is already in use by another quiz. " +
                                    "(Note that the keyword is not case-sensitive.)",
                                    "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtKeyword.Focus();
                    return;
                }
            }
            else
            {
                if (lbxQuestions.Items.Count == 0 &&
                    MessageBox.Show("Are you sure you wish to save a quiz with no questions?",
                                    "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                                    == DialogResult.No) return;

                if (quizData == null) quizData = new TriviaQuizData();
                quizData.QuizName = txtQuizName.Text;
                quizData.Keyword = txtKeyword.Text;
                quizData.InvType = (InviteType)cbxInviteType.SelectedIndex;
                quizData.ChalPlayerLimit = (int)nudCPL.Value;
                quizData.ChalQuestionLimit = (int)nudCQL.Value;
                quizData.DefaultMaxAttempts = (int)nudDMA.Value;
                quizData.DefaultQuestionValue = (int)nudDQV.Value;
                quizData.DefaultTimeLimit = (int)nudDTL.Value;
                quizData.RandomOrder = chkRandom.Checked;
                quizData.RevealOnTimeout = chkROT.Checked;
                quizData.UpdateFrequency = this.UpdateFrequency;
                quizData.QDeck.Clear();
                foreach (TriviaQuestionData q in lbxQuestions.Items) quizData.QDeck.Add(q);

                unsavedChanges = false;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }