public void Load()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Filter = "xml-Files (*.xml)|*.xml";
            fileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            fileDialog.ShowDialog();

            TimetableData t = new TimetableData();
            TimetableData ttData = TimetableConfigIO.ImportTimetableConfig(fileDialog.FileName);
            if (ttData == null)
            {
                MessageBox.Show("Data could not be loaded.", "Loading error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            BlockContext = new BlockController();
            foreach (var block in ttData.Blocks)
            {
                BlockContext.BlockList.Add(block);
            }
            if (ttData.Blocks.Length > 0)
                BlockContext.SelectedIndex = 0;

            RoomContext = new RoomController();
            foreach (var room in ttData.Rooms)
            {
                RoomContext.RoomList.Add(room);
            }
            if (ttData.Rooms.Length > 0)
                RoomContext.SelectedIndex = 0;

            GroupContext = new GroupController();
            foreach (var group in ttData.Groups)
            {
                GroupContext.GroupList.Add(group);
            }
            if (ttData.Groups.Length > 0)
                GroupContext.SelectedIndex = 0;

            LecturerContext = new LecturerController();
            foreach (var lecturer in ttData.Lecturers)
            {
                LecturerContext.LecturersList.Add(lecturer);
            }
            if (ttData.Lecturers.Length > 0)
                LecturerContext.SelectedIndex = 0;

            CourseContext = new CourseController(BlockContext, RoomContext, GroupContext, LecturerContext);
            AddCourses(CourseContext, ttData.Courses);
            if (ttData.Courses.Length > 0)
                CourseContext.SelectedIndex = 0;
        }
 public void New()
 {
     _currentConfigFilepath = "";
     TimetableData ttData = new TimetableData();
     BlockContext = new BlockController();
     RoomContext = new RoomController();
     LecturerContext = new LecturerController();
     GroupContext = new GroupController();
     CourseContext = new CourseController(BlockContext, RoomContext, GroupContext, LecturerContext);
 }
        public CourseController(BlockController BlockContext, RoomController RoomContext, GroupController GroupContext, LecturerController LecturerContext)
            : base()
        {
            this.BlockContext = BlockContext;
            this.RoomContext = RoomContext;
            this.GroupContext = GroupContext;
            this.LecturerContext = LecturerContext;

            GroupList = GroupContext.GroupList;
            RoomPreferenceList = RoomContext.RoomList;
            LecturerList = LecturerContext.LecturersList;

            Repetitions = new Dictionary<Course, int>();

            CourseList = new ObservableCollection<Course>();
        }