/// <summary>
        /// Checks the correctness of the equation and updates the propabilities for each number and the statistics of the user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            keys.FixResult();
            int    index = (int)LeftNum.Value - 1;
            string lbl;
            string lbl2;

            if (CultureInfo.CurrentCulture.Name.Equals("en-EN"))
            {
                lbl  = "Correct!";
                lbl2 = "Wrong!";
            }
            else
            {
                lbl  = "Σωστό!";
                lbl2 = "Λάθος!";
            }
            if (LeftNum.Value * RightNum.Value == ResultNum.Value)
            {
                msglabel.Text = lbl;
                statistics[2 * index]++;
                msglabel.ForeColor    = Color.Green;
                QuestionGroup.Visible = false;
                msglabel.Visible      = true;
                Wait();


                if (multipliers[index] > 0.9f)
                {
                    fix_probabilities(index, "-", 0.9f);
                }
            }
            else
            {
                msglabel.Text = lbl2;
                statistics[(2 * index) + 1]++;
                msglabel.ForeColor    = Color.Maroon;
                QuestionGroup.Visible = false;
                msglabel.Visible      = true;
                Wait();
                if (multipliers[index] <= 7.2)
                {
                    fix_probabilities(index, "+", 1.8f);
                }
                CreateQuestion();
            }
            for (int i = 0; i < probabilities.Length; i++)
            {
                Console.WriteLine(probabilities[i] + " , " + multipliers[i]);
            }

            Datamapper dm = new Datamapper();

            dm.GetConnection();
            dm.SaveMultipliers(multipliers, StartingForm.username);
            dm.SaveStats(probabilities, StartingForm.username);
            dm.SaveStatistics("Practice_Statistics", StartingForm.username, statistics, DateTime.Now);
            CreateQuestion();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks for the correctness of the equation and updates the statistics in the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            keys.FixResult();
            int index = (int)LeftNum.Value - 1;

            if (LeftNum.Value * RightNum.Value == ResultNum.Value)
            {
                points++;
                msglabel.Text = lbl;
                statistics[2 * index]++;
                msglabel.ForeColor    = Color.Green;
                QuestionGroup.Visible = false;
                msglabel.Visible      = true;
                Wait();
            }
            else
            {
                msglabel.Text = lbl2;
                statistics[(2 * index) + 1]++;
                msglabel.ForeColor    = Color.Maroon;
                QuestionGroup.Visible = false;
                msglabel.Visible      = true;
                Wait();
            }
            if (ThisQuestionNum < TotalQuestionsNum)
            {
                ConfirmButton.Enabled = true;
                BackButton.Enabled    = false;
                CreateQuestion();
            }
            else
            {
                dm.GetConnection();
                dm.SaveStatistics("Final_Statistics", StartingForm.username, statistics, DateTime.Now);
                if (CultureInfo.CurrentCulture.Name.Equals("en-EN"))
                {
                    MessageBox.Show("You've got " + points.ToString() + " out of " + TotalQuestionsNum.ToString() + " correct answets!");
                }
                else
                {
                    MessageBox.Show("Απάντησες σωστά " + points.ToString() + " από τις " + TotalQuestionsNum.ToString() + " ερωτήσεις!");
                }
                BackButton.Enabled    = true;
                ConfirmButton.Enabled = false;
            }
        }