Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmQuestion2i Question2i = new frmQuestion2i();

            this.Hide();
            Question2i.Show();
        }
        private void btnIntermediate_Click(object sender, EventArgs e)
        {
            // Generate a random number
            RandomNumber = random.Next(1, 7);

            // This section of code will be used to select a new random question. It will ensure that the user does not recieve the same question twice.
            if (RandomNumber == 1 && Globalvariables.CompletedQuestionsI[0] == false)
            {
                frmQuestion1i Question1i = new frmQuestion1i();
                this.Close();
                Question1i.Show();
            }
            else if (RandomNumber == 2 && Globalvariables.CompletedQuestionsI[1] == false)
            {
                frmQuestion2i Question2i = new frmQuestion2i();
                this.Close();
                Question2i.Show();
            }
            else if (RandomNumber == 3 && Globalvariables.CompletedQuestionsI[2] == false)
            {
                frmQuestion3i Question3i = new frmQuestion3i();
                this.Close();
                Question3i.Show();
            }
            else if (RandomNumber == 4 && Globalvariables.CompletedQuestionsI[3] == false)
            {
                frmQuestion4 Question4i = new frmQuestion4();
                this.Close();
                Question4i.Show();
            }
            else if (RandomNumber == 5 && Globalvariables.CompletedQuestionsI[4] == false)
            {
                frmQuestion5i Question5i = new frmQuestion5i();
                this.Close();
                Question5i.Show();
            }
            else if (RandomNumber == 6 && Globalvariables.CompletedQuestionsI[5] == false)
            {
                frmQuestion6i Question6i = new frmQuestion6i();
                this.Close();
                Question6i.Show();
            }
            else if (RandomNumber == 7 && Globalvariables.CompletedQuestionsI[6] == false)
            {
                frmQuestion7i Question7i = new frmQuestion7i();
                this.Close();
                Question7i.Show();
            }
        }
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (Globalvariables.form == 5)
     {
         frmEndb Finish = new frmEndb(); // Opens end screen
         this.Hide();
         Finish.Show();                  // Opens end screen
         NextQuestion.Stop();
     }
     else
     {
         // This section of code will be used to select a new random question. It will ensure that the user does not recieve the same question twice.
         if (RandomNumber == 1 && Globalvariables.CompletedQuestionsI[0] == false)
         {
             frmQuestion1i Question1i = new frmQuestion1i();
             this.Close();
             Question1i.Show();
             NextQuestion.Stop();
         }
         else if (RandomNumber == 2 && Globalvariables.CompletedQuestionsI[1] == false)
         {
             frmQuestion2i Question2i = new frmQuestion2i();
             this.Close();
             Question2i.Show();
             NextQuestion.Stop();
         }
         else if (RandomNumber == 3 && Globalvariables.CompletedQuestionsI[2] == false)
         {
             frmQuestion3i Question3i = new frmQuestion3i();
             this.Close();
             Question3i.Show();
             NextQuestion.Stop();
         }
         else if (RandomNumber == 4 && Globalvariables.CompletedQuestionsI[3] == false)
         {
             frmQuestion4 Question4i = new frmQuestion4();
             this.Close();
             Question4i.Show();
             NextQuestion.Stop();
         }
         else if (RandomNumber == 5 && Globalvariables.CompletedQuestionsI[4] == false)
         {
             frmQuestion5i Question5i = new frmQuestion5i();
             this.Close();
             Question5i.Show();
             NextQuestion.Stop();
         }
         else if (RandomNumber == 6 && Globalvariables.CompletedQuestionsI[5] == false)
         {
             frmQuestion6i Question6i = new frmQuestion6i();
             this.Close();
             Question6i.Show();
             NextQuestion.Stop();
         }
         else if (RandomNumber == 7 && Globalvariables.CompletedQuestionsI[6] == false)
         {
             frmQuestion7i Question7i = new frmQuestion7i();
             this.Close();
             Question7i.Show();
             NextQuestion.Stop();
         }
         else
         {
             RandomNumber = random.Next(1, 7);
         }
     }
 }