Пример #1
0
        /// <summary>
        /// 通知
        /// </summary>
        /// <param name="sender">事件发送器</param>
        /// <param name="e">评教事件参数</param>
        public void Inform(object sender, EvaluateEventArgs e)
        {
            Student student = sender as Student;
            Faculty faculty = e.Faculty;

            WriteLine($"\n发送短信至手机{faculty.PhoneNumber}:学生{student.Name}已对您评教。\n");
        }
Пример #2
0
 public event EvaluateEventHandler EvaluateEvent;                                //定义事件;事件即多播委托;事件必须定义在类内部;
 /// <summary>
 /// 触发评教事件;
 /// </summary>
 /// <param name="faculty">教职工</param>
 public void OnEvaluateEvent(Faculty faculty)
 {
     //if (this.EvaluateEvent != null)                                             //若事件非空;
     {
         EvaluateEventArgs e = new EvaluateEventArgs(faculty);                   //创建评教事件参数;
         this.EvaluateEvent?.Invoke(this, e);                                    //触发事件,即调用多播委托中注册的所有事件处理函数;事件必须在类内部触发;
     }
 }
Пример #3
0
 /// <summary>
 /// 开放查询;
 /// </summary>
 /// <param name="sender">事件发送器</param>
 /// <param name="e">评教事件参数</param>
 public void Open(object sender, EvaluateEventArgs e)
 {
     this.HasEvaluated = true;
 }