Beispiel #1
0
        public QuestionsPage()
        {
            this.InitializeComponent();
            subject = new SubjectViewModel();
            correct_answer = new English();
            maths = new Maths();
            business = new Business();
            accounting = new Accounting();
            geography = new Geography();
            history = new History();
            life = new Life();
            physics = new Physics();
            time.Start();

        }
Beispiel #2
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            lblPopup.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            lblNumberOfQuestions.Text = selItem + " questions will be generated randomly";
            btnFinish.IsEnabled = true;
            btnStartAgain.IsEnabled = true;
            //lblTotalMarks.Visibility = Windows.UI.Xaml.Visibility.Visible;
            if (countTimer < 5 || countTimer < 15 || countTimer20 < 61 || countTimer30 < 75 || countTimer50 < 120)
            {
                lblTimeRunning.Text = "Dear learner, you are running out of time";
            }
            btnStartAgain.Visibility = Windows.UI.Xaml.Visibility.Visible;
            if (countTimer == 0)
            {
                messageBox("You have ran out of time ,your total mark = " + marks + "/" + 10);
                lblTimeElapsed.Text = "You have ran out of time ,your total mark = " + marks + "/" + 10;
                radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblQuestion.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                btnStartAgain.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
            else if (countTimer20 == 0)
            {
                messageBox("You have ran out of time ,your total mark = " + marks + "/" + 20);
                lblTimeElapsed.Text = "You have ran out of time ,your total mark = " + marks + "/" + 20;
                radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblQuestion.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                btnFinish.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
            else if (countTimer30 == 0)
            {
                messageBox("You have ran out of time ,your total mark = " + marks + "/" + 30);
                lblTimeElapsed.Text = "You have ran out of time ,your total mark = " + marks + "/" + 30;
                radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblQuestion.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                btnFinish.Visibility = Windows.UI.Xaml.Visibility.Visible;
                btnNext.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else if (countTimer50 == 0)
            {
                messageBox("You have ran out of time ,your total mark = " + marks + "/" + 50);
                lblTimeElapsed.Text = "You have ran out of time ,your total mark = " + marks + "/" + 50;
                radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblQuestion.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                btnFinish.Visibility = Windows.UI.Xaml.Visibility.Visible;
                btnNext.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Visible;
            radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Visible;
            radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Visible;
            lblDisplayMark.Visibility = Windows.UI.Xaml.Visibility.Visible;
            lblTop.Visibility = Windows.UI.Xaml.Visibility.Visible;
            lblTop2.Visibility = Windows.UI.Xaml.Visibility.Visible;
            btnFinish.Visibility = Windows.UI.Xaml.Visibility.Visible;
            btnNext.Visibility = Windows.UI.Xaml.Visibility.Visible;

            module = new InsertModule();
            int number = 0;
            myList = new List<SubjectViewModel>();
            subjects = new ObservableCollection<SubjectViewModel>();
            subjectsList = new List<SubjectViewModel>();

            subjectModel = new SubjectsViewModel();

            string grade = item.Substring(0, item.IndexOf(":"));
            table = item.Substring(item.IndexOf(":") + 1);

            btnNext.Content = "Question " + countButton + ".";
            try
            {
                if (table.Equals("English"))
                {

                    subjects = subjectModel.getEnglishQuestions1(grade);
                    subjectsList = subjectModel.getEnglishQuestion(grade);
                    myList = subjectModel.getEnglishQuestion(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;

                    it = names[number];

                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));

                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    correct_answer = subject.getEnglishCorrectAnswer(pass_question);

                    if (subject.verifyExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];

                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }
                }
                else if (table.Equals("Maths"))
                {
                    subjects = subjectModel.getMathsQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    maths = subject.getMathsCorrectAnswer(pass_question);
                    if (subject.verifyMathsExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
                else if (table.Equals("Business"))
                {
                    subjects = subjectModel.getBusinessQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    business = subject.getBusinessCorrectAnswer(pass_question);
                    if (subject.verifyBusinessExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
                else if (table.Equals("Accounting"))
                {
                    subjects = subjectModel.getAccountingQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    accounting = subject.getAccountingCorrectAnswer(pass_question);
                    if (subject.verifyAccountingExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
                else if (table.Equals("Geography"))
                {
                    subjects = subjectModel.getGeographyQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    geography = subject.getGeographyCorrectAnswer(pass_question);
                    if (subject.verifyGeographyExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
                else if (table.Equals("History"))
                {
                    subjects = subjectModel.getHistoryQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    history = subject.getHistoryCorrectAnswer(pass_question);
                    if (subject.verifyHistoryExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
                else if (table.Equals("Life"))
                {
                    subjects = subjectModel.getLifeOrientationQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + "." + it.Substring(0, it.IndexOf("#"));
                    life = subject.getLifeCorrectAnswer(pass_question);
                    if (subject.verifyLifeOriontationExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
                else if (table.Equals("Physics"))
                {
                    subjects = subjectModel.getPhysicsQuestions1(grade);
                    int totalItems = subjects.Count();
                    int count = 0;
                    names = new string[subjects.Count()];
                    foreach (var i in subjects)
                    {
                        names[count] = i.QUESTION + "#" + i.ANSWER + "#" + i.ANSWER1 + "#" + i.ANSWER2;
                        count++;
                    }
                    combo.SelectedIndex.ToString();
                    string answer1 = string.Empty, answer2 = string.Empty, answer3 = string.Empty;
                    if (readQuestion.Equals(number)) { }
                    number = random.Next(0, totalItems);
                    readQuestion = number;
                    it = names[number];
                    names = it.Split('#');
                    answer1 = names[1];
                    answer2 = names[2];
                    answer3 = names[3];
                    pass_question = it.Substring(0, it.IndexOf("#"));
                    myQuestion = pass_question;
                    lblQuestion.Text = countButton + ".  " + it.Substring(0, it.IndexOf("#"));
                    physics = subject.getPhysicsCorrectAnswer(pass_question);
                    if (subject.verifyPhysicsExist(pass_question, answer1))
                    {
                        string[] answers_array = { answer1, answer2, answer3 };
                        Random ran = new Random();
                        int num = 0;
                        num = ran.Next(0, 2);
                        int num1 = ran.Next(0, 2);
                        int num2 = ran.Next(0, 2);
                        if (num == num1)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[0];
                        }
                        else if (num == num2)
                        {
                            radAnswer1.Content = answers_array[0];
                            radAnswer2.Content = answers_array[1];
                            radAnswer3.Content = answers_array[2];
                        }
                        else if (num1 == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else if (num == num1 && num == num2)
                        {
                            radAnswer1.Content = answers_array[2];
                            radAnswer2.Content = answers_array[0];
                            radAnswer3.Content = answers_array[1];
                        }
                        else
                        {
                            radAnswer1.Content = answers_array[num];
                            radAnswer2.Content = answers_array[num1];
                            radAnswer3.Content = answers_array[num2];
                        }
                    }

                }
            }
            catch
            {

            }

            radAnswer1.IsChecked = false;
            radAnswer2.IsChecked = false;
            radAnswer3.IsChecked = false;

            radAnswer1.IsEnabled = true;
            radAnswer2.IsEnabled = true;
            radAnswer3.IsEnabled = true;
            // time.Interval = new TimeSpan(0, 0, 0, 1);
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            if (combo.SelectedItem != null)
            {
                selItem = int.Parse(combo.SelectedItem.ToString());
                //messageBox("Selected is " + selItem);
                if (countButton > selItem)
                {
                    btnNext.Content = "Finish";
                    if (marks > 0)
                    {
                        if (selItem == 10)
                        {

                            marks = (marks / 10) * 100;
                        }
                        if (selItem == 20)
                        {
                            marks = (marks / 20) * 100;
                        }
                        if (selItem == 30)
                        {
                            marks = (marks / 30) * 100;
                        }
                        if (selItem == 50)
                        {
                            marks = (marks / 50) * 100;
                        }
                    }
                    time.Stop();
                    ////////////////////////////////////////////////////////////////////////////////////////

                    string message = "";
                    if (marks < 50)
                    {
                        // message = "Sorry You failed the test";
                        lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% ";
                        //lblTotalMarks.Text = message;
                    }
                    else if (marks >= 50 && marks < 75)
                    {
                        message = "You passed the test with an avarage score";
                        lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% ";
                    }
                    else if (marks >= 75)
                    {
                        message = "Passed with Distinction";
                        lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% ";

                    }
                    lblNumberOfQuestions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;//lblTotalMarks.Text = message;
                    //messageBox("Complete!!! :Total marks " + marks + "% " + message);
                    //lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% " + message;
                    if (table.Equals("Accounting"))
                    {
                        subject.removeAllAccountingQuestions(); module.pupulateAccountingTable();
                    }
                    else if (table.Equals("Business"))
                    {
                        subject.removeAllBusinessQuestions(); module.pupulateBusinessTable();
                    }
                    else if (table.Equals("English"))
                    {
                        subject.removeAll(); module.populateEnglishTables();
                    }
                    else if (table.Equals("Geography"))
                    {
                        subject.removeAllGeographyQuestions(); module.pupulateGeographyTable();
                    }
                    else if (table.Equals("History"))
                    {
                        subject.removeAllHistoryQuestions(); module.pupulateHistoryTable();
                    }
                    else if (table.Equals("Life"))
                    {
                        subject.removeAllLifeQuestions(); module.pupulateLifeOrientationTable();
                    }
                    else if (table.Equals("Maths"))
                    {
                        subject.removeAllMathsQuestions(); module.pupulateMathsTable();
                    }
                    else if (table.Equals("Physics"))
                    {
                        subject.removeAllPhysicsQuestions(); module.pupulatePhysicsTable();
                    }
                    btnNext.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    lblQuestion.Text = "";
                    btnFinish.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                }

            }
            else
            {
                lblNumberOfQuestions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                if (countButton > 10)
                {
                    time.Stop();
                    btnNext.Content = "Finish";
                    if (marks > 0)
                    {
                        if (selItem == 10)
                        {
                            marks = (marks / 10) * 100;

                        }
                    }
                    string message = "";
                    if (marks < 50)
                    {
                        message = "Sorry You failed the test";
                        lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% ";

                    }
                    else if (marks >= 50 && marks < 75)
                    {
                        message = "You passed the test with an avarage mark";
                        lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% ";
                    }
                    else if (marks >= 75)
                    {
                        message = "Passed with Distinction";
                        lblTotalMarks.Text = "Complete!!! :Total marks " + marks + "% ";
                    }
                    double store = marks = (marks / 10) * 100;
                    //messageBox("Complete!!! :Total marks " + store + "% ");
                    //lblTotalMarks.Text = "Complete!!! :Total marks " + store + "% "+message;
                    lblNumberOfQuestions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    btnNext.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    lblQuestion.Text = "";
                    btnFinish.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    if (table.Equals("Accounting"))
                    {
                        subject.removeAllAccountingQuestions(); module.pupulateAccountingTable();
                    }
                    else if (table.Equals("Business"))
                    {
                        subject.removeAllBusinessQuestions(); module.pupulateBusinessTable();
                    }
                    else if (table.Equals("English"))
                    {
                        subject.removeAll(); module.populateEnglishTables();
                    }
                    else if (table.Equals("Geography"))
                    {
                        subject.removeAllGeographyQuestions(); module.pupulateGeographyTable();
                    }
                    else if (table.Equals("History"))
                    {
                        subject.removeAllHistoryQuestions(); module.pupulateHistoryTable();
                    }
                    else if (table.Equals("Life"))
                    {
                        subject.removeAllLifeQuestions(); module.pupulateLifeOrientationTable();
                    }
                    else if (table.Equals("Maths"))
                    {
                        subject.removeAllMathsQuestions(); module.pupulateMathsTable();
                    }
                    else if (table.Equals("Physics"))
                    {
                        subject.removeAllPhysicsQuestions(); module.pupulatePhysicsTable();
                    }
                }
            }
            /*if (!(radAnswer1.IsChecked == true) || !(radAnswer2.IsChecked == true) || !(radAnswer3.IsChecked == true))
            {
                messageBox("You have to select at least one of the answers");
            }*/
            if (countTimer == 0 || countTimer20 == 0 || countTimer30 == 0 || countTimer50 == 0)
            {
                lblQuestion.Text = "";
                lblTop.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTop2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                radAnswer3.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                lblTimeRunning.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                btnNext.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                time.Stop();
            }
            countButton++;
            subject.remove(pass_question);
            subject.removeMaths(pass_question);
            subject.removeBusiness(pass_question);
            subject.removeAccounting(pass_question);
            subject.removeGeography(pass_question);
            subject.removeHistory(pass_question);
            subject.removeLifeOrientation(pass_question);
            subject.removePhysics(pass_question);
            lblWrong.Text = "";



        }