Exemplo n.º 1
0
        public void CallStudent(Student student)
        {
            lock (_pauseLock)
            {
                if (_isPaused) Monitor.Wait(_pauseLock);
            }

            if (string.IsNullOrEmpty(student.Name))
            {
                throw new ArgumentNullException();
            }
            _view.DisplayStudentName(student, _amountStudentsPassed);

            Thread.Sleep(Randomizer.GetStudentExaminationTime());

            var mark = Randomizer.GetStudentMark();

            _view.DisplayStudentMark(mark, _amountStudentsPassed);
            _amountStudentsPassed++;
            _view.SetProgress(_amountStudentsPassed * 100 / _amountStudents);

            if (_amountStudents == _amountStudentsPassed)
            {
                _view.InformAboutFinish();
            }
        }
Exemplo n.º 2
0
        public void ExamineStudent(Student student)
        {
            if (student == null)
            {
                throw new ArgumentNullException();
            }

               _communicator.CallStudent(student);
        }
Exemplo n.º 3
0
 public void DisplayStudentName(Student student, int studentId)
 {
     if (string.IsNullOrEmpty(student?.Name))
     {
         throw new ArgumentNullException();
     }
     InvokeIfRequired(() =>
     {
         studentsListView.Items.Add(new ListViewItem(new[] { (studentId + 1).ToString(), student.Name, "" }));
     }, studentsListView);
 }