예제 #1
0
        //MARK: Button Event Handlers
        private void btnOK_Click(object sender, EventArgs e)
        {
            string subtitle = txtSubtitle.Text;

            // allows user to enter in a blank subtitle
            if (subtitle == "" || subtitle == null)
            {
                subtitle = " ";
            }

            if (Validation.ValidateCategoryTitle(txtTitle.Text) && Validation.ValidateCategorySubtitle(subtitle))
            {
                category.Title    = txtTitle.Text;
                category.Subtitle = txtSubtitle.Text;

                if (!DB_Update.UpdateCategory(category))
                {
                    MessageBox.Show("Updating Category Failed");
                }
                else
                {
                    DialogResult = DialogResult.OK;
                    Close();
                }
            }
        }
예제 #2
0
        private void bwUpdateCategory_DoWork(object sender, DoWorkEventArgs e) //also updates questions
        {
            int i = (int)e.Argument;                                           // i is category index

            DB_Update.UpdateCategory(currentCategory);

            for (int j = 0; j < game.NumQuestionsPerCategory; j++) // j is question index
            {
                game.Categories[i].Questions[j].ResetQuestionToDefaults();
                DB_Update.UpdateQuestion(game.Categories[i].Questions[j]);
            }
        }