private void ResultForm_Load(object sender, EventArgs e)
        {
            rooms         = roomReader.GetRooms();
            courses       = courseReader.GetCourses();
            prelectors    = prelectorReader.GetPrelectors();
            studentGroups = studentGroupReader.GetStudentGroups();

            courseClassReader.ResetData();
            if (_isExamProblem)
            {
                courseClasses = courseClassReader.GetCourseClasses();
            }
            else
            {
                courseClasses = courseClassReader.GetCourseClassesWithoutRoomSplit();
            }

            prelectors    = prelectorReader.UpdateCourseClasses(courseClasses);
            studentGroups = studentGroupReader.UpdateCourseClasses(courseClasses);

            Configuration.GetInstance.InitializeDate(prelectors, studentGroups, courses, rooms, courseClasses);

            btnPause.Enabled = false;
            btnStop.Enabled  = false;

            if (Algorithm.Configuration.GetInstance.GetNumberOfRooms() > 0)
            {
                _createGridView = new CreateDataGridViews(Configuration.GetInstance.Rooms, this);
                Schedule prototype = new Schedule(int.Parse(PARAMETER_NUMBER_OF_CROSSOVER_POINTS), int.Parse(PARAMETER_MUTAITION_SIZE),
                                                  int.Parse(PARAMETER_CROSSOVER_PROBABILITY), int.Parse(PARAMETER_MUTAITION_PROBABILITY), _isExamProblem);
                Schedule.ScheduleObserver sso = new Schedule.ScheduleObserver();
                sso.SetWindow(_createGridView);

                _algorithm = new Algorithm.Algorithm(int.Parse(PARAMETER_NUMBER_OF_CHROMOSOMES), int.Parse(PARAMETER_REPLACE_BY_GENERATION),
                                                     int.Parse(PARAMETER_TRACK_BEST), prototype, sso, _isExamProblem);

                _state = ThreadState.Unstarted;
                timerWorkingSet.Start();
            }
            else
            {
                MessageBox.Show("Not found any room!", "Number of Rooms Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                timerWorkingSet.Stop();
                _algorithm = null;
                Dispose();
                return;
            }

            if (Configuration.GetInstance.GetNumberOfCourseClasses() <= 0)
            {
                btnStart.Enabled = false;
            }
        }
Esempio n. 2
0
        private void CollectData()
        {
            _roomReader.ResetData();
            _courseReader.ResetData();
            _prelectorReader.ResetData();
            _courseClassReader.ResetData();
            _studentGroupReader.ResetData();

            try
            {
                _rooms = _roomReader.GetRooms();
            } catch (Exception _ex)
            {
                MessageBox.Show("Sınıf verileri okunurken hata oluştu!", "Veri Okuma Hatası", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            try
            {
                _courses = _courseReader.GetCourses();
            }
            catch (Exception _ex)
            {
                MessageBox.Show("Ders verileri okunurken hata oluştu!", "Veri Okuma Hatası", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            try
            {
                _prelectors = _prelectorReader.GetPrelectors();
            }
            catch (Exception _ex)
            {
                MessageBox.Show("Öğretim görevlisi verileri okunurken hata oluştu!", "Veri Okuma Hatası", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            try
            {
                _courseClasses = _courseClassReader.GetCourseClasses();
            }
            catch (Exception _ex)
            {
                MessageBox.Show("Ders oturumu verileri okunurken hata oluştu!", "Veri Okuma Hatası", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            try
            {
                _studentGroups = _studentGroupReader.GetStudentGroups();
            }
            catch (Exception _ex)
            {
                MessageBox.Show("Öğrenci grubu verileri okunurken hata oluştu!", "Veri Okuma Hatası", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            UpdateDashboard();
        }