void Start() { uiBehaviour = transform.GetComponent <UIBehaviour> (); iRest = transform.GetComponent <REST> (); sess = transform.GetComponent <Session> (); classR = transform.GetComponent <SClassroom> (); }
private void SetElement(XElement Element, Action<int> Progress) { try { this.SchoolYear = Element.AttributeText("SchoolYear"); this.Semester = Element.AttributeText("Semester"); ClassResult = new SIntegrationResult<SClass>(); ClassResult.Data = new List<SClass>(); XElement elmClasses = Element.Element("Classes"); if (elmClasses != null) { foreach (XElement SubElement in elmClasses.Elements("Class")) { SClass Class = new SClass(); Class.Load(SubElement); ClassResult.Data.Add(Class); } } ClassBusysResult = new SIntegrationResult<SClassBusy>(); ClassBusysResult.Data = new List<SClassBusy>(); XElement elmClassBuys = Element.Element("ClassBusys"); if (elmClassBuys != null) { foreach (XElement SubElement in elmClassBuys.Elements("ClassBusy")) { SClassBusy ClassBusy = new SClassBusy(); ClassBusy.Load(SubElement); ClassBusysResult.Data.Add(ClassBusy); } } Progress.Invoke(10); TeacherResult = new SIntegrationResult<STeacher>(); TeacherResult.Data = new List<STeacher>(); XElement elmTeachers = Element.Element("Teachers"); if (elmTeachers != null) { foreach (XElement SubElement in elmTeachers.Elements("Teacher")) { STeacher Teacher = new STeacher(); Teacher.Load(SubElement); TeacherResult.Data.Add(Teacher); } } FullTeacherResult = new SIntegrationResult<STeacher>(); FullTeacherResult.Data = new List<STeacher>(); XElement elmFullTeacher = Element.Element("FullTeachers"); if (elmFullTeacher != null) { foreach (XElement SubElement in elmFullTeacher.Elements("Teacher")) { STeacher Teacher = new STeacher(); Teacher.Load(SubElement); FullTeacherResult.Data.Add(Teacher); } } Progress.Invoke(20); TeacherBusysResult = new SIntegrationResult<STeacherBusy>(); TeacherBusysResult.Data = new List<STeacherBusy>(); XElement elmTeacherBusy = Element.Element("TeacherBusys"); if (elmTeacherBusy != null) { foreach (XElement SubElement in elmTeacherBusy.Elements("TeacherBusy")) { STeacherBusy TeacherBusy = new STeacherBusy(); TeacherBusy.Load(SubElement); TeacherBusysResult.Data.Add(TeacherBusy); } } Progress.Invoke(30); CourseSectionResult = new SIntegrationResult<SCourseSection>(); CourseSectionResult.Data = new List<SCourseSection>(); XElement elmCourseSections = Element.Element("CourseSections"); if (elmCourseSections != null) { foreach (XElement SubElement in elmCourseSections.Elements("CourseSection")) { SCourseSection CourseSection = new SCourseSection(); CourseSection.Load(SubElement); CourseSectionResult.Data.Add(CourseSection); } } Progress.Invoke(40); ClassroomResult = new SIntegrationResult<SClassroom>(); ClassroomResult.Data = new List<SClassroom>(); XElement elmClassrooms = Element.Element("Classrooms"); if (elmClassrooms!=null) { foreach (XElement SubElement in elmClassrooms.Elements("Classroom")) { SClassroom Classroom = new SClassroom(); Classroom.Load(SubElement); ClassroomResult.Data.Add(Classroom); } } Progress.Invoke(50); ClassroomBusysResult = new SIntegrationResult<SClassroomBusy>(); ClassroomBusysResult.Data = new List<SClassroomBusy>(); XElement elmClassroomBusys = Element.Element("ClassroomBusys"); if (elmClassroomBusys != null) { foreach (XElement SubElement in elmClassroomBusys.Elements("ClassroomBusy")) { SClassroomBusy ClassroomBusy = new SClassroomBusy(); ClassroomBusy.Load(SubElement); ClassroomBusysResult.Data.Add(ClassroomBusy); } } Progress.Invoke(60); LocationResult = new SIntegrationResult<SLocation>(); LocationResult.Data = new List<SLocation>(); XElement elmLocations = Element.Element("Locations"); if (elmLocations != null) { foreach (XElement SubElement in elmLocations.Elements("Location")) { SLocation Location = new SLocation(); Location.Load(SubElement); LocationResult.Data.Add(Location); } } Progress.Invoke(70); TimeTableResult = new SIntegrationResult<STimeTable>(); TimeTableResult.Data = new List<STimeTable>(); XElement elmTimeTables = Element.Element("TimeTables"); if (elmTimeTables != null) { foreach (XElement SubElement in elmTimeTables.Elements("TimeTable")) { STimeTable TimeTable = new STimeTable(); TimeTable.Load(SubElement); TimeTableResult.Data.Add(TimeTable); } } Progress.Invoke(80); TimeTableSecsResult = new SIntegrationResult<STimeTableSec>(); TimeTableSecsResult.Data = new List<STimeTableSec>(); XElement elmTimeTableSecs = Element.Element("TimeTableSecs"); if (elmTimeTableSecs != null) { foreach (XElement SubElement in elmTimeTableSecs.Elements("TimeTableSec")) { STimeTableSec TimeTableSec = new STimeTableSec(); TimeTableSec.Load(SubElement); TimeTableSecsResult.Data.Add(TimeTableSec); } } Progress.Invoke(90); Subjects = CourseSectionResult.Data.Select(x => x.Subject).Distinct().ToList(); Progress.Invoke(100); IsSuccess = true; } catch (Exception e) { IsSuccess = false; throw e; } }