public ExamNavigator(ExaminationSystem sys)
        {
            if (sys == null || sys.Questions.Count < 1)
            {
                throw new Exception("not valid Exam system to navigate else system is null or quesions not exist");
            }

            ExamSystem = sys;
            //Current = sys.Questions[0];
        }
Beispiel #2
0
        public void LoadExam(Student std, Course crs)
        {
            sys = ExaminationSystem.LoadExam(std, crs);
            nav = new ExamNavigator(sys);


            lblTitle.Text = $"Student Id: {sys.Student.StId} , Name: {sys.Student.StName} Course: {sys.Course.CrsName}";

            lblTimer.Text = "Start Exam";

            nav.PositionChanged += (sender, e) =>
            {
                SetQuestion(e.Question);
            };

            nav.MoveNext();

            //backThread.RunWorkerAsync();

            timer.Interval = 1000;
            timer.Tick    += (sender, e) =>
            {
                lblTimer.Invoke((MethodInvoker) delegate()
                {
                    var t         = sys.EndTime - DateTime.Now;
                    lblTimer.Text = $" {t.Hours}:{t.Minutes}:{t.Seconds}";
                });
                if (DateTime.Now >= sys.EndTime)
                {
                    this.Close();
                }
            };

            timer.Start();
            sys.StartTime = DateTime.Now;

            //SetQuestion(sys.Questions[0]);
        }