Exemplo n.º 1
0
        private void startButton_Click(object sender, EventArgs e)
        {
            string       path = Directory.GetCurrentDirectory() + @"\resourses\test";
            DialogResult dr   = MessageBox.Show("Пройти обучение?", "Обучение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                LearnIP lip = new LearnIP("training", "0", "");
                this.Hide();
                File.WriteAllText(path, gr1.id + " " + us1.id);
                lip.ShowDialog();
                ReadTests(gr1, us1);
                FullPeriodDraw();
                DrawGroupsDynamic(dateTimePicker4.Value, dateTimePicker3.Value);
                this.Show();
            }
            if (dr == DialogResult.No)
            {
                testBox.Items.Clear();
                ChooseVar cv = new ChooseVar();
                this.Hide();
                File.WriteAllText(path, gr1.id + " " + us1.id);
                cv.ShowDialog();
                ReadTests(gr1, us1);
                FullPeriodDraw();
                DrawGroupsDynamic(dateTimePicker4.Value, dateTimePicker3.Value);
                this.Show();
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (variant1 == "training")
            {
                string trueAnswer = "6443";

                int    counter = 0;
                string message = "Ошибки в примерах номер: ";
                for (int i = 0; i < 4; i++)
                {
                    if (trueAnswer[i].ToString() != answers[i].ToString())
                    {
                        if (counter != 0)
                        {
                            message += ", ";
                        }
                        counter++;
                        message += (i + 1);
                    }
                }
                if (counter == 0)
                {
                    message = "Без ошибок";
                }

                DialogResult dr = MessageBox.Show("Тренировка завершена!\n" + message + "\n\n Повторить тренировку?", "Тренировка завершена", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dr == DialogResult.Yes)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        answers[i] = 0;
                        boxes[(i * 10) + 3].ImageLocation = @"resourses\q.png";
                    }
                }
                else
                {
                    ChooseVar cv = new ChooseVar();
                    this.Hide();
                    cv.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                if (Convert.ToInt32(step1) == 6)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        results1 += answers[i].ToString();
                    }

                    Results res = new Results(results1, variant1);
                    this.Hide();
                    res.ShowDialog();
                    this.Close();
                }
                else
                {
                    step1 = (Convert.ToInt32(step1) + 1).ToString();

                    foreach (int i in answers)
                    {
                        results1 += i.ToString();
                    }

                    this.Hide();
                    LearnIP lip = new LearnIP(variant1, step1, results1);
                    lip.ShowDialog();
                    this.Close();
                }
            }
        }