Example #1
0
 public QuestionPage_Student(Library.Models.Exam exam)
 {
     InitializeComponent();
     _exam = exam;
     XmlHandler.LoadExamQuestions(_exam);
     questionNumber = 0;
     this.UpdateQuestionNumberLabel();
     if (_exam.Questions.Count != 0 && _exam.Questions != null)
     {
         CreatQuestionController();
         if (_exam.IsTimed)
         {
             CreateTimeBar();
         }
     }
 }
Example #2
0
 private void _thisForm_ChangeForm(object sender, FormEventArgs e)
 {
     if (sender is LoginForm)// Login -> Welcome
     {
         var loginForm = sender as LoginForm;
         user = e.DataForNextForm as User;
         WelcomePage newForm = new WelcomePage(user);
         ThisForm = newForm;
         loginForm.Hide();
         (ThisForm as Form).ShowDialog(); //Opening Welcome page as dialog
         loginForm.Show();                //Re-opening the login after welcome page closes
         loginForm.ClearFields();
     }
     if ((sender is WelcomePage) && user.Role == Users.Student)//Welcome-Student -> Alert -> Exam
     {
         var          dr          = new DialogResult();
         string       alertString = "By clicking OK you will start the test.You Will not be able to go back without finishing.";
         AlertMessage alertForm   = new AlertMessage(alertString);
         dr = alertForm.ShowDialog();
         if (dr == DialogResult.OK)
         {
             //Opening the exam - QuestionPage_Student
             Library.Models.Exam exam = e.DataForNextForm as Library.Models.Exam;
             ThisForm = new QuestionPage_Student(exam);
             ThisForm.FormShowDialog();
             user.UpdateExamGradeXML(exam);
             ThisForm = PreviousForm;
             (ThisForm as WelcomePage).welcomeController.ResetView();
         }
     }
     else if ((sender is WelcomePage) && user.Role == Users.Teacher)//Welcome-Teacher -> Build Exam
     {
         User teacher = e.DataForNextForm as User;
         ThisForm = new QuestionPage_Teacher(teacher);
         ThisForm.FormShowDialog();
     }
 }