Exemplo n.º 1
0
        private void Go_Click(object sender, EventArgs e)
        {
            int num = 1;

            category = dropdown.SelectedItem.ToString();
            ArrayList list = new ArrayList();
            Question  q    = new Question();

            dropdown.Enabled = false;
            Go.Enabled       = false;
            Submit.Enabled   = true;

            id = rand.Next(1, 11);
            randomNumbers.Add(id);
            list = q.getQuestion(id, category);

            if (list.Count > 1)
            {
                ques.Text = list[0].ToString();
                foreach (Control control in options.Controls)
                {
                    RadioButton radio = control as RadioButton;
                    radio.Enabled = true;
                    radio.Text    = list[num].ToString();
                    num++;
                }
            }
            else
            {
                error.Visible  = true;
                error.Text     = list[0].ToString();
                Submit.Enabled = false;
                Next.Enabled   = false;
            }
        }
Exemplo n.º 2
0
        private void Next_Click(object sender, EventArgs e)
        {
            int num = 1;

            explain.Visible = false;

            foreach (Control control in options.Controls)
            {
                RadioButton radio = control as RadioButton;
                radio.Checked = false;
            }

            Next.Enabled    = false;
            Submit.Enabled  = true;
            options.Enabled = true;
            options.Refresh();

            do
            {
                id = rand.Next(1, 11);
            }while (randomNumbers.Contains(id));
            randomNumbers.Add(id);

            Question  q    = new Question();
            ArrayList list = new ArrayList();

            list = q.getQuestion(id, category);

            if (list.Count > 1)
            {
                if (count < 4)
                {
                    ques.Text = list[0].ToString();
                    foreach (Control control in options.Controls)
                    {
                        RadioButton radio = control as RadioButton;
                        radio.Enabled = true;
                        radio.Text    = list[num].ToString();
                        num++;
                    }
                    count++;
                }

                else
                {
                    MessageBox.Show("You have successfully completed the quiz and scored " + points + " points");
                    Submit.Enabled = false;
                    foreach (Control control in options.Controls)
                    {
                        RadioButton radio = control as RadioButton;
                        radio.Enabled = false;
                    }
                }
            }
            else
            {
                error.Visible  = true;
                error.Text     = list[0].ToString();
                Submit.Enabled = false;
                Next.Enabled   = false;
            }
        }
Exemplo n.º 3
0
        private void Next_Click(object sender, EventArgs e)
        {
            int num = 1;

            explain.Visible = false;

            foreach (Control control in options.Controls)
            {
                RadioButton radio = control as RadioButton;
                radio.Checked = false;
            }

            Next.Enabled    = false;
            Submit.Enabled  = true;
            options.Enabled = true;
            options.Refresh();

            do
            {
                id = rand.Next(1, 16);
            }while (randomNumbers.Contains(id));
            randomNumbers.Add(id);

            Question  q    = new Question();
            ArrayList list = new ArrayList();

            list = q.getQuestion(id, category);

            if (list.Count > 1)
            {
                if (count <= 13)
                {
                    ques.Text = list[0].ToString();
                    foreach (Control control in options.Controls)
                    {
                        RadioButton radio = control as RadioButton;
                        radio.Enabled = true;
                        radio.Text    = list[num].ToString();
                        num++;
                        if (num == 4)
                        {
                            break;
                        }
                    }
                    count++;
                    if (count > 13)
                    {
                        {
                            MessageBox.Show("Ваши заработанные баллы: " + points);
                            Submit.Enabled = false;
                            foreach (Control control in options.Controls)
                            {
                                RadioButton radio = control as RadioButton;
                                radio.Enabled = false;
                            }
                        }
                    }
                }
            }
            else
            {
                error.Visible  = true;
                error.Text     = list[0].ToString();
                Submit.Enabled = false;
                Next.Enabled   = false;
            }
        }