Exemple #1
0
        private void showprogress()
        {
            DBProgressConnect DBProgressConnect_Inst = new DBProgressConnect();
            DataTable ProgressData = new DataTable();
            ProgressData = DBProgressConnect_Inst.Read(globaldata.current_user);
            datagrid1.ItemsSource = ProgressData.DefaultView;
            int data_count = DBProgressConnect_Inst.Count(globaldata.current_user);
            DateTime[] dates = new DateTime[data_count];
            double[] scores = new double[data_count];

            for (int i = 0; i < data_count; i++)
            {
                dates[i] = Convert.ToDateTime(ProgressData.Rows[i][1]);
                scores[i] = Convert.ToDouble(ProgressData.Rows[i][2]);
            }

            var datesDataSource = new EnumerableDataSource<DateTime>(dates);
            datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));

            var scoreDataSource = new EnumerableDataSource<double>(scores);
            scoreDataSource.SetYMapping(y => y);

            CompositeDataSource compositeDataSource1 = new CompositeDataSource(datesDataSource, scoreDataSource);

            Plotter.AddLineGraph(compositeDataSource1, new Pen(Brushes.Blue, 2), new CirclePointMarker { Size = 10.0, Fill = Brushes.Red }, new PenDescription("Time vs. Score for "+globaldata.current_user+""));

            Plotter.Viewport.FitToView();
        }
Exemple #2
0
        private void getques()
        {
            
            if (TotalQues==0)
            {
                score = 100 * nof_correct / (nof_correct+nof_unanswered+nof_wrong);
                System.Windows.MessageBox.Show("Correct: " + Convert.ToString(nof_correct) + " ,wrong: " + Convert.ToString(nof_wrong) + " ,Unanswered: " + Convert.ToString(nof_unanswered)+" : So, you scored : "+Convert.ToString(score)+"% in this session");
                DBProgressConnect DBProgressConnect_inst = new DBProgressConnect();
                //globaldata gb = new globaldata();
                DBProgressConnect_inst.Insert(globaldata.current_user, Convert.ToString(DateTime.Now), Convert.ToString(score));

                ActivitySelection Actv_Instnc = new ActivitySelection();
                this.Hide();
                Actv_Instnc.Show();
            }
            else
            {
                rdbtn1.IsChecked = false;
                rdbtn2.IsChecked = false;
                rdbtn3.IsChecked = false;
                rdbtn4.IsChecked = false;
                DBVocaConnect DBConnect_inst = new DBVocaConnect();
                int data_count = DBConnect_inst.Count();
                DataTable QuesLoadTable = new DataTable();
                QuesLoadTable = DBConnect_inst.Read();

                Random Rand_Gen = new Random();
                int[] x = new int[4];
                for (int j = 0; j < 4; j++)
                {
                    x[j] = Rand_Gen.Next(data_count + 1);
                }
                string ques;
                ques = QuesLoadTable.Rows[x[0]][1].ToString();
                ques = ques.Trim();
                txtblck1.Text = "Question: " + ques;
                CorrectAns = QuesLoadTable.Rows[x[0]][2].ToString();
                CorrectAns = CorrectAns.Trim();
                //label6.Content = "Database Entry: " + (x[0] + 1).ToString() + "\nCorrect Answer: " + CorrectAns;

                string[] AllAns = new string[4];
                for (int i = 0; i < 4; i++)
                {
                    AllAns[i] = QuesLoadTable.Rows[x[i]][2].ToString();
                }

                new Random().Shuffle(AllAns);

                rdbtn1.Content = AllAns[0].Trim();
                rdbtn2.Content = AllAns[1].Trim();
                rdbtn3.Content = AllAns[2].Trim();
                rdbtn4.Content = AllAns[3].Trim();

                TotalQues--;
            }
        }