/// <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> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Load_Click(object sender, EventArgs e) { if (this._Course == null) { this._Course = CourseRepository.Find("2060316"); MessageBox.Show($"已载入《{this._Course.Name}》。修改课程信息后请及时提交。"); return; } DialogResult messageboxResult = //定义对话框操作结果,用于接收消息框操作结果; MessageBox.Show //消息框的Show方法除了显示消息框,还能在用户完成对消息框的操作后,返回消息框操作结果; ("即将重新载入课程,请确认先前的修改均已提交!", "警告", MessageBoxButtons.YesNo, //消息框按钮; MessageBoxIcon.Warning); //消息框图标; if (messageboxResult == DialogResult.Yes) //若消息框操作结果为是; { MessageBox.Show ($"已重新载入《{this._Course.Name}》。", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 点击载入按钮; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Load_Click(object sender, EventArgs e) { this._Course = CourseRepository.Find("2060316"); MessageBox.Show($"已载入《{this._Course.Name}》。"); }
/// <summary> /// 点击载入按钮; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Load_Click(object sender, EventArgs e) { this._Course = CourseRepository.Find("2060316"); MessageBox.Show($"已载入《{this._Course.Name}》。修改课程信息后请及时提交。"); this.btn_Submit.Enabled = true; }
/// <summary> /// 载入按钮点击; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Load_Click(object sender, EventArgs e) { this._Course = CourseRepository.Find("2060316"); this.txb_CourseDescription.Text = this._Course.Description; this.LoadFormativeAssessments(); }
/// <summary> /// 载入按钮点击; /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Load_Click(object sender, EventArgs e) { this._Course = CourseRepository.Find("2060316"); this.txb_CourseDescription.Text = this._Course.Description; this.rtb_CourseSyllabus.Rtf = this._Course.Syllabus; }