Ejemplo n.º 1
0
 //视频呼叫结束
 private void VideoCall_Finished_Handler(Bitmap bit, string strMsg)
 {
     OpenCameraAndSpeak(-1, false);
     OpenCameraAndSpeak(getOtherInSession(), false);
     AnyChatCoreSDK.LeaveRoom(-1);
     InitFaceAfterEndCall(bit, strMsg);
 }
Ejemplo n.º 2
0
        private void Window_Closed(object sender, EventArgs e)
        {
            try
            {
                //if (localWebCam != null)
                //{
                //    if (localWebCam.IsRunning)
                //        localWebCam.Stop();
                //}

                if (disapthcerTimer != null)
                {
                    disapthcerTimer.IsEnabled = false;
                }

                AnyChatCoreSDK.LeaveRoom(-1);
                AnyChatCoreSDK.Logout();
                AnyChatCoreSDK.Release();

                //if (_writer != null)
                //    _writer.Close();

                Main.videoCreat = null;
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Ejemplo n.º 3
0
 //退出释放资源
 public static void Release(int myroomID)
 {
     AnyChatCoreSDK.LeaveRoom(myroomID);
     AnyChatCoreSDK.Logout();
     AnyChatCoreSDK.Release();
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 private void frmRoom_FormClosing(object sender, FormClosingEventArgs e)
 {
     AnyChatCoreSDK.LeaveRoom(m_RoomID);
     AnyChatCoreSDK.Logout();
     System.Environment.Exit(0);
 }
Ejemplo n.º 6
0
 // 关闭窗口时释放资源
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     AnyChatCoreSDK.LeaveRoom(-1);
     AnyChatCoreSDK.Logout();
     AnyChatCoreSDK.Release();
 }
Ejemplo n.º 7
0
        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);
        }