/// <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();
        }
 public LearningTest()
 {
     InitializeComponent();
     msglabel.Location = new Point(300, 200);
     dm            = new Datamapper();
     probabilities = dm.GetStats(username);
     multipliers   = dm.GetMultipliers(username);
     statistics    = dm.GetStatistics("Practice_Statistics", username, DateTime.Now);
     numbers       = new string[10] {
         "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"
     };
     starting_Prob = probabilities[0] / multipliers[0];
 }
Пример #3
0
 public StartingForm()
 {
     InitializeComponent();
     dm = new Datamapper();
     dm.GetConnection();
 }
Пример #4
0
 public TestForm()
 {
     InitializeComponent();
     dm         = new Datamapper();
     statistics = dm.GetStatistics("Final_Statistics", username, DateTime.Now);
 }
        /// <summary>
        /// Refreshes the chart from database data depending on user selection.
        /// </summary>
        /// <param name="date"></param>
        public void refresh_chart(DateTime date)
        {
            if (datecombo.SelectedIndex == -1)
            {
                datecombo.SelectedIndex = 0;
            }
            int selected_el = datecombo.SelectedIndex;

            switch (selected_el)
            {
            case 1:
                date = date.AddMonths(-1);
                date = new DateTime(date.Year, date.Month, 1);
                break;

            case 2:
                date = date.AddMonths(-3);
                date = new DateTime(date.Year, date.Month, 1);
                break;

            case 3:
                date = new DateTime(date.Year, 1, 1);
                break;

            case 4:
                date = date.AddYears(-1);
                date = new DateTime(date.Year, 1, 1);
                break;

            default:
                date = new DateTime(date.Year, date.Month, 1);
                break;
            }
            string correct;
            string wrong;

            if (CultureInfo.CurrentCulture.Name.Equals("en-EN"))
            {
                correct = "Correct";
                wrong   = "Wrong";
            }
            else
            {
                correct = "Σωστά";
                wrong   = "Λανθασμένα";
            }
            corr_chart.Series[0].Name = correct;
            corr_chart.Series[1].Name = wrong;
            corr_chart.Series[correct].Points.Clear();
            corr_chart.Series[wrong].Points.Clear();
            Datamapper dm = new Datamapper();

            dm.GetConnection();
            List <(int, int)> differences = new List <(int, int)>();

            int[] statistics;
            if (testcombo.SelectedIndex == 0)
            {
                statistics = dm.GetStatistics("Practice_Statistics", username, date);
            }
            else
            {
                statistics = dm.GetStatistics("Final_Statistics", username, date);
            }
            int label = 1;

            for (int i = 0; i < 20; i += 2)
            {
                corr_chart.Series[correct].Points.AddXY(label, statistics[i]);
                corr_chart.Series[wrong].Points.AddXY(label, statistics[i + 1]);
                if (statistics[i] < statistics[i + 1])
                {
                    differences.Add((label, statistics[i + 1] - statistics[i]));