public override void Initialize() { // all views in the assembly decorated with // ViewContainerInitializerAttribute or // ViewModelContainerInitializerAttribute.cs // are loaded into the container in base.Initialize base.Initialize(); // validation lessons _container.RegisterType(typeof(Object), typeof(WiredInXamlView), typeof(WiredInXamlView).FullName); _container.RegisterType(typeof(Object), typeof(WiredInViewCodeBehind), typeof(WiredInViewCodeBehind).FullName); _container.RegisterType(typeof(Object), typeof(WiredUsingPropertyInjection), typeof(WiredUsingPropertyInjection).FullName); _lessons.Add(new Lesson { Section = "Model-View-ViewModel", Title = "Wired in XAML", View = typeof(WiredInXamlView).FullName }); _lessons.Add(new Lesson { Section = "Model-View-ViewModel", Title = "Wired in View Code Behind", View = typeof(WiredInViewCodeBehind).FullName }); _lessons.Add(new Lesson { Section = "Model-View-ViewModel", Title = "Wired Using Property Injection", View = typeof(WiredUsingPropertyInjection).FullName }); // NOTICE: These are not added to the container using the above syntax. // They are registered in the base.Initialize() method. _lessons.Add(new Lesson { Section = "Model-View-ViewModel", Title = "Wired by Unity", View = typeof(WiredByUnityView).FullName }); _lessons.Add(new Lesson { Section = "Model-View-ViewModel", Title = "Wired by Resource Lookup", View = typeof(WiredByResourceLookupView).FullName }); }
void IModule.Initialize() { // validation lessons _container.RegisterType(typeof(Object), typeof(ContactView), typeof(ContactView).FullName); _container.RegisterType(typeof(Object), typeof(UsingWpfValidationRules), typeof(UsingWpfValidationRules).FullName); _lessons.Add(new Lesson { Section = "Validation", Title = "IDataErrorInfo & Type Mismatch Exceptions", View = typeof(ContactView).FullName }); _lessons.Add(new Lesson { Section = "Validation", Title = "Using WPF Validation Rules", View = typeof(UsingWpfValidationRules).FullName }); }
async Task ExecuteLoadCommand() { if (IsBusy) { return; } IsBusy = true; try{ Lessons.Clear(); var lessons = await Services.ScheduleService.GetCurrentLessons(); if (lessons.Count > 0) { lessons.ForEach(o => { Lessons.Add(o); }); } else { //alert } }catch (Exception ex) { Debug.WriteLine(ex); }finally{ IsBusy = false; } }
public ActionResult AddLesson(string nameLesson, HttpPostedFileBase fileDocumentWord, HttpPostedFileBase fileDocumentPPT, HttpPostedFileBase fileDocumentPDF, string urlVideo, string idSubject, string description) { if (nameLesson.Equals("") || urlVideo.Length == 0) { TempData["Error"] = "Dữ liệu (*) không được để trống"; return(RedirectToAction("AddLesson", "Lessons", new { id = idSubject })); } #region Add Lesson Lessons item = new Lessons(); item.ID = this.GetNextIDSubject(); item.Name = nameLesson; item.PPTFile = UploadsFile(fileDocumentPPT); item.WordFile = UploadsFile(fileDocumentWord); item.PdfFile = UploadsFile(fileDocumentPDF); item.Video = urlVideo; item.DateCreated = DateTime.Now; item.IDSubject = idSubject; item.Description = description; lessons.Add(item); #endregion #region Update Subject subject.UpdateChildren(idSubject); #endregion return(RedirectToAction("Index", "Subjects")); }
void IModule.Initialize() { // validation lessons _container.RegisterType(typeof(Object), typeof(RoutedCommandView), typeof(RoutedCommandView).FullName); _lessons.Add(new Lesson { Section = "Commands in MVVM", Title = "Routed Commands", View = typeof(RoutedCommandView).FullName }); }
public bool AddLesson(string lesson) { if (!Lessons.Contains(lesson)) { Lessons.Add(lesson); return(true); } else { return(false); } }
void IModule.Initialize() { // dialog service _container.RegisterType(typeof(IDialogService), typeof(ModalDialogService)); // navigation lessons _container.RegisterType(typeof(Object), typeof(NavigationApiDemoView), typeof(NavigationApiDemoView).FullName); _container.RegisterType(typeof(Object), typeof(DataFormView), typeof(DataFormView).FullName); _lessons.Add(new Lesson { Section = "Navigation", Title = "Navigation API Demo", View = typeof(NavigationApiDemoView).FullName }); }
private async Task GetLessonsAsync() { ResponseResult allLessonsResult = await _bmsService.GetLessons(false, null); if (!HasErrorMsg(allLessonsResult.Status, allLessonsResult.Message)) { List <LessonInfo> lessonList = allLessonsResult.Data as List <LessonInfo>; Lessons.Clear(); lessonList?.ForEach((lesson) => { lesson.GotoLessonTypeCommand = GotoLessonTypeCommand; Lessons.Add(lesson); }); } }
private async Task GetLessonsAsync() { ResponseResult lessonResult = await _bmsService.GetLessons(false, LessonType.Discussion); if (HasErrorMsg(lessonResult.Status, lessonResult.Message)) { return; } List <LessonInfo> lessonList = lessonResult.Data as List <LessonInfo>; Lessons.Clear(); lessonList?.ForEach((lesson) => { Lessons.Add(lesson); }); }
private void StartAddingNewLesson() { SaveLesson(); CurrentLesson = new Lesson() { Name = NewLessonName, UserId = CurrentUser.Id }; OnPropertyChanged("CurrentLesson"); CurrentLessonWords = new ObservableCollection <Word>(); CurrentLessonWords.CollectionChanged += CurrentLessonWords_CollectionChanged; CurrentLessonWordsChanged = false; ShowModifyLessonSubView = true; NewLessonName = ""; if (Lessons.Contains(CurrentLesson) == false) { Lessons.Add(CurrentLesson); } }
private async void LoadCourseDataAsync(Course course) { var fullCourse = await _courseHandler.GetCourse(course.Id); if (fullCourse != null) { DBFiles.Clear(); Lessons.Clear(); foreach (var item in fullCourse.CourseMaterials) { DBFiles.Add(item); } foreach (var item in fullCourse.Lessons) { Lessons.Add(item); } CurrentSemester = course.Semester; } }
public void selectByOption(Option o) { Students.Clear(); foreach (Student s in StudentsDB) { if (s.optionID != o.ID) { continue; } Students.Add(new StudentListItem(s)); } Lessons.Clear(); foreach (Lesson l in LessonDB) { if (l.optionID == o.ID && App.currentTeacher.ID == l.teacherID) { Lessons.Add(l); } } }
internal void ExistingLessons(object sender, RoutedEventArgs e) { // Reset previous loaded lesson Lessons = null; CloseAllPage(); var lessonFolders = Directory.GetDirectories(Data.NineFolder); foreach (var lessonFolder in lessonFolders) { var lessonName = Path.GetFileName(lessonFolder); var dataFile = Data.GetDataFile(lessonName); var pdfPath = Data.GetPdfFile(lessonName); var thumbPath = Data.GetPageFile(lessonName, 0); if (File.Exists(dataFile) && File.Exists(pdfPath) && File.Exists(thumbPath)) { var bitmap = BitmapHelper.Load(thumbPath); Lessons.Add( new KeyValuePair <int, MinimalLesson>( Lessons.Count(), new MinimalLesson(lessonName, bitmap, false) ) ); } else { try { Directory.Delete(lessonFolder, true); } catch (IOException e1) { MessageBox.Show(e1.Message); } } } }
public bool AddLesson(Lesson lesson) { var occupied = false; foreach (var Lesson in Lessons) { if ((lesson.Start >= Lesson.Start && lesson.End <= Lesson.End) && lesson.Room == Lesson.Room) { occupied = true; } } if (!occupied) { Lessons.Add(lesson); SaveLessons(); return(true); } else { return(false); } }
public void AddFromBDC(BaseDataClass dataClass) { if (dataClass is Teacher teacher) { Teachers.Add(teacher); } if (dataClass is Form form) { Forms.Add(form); } if (dataClass is Subject subject) { Subjects.Add(subject); } if (dataClass is Lesson lesson) { Lessons.Add(lesson); } if (dataClass is Group group) { Groups.Add(group); } }
public void Match(string[] temp)//参数为课程表数组 { foreach (string c in temp) { Lesson newLesson = new Lesson(); string[] t = new string[30];//临时存储单个课程的各项信息 string pattern = " .*? "; Regex rx = new Regex(pattern); Match m = rx.Match(c); int i = 0; while (m.Success) { t[i] = m.Value; i++; m = rx.Match(c, m.Index + m.Length); } int j = 3; if (t[j] == " ") { j = 4; } newLesson.LessonName = t[1]; newLesson.Day = t[j]; newLesson.BeginWeek = t[j + 2]; newLesson.EndWeek = t[j + 4]; newLesson.BeginTime = t[j + 6]; newLesson.EndTime = t[j + 8]; newLesson.ClassRoom = t[j + 10]; newLesson.TeacherName = t[j + 12]; newLesson.ProfessionName = t[j + 14]; newLesson.PlanType = t[j + 16]; newLesson.Credit = t[j + 18]; newLesson.AreaName = t[j + 20]; newLesson.WeekInterval = t[j + 22]; Lessons.Add(newLesson); } }
void IModule.Initialize() { // introduction lessons _container.RegisterType(typeof(Object), typeof(SimpleDataBinding), typeof(SimpleDataBinding).FullName); _container.RegisterType(typeof(Object), typeof(DataBindingObjects), typeof(DataBindingObjects).FullName); _container.RegisterType(typeof(Object), typeof(DataContent), typeof(DataContent).FullName); _container.RegisterType(typeof(Object), typeof(DataContextSetInCode), typeof(DataContextSetInCode).FullName); _container.RegisterType(typeof(Object), typeof(DataContextSetFromAnotherControl), typeof(DataContextSetFromAnotherControl).FullName); _container.RegisterType(typeof(Object), typeof(DataContextSetFromAnotherControlSourceInCode), typeof(DataContextSetFromAnotherControlSourceInCode).FullName); _container.RegisterType(typeof(Object), typeof(BindingsSetInCode), typeof(BindingsSetInCode).FullName); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Simple Data Binding", View = typeof(SimpleDataBinding).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Data Binding Objects", View = typeof(DataBindingObjects).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Data Context", View = typeof(DataContent).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Data Context Set In Code", View = typeof(DataContextSetInCode).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Data Context Set From Another Control", View = typeof(DataContextSetFromAnotherControl).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Data Context Set From Another Control v2", View = typeof(DataContextSetFromAnotherControlSourceInCode).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Introduction", Title = "Data Bindings Set In Code", View = typeof(BindingsSetInCode).FullName }); // fundamentals lessons _container.RegisterType(typeof(Object), typeof(BindingComponents), typeof(BindingComponents).FullName); _container.RegisterType(typeof(Object), typeof(RelativeSource), typeof(RelativeSource).FullName); _container.RegisterType(typeof(Object), typeof(BindingToClrProperties), typeof(BindingToClrProperties).FullName); _container.RegisterType(typeof(Object), typeof(BindingModes), typeof(BindingModes).FullName); _container.RegisterType(typeof(Object), typeof(UpdateSourceTrigger), typeof(UpdateSourceTrigger).FullName); _lessons.Add(new Lesson { Section = "Data Binding Fundamentals", Title = "Binding Componets", View = typeof(BindingComponents).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Fundamentals", Title = "Relative Source", View = typeof(RelativeSource).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Fundamentals", Title = "Binding To CLR Properties", View = typeof(BindingToClrProperties).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Fundamentals", Title = "Binding Modes", View = typeof(BindingModes).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Fundamentals", Title = "Update Source Trigger", View = typeof(UpdateSourceTrigger).FullName }); // visualizing data lessons _container.RegisterType(typeof(Object), typeof(ContentControlDemo), typeof(ContentControlDemo).FullName); _container.RegisterType(typeof(Object), typeof(ItemsControlDemo), typeof(ItemsControlDemo).FullName); _lessons.Add(new Lesson { Section = "Data Binding Visualizing Data", Title = "Content Control", View = typeof(ContentControlDemo).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Visualizing Data", Title = "Items Control", View = typeof(ItemsControlDemo).FullName }); // collections lessons _container.RegisterType(typeof(Object), typeof(BindingToCollections), typeof(BindingToCollections).FullName); _container.RegisterType(typeof(Object), typeof(CollectionViews), typeof(CollectionViews).FullName); _container.RegisterType(typeof(Object), typeof(Sorting), typeof(Sorting).FullName); _container.RegisterType(typeof(Object), typeof(Grouping), typeof(Grouping).FullName); _container.RegisterType(typeof(Object), typeof(Converters), typeof(Converters).FullName); _container.RegisterType(typeof(Object), typeof(DataTemplateSelectorDemo), typeof(DataTemplateSelectorDemo).FullName); _lessons.Add(new Lesson { Section = "Data Binding Collections", Title = "Binding to Collections", View = typeof(BindingToCollections).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Collections", Title = "Collection Views", View = typeof(CollectionViews).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Collections", Title = "Sorting", View = typeof(Sorting).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Collections", Title = "Grouping", View = typeof(Grouping).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Collections", Title = "Converters", View = typeof(Converters).FullName }); _lessons.Add(new Lesson { Section = "Data Binding Collections", Title = "Data Template Selector", View = typeof(DataTemplateSelectorDemo).FullName }); }
public void AddLesson(Course c, Lesson l) { Lessons.Add(l); c.Lessons.Add(l); SaveChanges(); }
public string NextClass; //下一课程 public void AddToLessonsList() { this.Learnt = false; Lessons.Add(this); }
public void AddLesson(Lesson lesson) { Lessons.Add(lesson); }
public void SetFromFile(string fileName) { DataTable dataTable; StreamReader streamReader = new StreamReader(fileName); using (CsvReader csvReader = new CsvReader(streamReader, CultureInfo.InvariantCulture)) { using (var csv = new CsvReader(streamReader, CultureInfo.InvariantCulture)) { using (var dr = new CsvDataReader(csv)) { dataTable = new DataTable(); dataTable.Load(dr); } } } streamReader.Close(); foreach (DataColumn column in dataTable.Columns) { if (column.ColumnName == "Last Name" || column.ColumnName == "First Name" || column.ColumnName == "Email Address") { continue; } Lesson lesson = new Lesson { Theme = column.ColumnName }; Lessons.Add(lesson); } List <RowOfMark> rowMarks = new List <RowOfMark>(); foreach (DataRow row in dataTable.Rows) { List <string> rowArray = new List <string>(row.ItemArray.Select(s => s.ToString())); if (rowArray[0] == "Date") { rowArray.RemoveRange(0, 3); for (int i = 0; i < rowArray.Count; i++) { Lessons[i].Date = rowArray[0]; } continue; } if (rowArray[0] == "Points") { continue; } rowMarks.Add(new RowOfMark(new List <string>(row.ItemArray.Select(s => s.ToString())))); } SetPupils(rowMarks); Marks(rowMarks); JoinTheSamePupil(); }