protected override void WndProc(ref Message m) { if (m.Msg == AnyChatCoreSDK.WM_GV_CONNECT) { ///连接 int succed = m.WParam.ToInt32(); if (succed == 1) { //透明通道回调 SystemSetting.TransBuffer_OnReceive = new TransBufferReceivedHandler(TransBuffer_CallBack); 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, tb_name.Text); 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); } //好友用户在线状态变化 else if (m.Msg == AnyChatCoreSDK.WM_GV_FRIENDSTATUS) { int userId = m.WParam.ToInt32(); int onlineStatus = m.LParam.ToInt32(); hallForm.OnUserOnlineStatusChange(userId, onlineStatus); string strOnlineStatus = onlineStatus >= 1? "上线":"下线"; Log.SetLog("WM_GV_FRIENDSTATUS: useId: " + userId + "onlineStatus: " + strOnlineStatus); } //好友数据更新变化通知 else if (m.Msg == AnyChatCoreSDK.WM_GV_USERINFOUPDATE) { int userId = m.WParam.ToInt32(); int type = m.LParam.ToInt32(); if (userId == 0 && type == 0) { hallForm.getOnlineFriendInfos(); } Log.SetLog("WM_GV_FRIENDSTATUS: useId: " + userId + "type: " + type); } 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) { //透明通道回调 SystemSetting.TransBuffer_OnReceive = new TransBufferReceivedHandler(TransBuffer_CallBack); 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, tb_name.Text); 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()); hallForm.Hide(); this.Show(); Log.SetLog("WM_GV_LINKCLOSE 响应网络断开,errorcode:=" + lparam ); } //好友用户在线状态变化 else if (m.Msg == AnyChatCoreSDK.WM_GV_FRIENDSTATUS) { int userId = m.WParam.ToInt32(); int onlineStatus = m.LParam.ToInt32(); hallForm.OnUserOnlineStatusChange(userId, onlineStatus); string strOnlineStatus=onlineStatus>=1? "上线":"下线"; Log.SetLog("WM_GV_FRIENDSTATUS: useId: " + userId + "onlineStatus: " + strOnlineStatus); } //好友数据更新变化通知 else if (m.Msg == AnyChatCoreSDK.WM_GV_USERINFOUPDATE) { int userId=m.WParam.ToInt32(); int type=m.LParam.ToInt32(); if(userId==0&&type==0) { hallForm.getOnlineFriendInfos(); } Log.SetLog("WM_GV_FRIENDSTATUS: useId: " + userId + "type: " + type); } base.WndProc(ref m); }