public Classroom FindClassRoom(string name) { Classroom classroom = new Classroom(name); classroom = ClassroomList.Find(c => c.Name == name); return(classroom); }
public void SelectedClass() { int index = ClassroomList.IndexOf(SelectedClassroom); ClassroomList.RemoveAt(index); ClassroomList.Insert(index, SelectedClassroom); }
public Classroom AddClassRoom(string name) { Classroom classRoom = new Classroom(name); if (String.IsNullOrWhiteSpace(name)) { throw new ArgumentException(); } classRoom.School = this; if (ClassroomList.Exists(c => c.Name == name)) { throw new ArgumentException(); } else { ClassroomList.Add(classRoom); return(classRoom); } }
public void DoDemo() { Task.Factory.StartNew(() => { if (DemoStopped()) { return; } switch (_nextDemoState) { case Constants.ApplicationState.ScheduleAdd: Application.Current.Dispatcher.Invoke(() => { DrawerHost.IsLeftDrawerOpen = false; var dialog = new ScheduleName { Owner = this }; DemoStateHandler.Instance.DemoState = dialog; dialog.ShowDialog(); if (!string.IsNullOrEmpty(dialog.Name)) { if (_viewModel.LastOpenedSchedule != null) { _viewModel.UpdateCurrentSchedule(); } _viewModel.LastOpenedSchedule = new Schedule { Id = dialog.Name, }; _viewModel.SaveCurrentSchedule(); _viewModel.InitRemainigSessions(); // in case this is the first time running ScheduleView.Visibility = Visibility.Visible; ClassromsPanel.Visibility = Visibility.Visible; ScheduleLabel.Visibility = Visibility.Hidden; GlobalButton.IsEnabled = true; Schedule.Appointments.Clear(); Title = $"{dialog.Name} - {_appTitle}"; } _nextDemoState = Constants.ApplicationState.Courses; DrawerHost.IsLeftDrawerOpen = true; }); DemoStopped(); break; case Constants.ApplicationState.Courses: Application.Current.Dispatcher.Invoke(() => { var dialog = new CourseList(_viewModel); DemoStateHandler.Instance.DemoState = dialog; dialog.ShowDialog(); _nextDemoState = Constants.ApplicationState.Softwares; }); DemoStopped(); break; case Constants.ApplicationState.Softwares: Application.Current.Dispatcher.Invoke(() => { var dialog = new SoftwareList(_viewModel); DemoStateHandler.Instance.DemoState = dialog; dialog.ShowDialog(); _nextDemoState = Constants.ApplicationState.Subjects; }); DemoStopped(); break; case Constants.ApplicationState.Subjects: Application.Current.Dispatcher.Invoke(() => { var dialog = new SubjectList(_viewModel); DemoStateHandler.Instance.DemoState = dialog; dialog.ShowDialog(); _nextDemoState = Constants.ApplicationState.Classrooms; }); DemoStopped(); break; case Constants.ApplicationState.Classrooms: Application.Current.Dispatcher.Invoke(() => { var dialog = new ClassroomList(_viewModel); DemoStateHandler.Instance.DemoState = dialog; dialog.ShowDialog(); _nextDemoState = Constants.ApplicationState.SessionDetails; DrawerHost.IsLeftDrawerOpen = false; }); DemoStopped(); break; case Constants.ApplicationState.SessionDetails: Application.Current.Dispatcher.Invoke(() => { _viewModel.Classroom = _viewModel.Classrooms[0]; var startTime = DateTime.Now.StartOfWeek().Date + new TimeSpan(7, 15, 0); var session = _viewModel.RemainingSessions[0]; var avaibleTerms = _viewModel.GetAvailableTerms(null, startTime, session); var dialog = new SessionDetails(_viewModel, Schedule.Appointments, avaibleTerms, startTime, session); DemoStateHandler.Instance.DemoState = dialog; dialog.ShowDialog(); _nextDemoState = Constants.ApplicationState.ScheduleAdd; }); if (DemoStopped()) { return; } //if (DemoStopped()) return; Application.Current.Dispatcher.Invoke( () => { _viewModel.RemoveClassroom(DemoStateHandler.Instance.DemoClassroomId); }); DemoStateHandler.Instance.RemoveDemoEntities(); _viewModel.LastOpenedSchedule = null; break; } }); }