/// <summary> /// 载入课程考核形式; /// </summary> private void LoadAppraisalForm() { string currentCourseAppraisalType = this.lsb_CourseAppraisalType.SelectedItem.ToString(); //获取列表框的选中项目的字符串; string[] availableCourseAppraisalForms = CourseAppraisalType.GetAllForms(currentCourseAppraisalType); this.lsb_CourseAppraisalForm.Items.Clear(); //清空子列表框的项目集合; this.lsb_CourseAppraisalForm.Items.AddRange(availableCourseAppraisalForms); //获取子项目,批量加入子列表框的项目集合; this.lsb_CourseAppraisalForm.SelectedItem = this._Course.AppraisalForm; //设置列表框的选中项目; }
/// <summary> /// 载入课程; /// </summary> private void LoadCourse() { this._Course = CourseRepository.Find("2060316"); this.txb_CourseNumber.Text = this._Course.Number; this.txb_CourseName.Text = this._Course.Name; this.nud_CourseCredit.DataBindings.Clear(); //清空控件的数据绑定项; this.nud_CourseCredit.DataBindings.Add //向控件的数据绑定项添加绑定项,并分别指定控件属性名称、对象、对象属性名称,从而实现双向更改; ("Value", this._Course, "Credit"); //若该属性更改时,相应更改其它属性,可在该属性中触发PropertyChanged事件(类还需实现INotifyPropertyChanged接口),从而实现其它属性在控件中的同步更改; this.lbl_CourseHourDistribution.DataBindings.Clear(); this.lbl_CourseHourDistribution.DataBindings.Add ("Text", this._Course, "CourseHourDistribution"); this.tkb_TheoreticalHour.DataBindings.Clear(); this.tkb_TheoreticalHour.DataBindings.Add ("Maximum", this._Course, "TotalHour"); this.tkb_TheoreticalHour.DataBindings.Add ("Value", this._Course, "TheoreticalHour"); this.txb_CourseDescription.Text = this._Course.Description; this.ckb_IsAvailable.Checked = this._Course.IsAvailable; this.ckb_HasExperiment.Checked = this._Course.HasExperiment; this.ckb_HasMooc.Checked = this._Course.HasMooc; this.AddRangeWithCheckedItem (this.clb_FormativeAssessment, this._Course.FormativeAssessments, CourseService.GetAllFormativeAssessment); this.rdb_IsProfessional.Checked = (this.rdb_IsProfessional.Text == this._Course.Type); this.rdb_IsPublic.Checked = (this.rdb_IsPublic.Text == this._Course.Type); this.rdb_IsCompulsory.Checked = (this.rdb_IsCompulsory.Text == this._Course.LearningType); this.rdb_IsOptional.Checked = (this.rdb_IsOptional.Text == this._Course.LearningType); this.lsb_CourseAppraisalType.Items.Clear(); this.lsb_CourseAppraisalType.Items.AddRange (CourseAppraisalType.GetAllTypes()); this.lsb_CourseAppraisalType.SelectedItem = this._Course.AppraisalType; this.ListBoxLoadSubItems (this.lsb_CourseAppraisalType, this.lsb_CourseAppraisalForm, CourseAppraisalType.GetAllForms); this.lsb_CourseAppraisalForm.SelectedItem = this._Course.AppraisalForm; }
/// <summary> /// 载入课程考核类型; /// </summary> private void LoadCourseAppraisalType() { this.lsb_CourseAppraisalType.Items.Clear(); //清空列表框的项目集合; this.lsb_CourseAppraisalType.Items.AddRange(CourseAppraisalType.GetAllTypes()); //批量加入列表框的项目集合; this.lsb_CourseAppraisalType.SelectedItem = this._Course.AppraisalType; //设置列表框的选中项目; }