コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(cathegoryComboBox.Text))
     {
         EducationForm edForm = new EducationForm(cathegoryComboBox.Text);
         this.Hide();
         edForm.Show();
     }
     else
     {
         MessageBox.Show("Не выбрана категория");
     }
 }
コード例 #2
0
        private void answeBbutton1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < checkList.Count; i++)
            {
                if (checkList[i].Checked)
                {
                    if (checkList[i].Text.Trim() == curentTasks[currentTestQuestion].CorrectAnswer.Trim())
                    {
                        rightAnswers++;
                        if (currentTestQuestion < curentTasks.Count)
                        {
                            foreach (RadioButton rb in checkList)
                            {
                                rb.Dispose();
                            }
                            checkList.Clear();
                            currentTestQuestion++;
                            if (currentTestQuestion < curentTasks.Count)
                            {
                                FormFiller(currentTestQuestion);
                            }

                            else
                            {
                                MessageBox.Show("Вы успешно прошли тест");

                                Cert cert = new Cert(currentTheme);
                                cert.Show();
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ответ неверен");
                        errors++;

                        if (errors == 2)
                        {
                            MessageBox.Show("Большое количество ошмбок. Повторите теорию");
                            EducationForm ed = new EducationForm(currentTheme);
                            ed.Show();
                            this.Close();
                        }
                        break;
                    }
                }
            }
        }