예제 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            // load loading bar
            loadingBar.Increment(1);
            // show percentage
            lblPercentage.Show();
            lblPercentage.Text = Convert.ToString(loadingBar.Value + "%");

            //Show progress Text + Change Text
            if (loadingBar.Value < 30)
            {
                lblProgress.Show();
                lblProgress.Text = "Connecting to server";
            }
            if (loadingBar.Value > 30)
            {
                lblProgress.Text = "Establishing";
            }
            if (loadingBar.Value > 70)
            {
                lblProgress.Text = "Signing in";
            }

            // Load new form
            if (loadingBar.Value == 100)
            {
                Load.Stop();
                frmDifficulty Difficulty = new frmDifficulty();
                this.Hide();
                Difficulty.Show();
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            // This sectiom of code will reset any variables which could have been adjusted throughout the quiz.
            // This section will be used to state that none of the questions have been answered by the user.
            int i = 0;

            while (i < 7)
            {
                Globalvariables.CompletedQuestionsI[i] = false;
                i++;
            }

            // This will state that none of the answers are currently correct.
            int x = 0;

            while (x < 7)
            {
                Globalvariables.QuestionsCorrectI[x] = false;
                x++;
            }

            // This resets the variables which are used for the corrisponding questions, which is done to prevent any issues.
            Globalvariables.question4i = 0;
            Globalvariables.question6b = 0;
            Globalvariables.form       = 0;
            Globalvariables.timer      = 0;
            Globalvariables.points     = 0;              // this will reset the players points back to 0
            frmDifficulty restart = new frmDifficulty(); // I have named my form restart so that I can tell it to .show.

            this.Close();
            restart.Show();
        }