public void ConnectOMCS(string serverIP, int serverPort) { if (UserInfo.UserState == UserState.未登录) { throw new Exception("未登录用户申请初始化"); } if (callOMCS != null)//登录成功 实例CallOMCS { callOMCS.Dispose(); } if (UserInfo.IsPrerogative) { callOMCS = new TeacherCallOMCS(); } else { callOMCS = new StudentCallOMCS(); } callOMCS.Initialize(UserInfo.UserId, "", serverIP, serverPort); callOMCS.ConnectEnded += a => { ConnectEnded?.Invoke(a); }; callOMCS.SomeoneExit += a => { SomeoneExit?.Invoke(a); }; callOMCS.SomeoneJoin += a => { SomeoneJoin?.Invoke(a); }; }
/// <summary> /// 绑定chatContainer事件 /// </summary> protected void BindingEvent() { chatContainer.UserJoin += a => { SomeoneJoin?.Invoke(a); }; chatContainer.UserExit += a => { SomeoneExit?.Invoke(a); }; chatContainer.ConnectEnded += a => { ConnectEnded?.Invoke(a); }; }