コード例 #1
0
ファイル: ChatForm.cs プロジェクト: songques/CSSIM_Solution
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (avForm != null)
                {
                    avForm.AVClose();
                    avForm.Dispose();
                    avForm = null;
                }

            }
            catch (Exception)
            {

            }

            try
            {
                if (ravForm != null)
                {
                    ravForm.AVClose();
                    ravForm.Dispose();
                    ravForm = null;
                }
            }
            catch (Exception)
            {

            }

            try
            {
                sockUDP1.CloseSock();
                sockUDP1.Dispose();
                sockUDP1 = null;
            }
            catch (Exception)
            {

            }

            try
            {
                _emotion.Dispose();
                _emotion = null;
            }
            catch (Exception)
            {

            }

            try
            {
                Util.ChatForms.Remove(to_Jid.Bare.ToLower());
                _connection.MessageGrabber.Remove(to_Jid);
            }
            catch (Exception)
            {

            }

            g.Dispose();
            g = null;
            Bmp.Dispose();
            Bmp = null;

            _connection = null;

            System.GC.Collect();

            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
コード例 #2
0
ファイル: ChatForm.cs プロジェクト: songques/CSSIM_Solution
        /// <summary>
        /// 同意视频信息后,进行初使化本地视频服务
        /// </summary>
        /// <param name="msg"></param>
        void AcceptInitMethod(CSS.IM.XMPP.protocol.client.Message msg)
        {
            UserInfo user1;
            UserInfo user2;

            if (ravForm != null && !ravForm.IsDisposed)
            {
                try
                {
                    ravForm.Dispose();
                    ravForm = null;
                }
                catch (Exception)
                {
                }
            }
            else
            {
                ravForm = new AVForm(to_Jid);
                ravForm.AVCloseEvent += new AVForm.AVCloseDelegate(avForm_AVCloseEvent);
            }
            LocalVideoUDPPort = ravForm.aVcommunicationEx1.selfUDPPort.ToString();

            VideoRemotUDPPort = msg.GetTagInt("UDPPort");
            VideoRemotUDPIP = IPAddress.Parse(msg.GetTag("UDPIP"));
            user1 = new UserInfo();
            user1.LocalIP = VideoRemotUDPIP;
            user1.LocalPort = VideoRemotUDPPort;
            ravForm.SetRemoteAddress(user1, VideoRemotUDPPort);

            user2 = new UserInfo();
            user2.LocalIP = Program.LocalHostIP;
            user2.LocalPort = int.Parse(LocalVideoUDPPort);
            ravForm.SetLocalAddress(user2);
            ravForm.AgreeEvent += new AVForm.AgreeDelegate(ravForm_AgreeEvent);//接收视频会话事件
            ravForm.btn_hangup.Visible = false;//挂断不可用
            ravForm.btn_agree.Visible = true;//接受可用
            ravForm.btn_refuse.Visible = true;//拒绝可用
            try
            {
                ravForm.Show();
            }
            catch (Exception)
            {

            }
        }
コード例 #3
0
ファイル: ChatForm.cs プロジェクト: songques/CSSIM_Solution
        /// <summary>
        /// 发送视频通话事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_videoOpen_MouseClick(object sender, MouseEventArgs e)
        {
            if (!OnLine)
                return;

            try
            {
                if (avForm != null)
                    if (!avForm.IsDisposed)
                        return;

                if (ravForm != null)
                    if (!ravForm.IsDisposed)
                        return;

                avForm = new AVForm(to_Jid);
                avForm.AVCloseEvent += new AVForm.AVCloseDelegate(avForm_AVCloseEvent);
                LocalVideoUDPPort = avForm.aVcommunicationEx1.selfUDPPort.ToString();

                avForm.Show();
            }
            catch (Exception)
            {

            }

            CSS.IM.XMPP.protocol.client.Message msg = new CSS.IM.XMPP.protocol.client.Message();
            msg.Type = MessageType.chat;
            msg.To = to_Jid;
            msg.SetTag("m_type", 1);
            msg.SetTag("UDPPort", LocalVideoUDPPort);
            msg.SetTag("UDPIP", Program.LocalHostIP.ToString());
            msg.Body = "falg";
            _connection.Send(msg);
            //callSoundPlayer.PlayLooping();
            //SoundPlayEx.MsgPlay("call");
        }