Exemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="s"></param>
 /// <param name="stu"></param>
 /// <param name="end"></param>
 private void VerifyLoginEndHandler(StartLogin s,StudentEx stu,EndLogin end)
 {
     if (s != null && end != null)
     {
         STU_Login_Cache[s.UserAccount] = null;
         this.RaiseChanged(string.Format("学生机IP:({0})[{1}],{2:HH-mm-ss} 登录{3}!{4}", s.MachineName, s.UIP, s.Time, end.Result ? "成功" : "失败", end.Error));
         if (end.Result && (stu != null))
         {
             end.Student = new Student(stu.StudentID, stu.StudentCode, stu.StudentName);
             stu.MachineName = s.MachineName;
             stu.IP = s.UIP;
             if ((stu.Status & StudentControl.EnumStudentState.Offline) == StudentControl.EnumStudentState.Offline)
             {
                 stu.Status &= ~StudentControl.EnumStudentState.Offline;
             }
             stu.Status |= StudentControl.EnumStudentState.Online;
         }
         this.SendOrderToClient(end, s.UIP);
         if (end.Result)
         {
             this.OnUpdateControls(stu);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 触发更新学生状态事件。
 /// </summary>
 /// <param name="students"></param>
 protected void OnUpdateControls(StudentEx student)
 {
     UpdateStudentControlsHandler handler = this.UpdateControls;
     if (handler != null && student != null)
         handler(student);
 }
Exemplo n.º 3
0
 private void onUpdateControls(StudentEx sender)
 {
     if (this.userControl != null) this.userControl.UpdateStudentControl(sender);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 更新学生状态。
 /// </summary>
 /// <param name="student"></param>
 public void UpdateStudentControl(StudentEx student)
 {
     lock (this)
     {
         int len = 0;
         if (student != null && this.panelWork != null &&
             this.panelWork.Controls != null && ((len = this.panelWork.Controls.Count) > 0))
         {
             int index = -1;
             if (htUpdateStudentControlIndexCache.ContainsKey(student.StudentID))
             {
                 index = (int)htUpdateStudentControlIndexCache[student.StudentID];
                 if (index < 0 || index > len - 1)
                 {
                     index = -1;
                 }
             }
             if (index > -1)
             {
                 StudentControl sc = this.panelWork.Controls[index] as StudentControl;
                 if (sc != null && (sc.UserInfo.UserID == student.StudentID))
                 {
                     this.ThreadSafeMethod(new MethodInvoker(delegate()
                     {
                         sc.UserInfo.UserCode = student.StudentCode;
                         sc.UserInfo.UserName = student.StudentName;
                         sc.ColorSettings = this.settings;
                         sc.MachineName = student.MachineName;
                         sc.UserIP = student.IP;
                         sc.State = student.Status;
                         sc.Update();
                     }));
                     return;
                 }
                 else
                 {
                     index = -1;
                 }
             }
             if (index == -1)
             {
                 for (int i = 0; i < len; i++)
                 {
                     StudentControl sc = this.panelWork.Controls[i] as StudentControl;
                     if (sc != null && (sc.UserInfo.UserID == student.StudentID))
                     {
                         htUpdateStudentControlIndexCache[student.StudentID] = i;
                         this.ThreadSafeMethod(new MethodInvoker(delegate()
                         {
                             sc.UserInfo.UserCode = student.StudentCode;
                             sc.UserInfo.UserName = student.StudentName;
                             sc.MachineName = student.MachineName;
                             sc.UserIP = student.IP;
                             sc.State = student.Status;
                             sc.Update();
                         }));
                         break;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 触发更新学生状态事件。
 /// </summary>
 /// <param name="stu"></param>
 protected internal void OnUpdateControls(StudentEx stu)
 {
     UpdateStudentControlsHandler handler = this.UpdateControls;
     if (handler != null && stu != null)
         handler(stu);
 }