Beispiel #1
0
        private void BackBtn_Click(object sender, EventArgs e)
        {
            mainGameForm form = new mainGameForm();

            form.Show();
            this.Hide();
        }
        // ==> Function to store result in DB
        private void UploadResult()
        {
            // Print Result in Messgae Box
            ShowResult();

            // Get Gate and time of Game
            DateTime now = DateTime.Now;

            // Format Date time in yyyy-MM-dd HH:mm:ss Format to store in MySQL DB
            string datetime = now.ToString("yyyy-MM-dd HH:mm:ss");
            // Get the username of user who is playing ganme
            string username = mainGameForm.username;

            // If Result Store in DB print Confimation msg
            if (sql.uploadQuizResult(totalCorrectAns, datetime, totalscore, username))
            {
                MessageBox.Show("Result Saved in Cloud Successfully", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Error Occured During Uploading Result on Cloud", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Naigate to Main Game Home From
            this.Hide();
            mainGameForm form = new mainGameForm();

            form.Show();
        }
        // ==> Navigate to Game Home Page when Back Button Clicked
        private void BackBtn_Click(object sender, EventArgs e)
        {
            // If Game is Started
            // Ask User Confirmation
            if (QuestionID > 1)
            {
                // Stop the timer
                timer1.Stop();
                // if user want to continue playing
                if (showMessageBox())
                {
                    // start timer and return
                    timer1.Start();
                    return;
                }
            }
            // if user want to quit
            // stop the timer
            // Naviagte to MainGameForm
            timer1.Stop();
            timer1.Enabled = false;
            this.Hide();
            mainGameForm form = new mainGameForm();

            form.Show();
        }
Beispiel #4
0
        // Set Catagory for User
        // Either Cricket
        // Either Football
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (catagoryCombo.SelectedIndex == 1)
            {
                catagoryindex = 1;
            }
            if (catagoryCombo.SelectedIndex == 2)
            {
                catagoryindex = 2;
            }
            if (catagoryCombo.SelectedIndex == 0)
            {
                errorMessageLabel.Text = "Please Select Catagory";
                errorMessageLabel.Show();
                return;
            }

            // Naigate to Main Game Home From
            this.Hide();
            mainGameForm form = new mainGameForm();

            form.Show();
        }