public async Task PrepareWorkList() { if (WorkListLoaded) { return; } List <Work> list = Model.GetWorkList(CourseId); WorkList.Clear(); foreach (Work work in list) { WorkList.Add(new WorkVM(work)); } string id = CourseId; if (await Model.RefWorkList(CourseId) == MainModel.UpdateResult.Success) { if (id == CourseId) { WorkList.Clear(); foreach (Work work in list) { WorkList.Add(new WorkVM(work)); } } } WorkListLoaded = true; RaisePropertyChanged("WorkList"); }
public void SetWorksList(List <WorksInfoDataModel> data) { data = data.OrderBy(p => p.Name).ToList(); WorkList.Clear(); data.ForEach(o => WorkList.Add(o)); if (LoadWorkListComplete != null) { LoadWorkListComplete(this, new EventArgs()); } }
public void ChangeCourse(string courseId) { if (courseId == CourseId) { return; } CourseId = courseId; Course = (Model.GetCourseList()).Find(c => c.Id == courseId); CourseName = Course.Name; NoticeList.Clear(); NoticeListLoaded = false; FileList.Clear(); FileListLoaded = false; WorkList.Clear(); WorkListLoaded = false; UpdateNumbers(); RaisePropertyChanged("CourseName"); }