protected override void WndProc(ref Message m) { if (m.Msg == AnyChatCoreSDK.WM_GV_CONNECT) { ///连接 int succed = m.WParam.ToInt32(); if (succed == 1) { int ret = AnyChatCoreSDK.Login(m_userName, "123", 0); //登录系统 ShowMessage("连接AnyChat服务器成功,正在登录系统..."); } else { ShowMessage("连接AnyChat服务器失败"); Log.SetLog("WM_GV_CONNECT 连接AnyChat服务器失败"); } } else if (m.Msg == AnyChatCoreSDK.WM_GV_LOGINSYSTEM) { ///登录系统 if (m.LParam.ToInt32() == 0) { ShowMessage("登录AnyChat系统成功"); m_userId = m.WParam.ToInt32(); //保存当前ID hallForm = null; //hallForm = new Hall(m_userId, cbox_userIdentity.Text); LoginInfo loginInfo = new LoginInfo(); loginInfo.userID = m_userId; loginInfo.userName = m_userName; loginInfo.userIdType = m_userIdentity; loginInfo.userPriority = m_identityPriority; loginInfo.isRouterMode = m_isAutoRouter; loginInfo.userSkills = m_skillsValue; hallForm = new frmHall(loginInfo, this); this.Hide(); hallForm.Show(); } else { ShowMessage("登录失败:Error=" + m.LParam.ToString()); Log.SetLog("WM_GV_LOGINSYSTEM 登录失败:Error=" + m.LParam.ToString()); } } else if (m.Msg == AnyChatCoreSDK.WM_GV_ENTERROOM) { //进入房间 int lparam = m.LParam.ToInt32(); if (lparam == 0) { hallForm.EnterRoomSuccess(); //通知大厅进入房间成功 } else { Log.SetLog("WM_GV_ENTERROOM 进入房间,失败,Error:" + lparam.ToString()); } } else if (m.Msg == AnyChatCoreSDK.WM_GV_ONLINEUSER) { hallForm.OpenCameraAndSpeak(hallForm.getOtherInSession(), true); //打开视频呼叫对象的视频 } //用户进入或者离开房间 else if (m.Msg == AnyChatCoreSDK.WM_GV_USERATROOM) { int lparam = m.LParam.ToInt32(); int wparam = m.WParam.ToInt32(); if (lparam == 0) { hallForm.OpenCameraAndSpeak(hallForm.getOtherInSession(), false); //关闭视频呼叫对象的视频 Log.SetLog("WM_GV_USERATROOM 用户" + wparam.ToString() + "离开房间"); } else { hallForm.OpenCameraAndSpeak(hallForm.getOtherInSession(), true); //打开视频呼叫对象的视频 Log.SetLog("WM_GV_USERATROOM 用户" + wparam.ToString() + "进入房间"); } } //摄像头打开状态 else if (m.Msg == AnyChatCoreSDK.WM_GV_CAMERASTATE) { } //网络断开 else if (m.Msg == AnyChatCoreSDK.WM_GV_LINKCLOSE) { AnyChatCoreSDK.LeaveRoom(-1); int wparam = m.WParam.ToInt32(); int lparam = m.LParam.ToInt32(); ShowMessage("网络断开,ErrorCode:" + wparam.ToString()); if (hallForm != null) { hallForm.Hide(); } this.Show(); Log.SetLog("WM_GV_LINKCLOSE 响应网络断开,errorcode:=" + lparam); } base.WndProc(ref m); }
protected override void WndProc(ref Message m) { if (m.Msg == AnyChatCoreSDK.WM_GV_CONNECT) { ///连接 int succed = m.WParam.ToInt32(); if (succed == 1) { int ret = AnyChatCoreSDK.Login(m_userName, "123", 0);//登录系统 ShowMessage("连接AnyChat服务器成功,正在登录系统..."); } else { ShowMessage("连接AnyChat服务器失败"); Log.SetLog("WM_GV_CONNECT 连接AnyChat服务器失败"); } } else if (m.Msg == AnyChatCoreSDK.WM_GV_LOGINSYSTEM) { ///登录系统 if (m.LParam.ToInt32() == 0) { ShowMessage("登录AnyChat系统成功"); m_userId = m.WParam.ToInt32();//保存当前ID RecordLoginTrace(); hallForm = null; //hallForm = new Hall(m_userId, cbox_userIdentity.Text); hallForm = new frmHall(m_userId, m_userName, m_userIdentity, m_identityPriority, this); this.Hide(); hallForm.Show(); } else { ShowMessage("登录失败:Error=" + m.LParam.ToString()); Log.SetLog("WM_GV_LOGINSYSTEM 登录失败:Error=" + m.LParam.ToString()); } } else if (m.Msg == AnyChatCoreSDK.WM_GV_ENTERROOM) { //进入房间 int lparam = m.LParam.ToInt32(); if (lparam == 0) { hallForm.EnterRoomSuccess();//通知大厅进入房间成功 } else { Log.SetLog("WM_GV_ENTERROOM 进入房间,失败,Error:" + lparam.ToString()); } } else if (m.Msg == AnyChatCoreSDK.WM_GV_ONLINEUSER) { hallForm.OpenCameraAndSpeak(hallForm.getOtherInSession(),true);//打开视频呼叫对象的视频 } //用户进入或者离开房间 else if (m.Msg == AnyChatCoreSDK.WM_GV_USERATROOM) { int lparam = m.LParam.ToInt32(); int wparam = m.WParam.ToInt32(); if (lparam == 0) { hallForm.OpenCameraAndSpeak(hallForm.getOtherInSession(),false);//关闭视频呼叫对象的视频 Log.SetLog("WM_GV_USERATROOM 用户" + wparam.ToString() + "离开房间"); } else { hallForm.OpenCameraAndSpeak(hallForm.getOtherInSession(), true);//打开视频呼叫对象的视频 Log.SetLog("WM_GV_USERATROOM 用户" + wparam.ToString() + "进入房间"); } } //摄像头打开状态 else if (m.Msg == AnyChatCoreSDK.WM_GV_CAMERASTATE) { } //网络断开 else if (m.Msg == AnyChatCoreSDK.WM_GV_LINKCLOSE) { AnyChatCoreSDK.LeaveRoom(-1); int wparam = m.WParam.ToInt32(); int lparam = m.LParam.ToInt32(); ShowMessage("网络断开,ErrorCode:" + wparam.ToString()); if (hallForm != null) hallForm.Hide(); this.Show(); Log.SetLog("WM_GV_LINKCLOSE 响应网络断开,errorcode:=" + lparam ); } base.WndProc(ref m); }