Exemple #1
0
        private static void OnSessionConnectNotify(long channel_id, int code, string record_file, string video_record_file,long chat_time,ulong chat_rx,ulong chat_tx)
        {
            DemoTrace.WriteLine("Session Connect channel_id:" + channel_id.ToString() +
                " code:" + code.ToString() + " record_file:" + record_file + " video_record_file" + video_record_file + 
                "chat_time:" + chat_time.ToString() + "chat_rx:" + chat_rx.ToString() + "chat_tx" + chat_tx.ToString());
            if (code == 200)
            {
                Action a = () =>
                {
                    GetInstance().channel_id = channel_id;
                    MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
                    MainForm.VideoChatInfo vchatInfo = vform.VchatInfo;
                    if (vchatInfo.state != MainForm.VChatState.kVChatUnknow
                    && vchatInfo.state != MainForm.VChatState.VChatEnd
                    && vchatInfo.state != MainForm.VChatState.kVChatInviteRefuse)
                    {
                        vchatInfo.state = MainForm.VChatState.kVChating;
                        vform.VchatInfo = vchatInfo;
                    }
                };
                _ownerFriendsListForm.BeginInvoke(a);
                StartDevices();

            }
            else
            {
                NIM.VChatAPI.End();
                GetInstance().channel_id = 0;
            }
        }
        private void VideoChatForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            sendCaptureScreenDataTimer_.Stop();
            switch (vchat_info.state)
            {
            case VChatState.kVChatNotify:
            {
                NIM.VChatAPI.CalleeAck(vchat_info.channel_id, false, null);
            }
            break;

            case VChatState.kVChatInvite:
            case VChatState.kVChating:
                NIM.VChatAPI.End();
                break;

            case VChatState.VChatEnd:
                break;
            }

            {
                MultimediaHandler.ReceiveVideoFrameHandler  -= OnReceivedVideoFrame;
                MultimediaHandler.CapturedVideoFrameHandler -= OnCapturedVideoFrame;
            }

            _peerRegionGraphics.Dispose();
            _mineRegionGraphics.Dispose();
            videoChatForm_        = null;
            vchat_info.channel_id = 0;
            // _multimediaHandler = null;
        }
Exemple #3
0
        private static void OnSessionInviteNotify(long channel_id, string uid, int mode, long time,string custom_info)
        {
            if (GetInstance().channel_id != 0 && channel_id != GetInstance().channel_id)
            {
                NIM.NIMVChatInfo info = new NIM.NIMVChatInfo();
                NIM.VChatAPI.CalleeAck(channel_id, false, info);
            }
            else
            {
                MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
                MainForm.VideoChatInfo vchat_info = vform.VchatInfo;
                if (vchat_info.state == MainForm.VChatState.kVChatUnknow)
                {
                    vchat_info.channel_id = channel_id;
                    vchat_info.uid = uid;
                    vchat_info.state = MainForm.VChatState.kVChatNotify;
                    vform.VchatInfo = vchat_info;
                    Action a = () =>
                    {
                        vform.Show();
                    };
                    _ownerFriendsListForm.BeginInvoke(a);
                }
                else
                {
                    NIM.NIMVChatInfo info = new NIM.NIMVChatInfo();
                    NIM.VChatAPI.CalleeAck(channel_id, false, info);
                }

            }

        }
 public static VideoChatForm GetInstance()
 {
     if (videoChatForm_ == null)
     {
         videoChatForm_ = new VideoChatForm();
     }
     return(videoChatForm_);
 }
Exemple #5
0
        private void VideoChatForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            //if (_multimediaHandler != null)
            NIM.VChatAPI.End();
            {
                MultimediaHandler.ReceiveVideoFrameHandler  -= OnReceivedVideoFrame;
                MultimediaHandler.CapturedVideoFrameHandler -= OnCapturedVideoFrame;
            }

            _peerRegionGraphics.Dispose();
            _mineRegionGraphics.Dispose();
            videoChatForm_ = null;
            // _multimediaHandler = null;
        }
 private void button2_Click(object sender, EventArgs e)
 {
     MainForm.VideoChatForm vchat_form = MainForm.VideoChatForm.GetInstance();
     if (vchat_form.VchatInfo.state == MainForm.VChatState.kVChatUnknow)
     {
         MainForm.VideoChatInfo vchat_info = vchat_form.VchatInfo;
         vchat_info.state     = MainForm.VChatState.kVChatInvite;
         vchat_info.uid       = _peerId;
         vchat_info.chat_mode = NIMVideoChatMode.kNIMVideoChatModeVideo;
         vchat_form.VchatInfo = vchat_info;
         vchat_form.Show();
     }
     else
     {
         vchat_form.Activate();
     }
 }
        private static void OnSessionHangupNotify(long channel_id, int code)
        {
            EndDevices();
            if (code == 200)
            {
                Action action = () =>
                {
                    MessageBox.Show("已挂断");

                    MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
                    if (vform != null)
                    {
                        vform.Close();
                    }
                };
                _ownerFriendsListForm.Invoke(action);
            }
        }
Exemple #8
0
        private static void OnSessionHangupNotify(long channel_id, int code)
        {
            EndDevices();
			if (code == 200)
			{
				Action action = () =>
				{
					//MessageBox.Show("已挂断");

					MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
                    MainForm.VideoChatInfo vchat_info = vform.VchatInfo;
                    vchat_info.state = MainForm.VChatState.VChatEnd;
                    vform.VchatInfo = vchat_info;

				};
				_ownerFriendsListForm.BeginInvoke(action);
			}
        }
Exemple #9
0
 private static void OnSessionHangupNotify(long channel_id, int code)
 {
     DemoTrace.WriteLine("OnSessionHangupNotify channel_id:" + channel_id.ToString() + " code:" + code.ToString());
     EndDevices();
     if (code == 200)
     {
         Action action = () =>
         {
             //MessageBox.Show("已挂断");
             SendCommand("e");
             MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
             if (vform != null)
             {
                 vform.Close();
             }
         };
         _ownerFriendsListForm.Invoke(action);
     }
 }
Exemple #10
0
 private static void OnSessionConnectNotify(long channel_id, int code, string record_file, string video_record_file)
 {
     if (code == 200)
     {
         Action a = () =>
         {
             if (NIMDemo.Helper.VChatHelper.CurrentVChatType == NIMDemo.Helper.VChatType.kP2P)
             {
                 MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
                 vform.Show();
             }
         };
         _ownerFriendsListForm.Invoke(a);
         StartDevices();
     }
     else
     {
         NIM.VChatAPI.End();
     }
 }
Exemple #11
0
 private static void OnSessionConnectNotify(long channel_id, int code, string record_file, string video_record_file, long chat_time, ulong chat_rx, ulong chat_tx)
 {
     DemoTrace.WriteLine("Session Connect channel_id:" + channel_id.ToString() +
                         " code:" + code.ToString() + " record_file:" + record_file + " video_record_file" + video_record_file +
                         "chat_time:" + chat_time.ToString() + "chat_rx:" + chat_rx.ToString() + "chat_tx" + chat_tx.ToString());
     if (code == 200)
     {
         Action a = () =>
         {
             if (NIMDemo.Helper.VChatHelper.CurrentVChatType == NIMDemo.Helper.VChatType.kP2P)
             {
                 MainForm.VideoChatForm vform = MainForm.VideoChatForm.GetInstance();
                 vform.Show();
             }
         };
         _ownerFriendsListForm.Invoke(a);
         StartDevices();
     }
     else
     {
         NIM.VChatAPI.End();
     }
 }