Пример #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;
            }
        }
Пример #2
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);
                }

            }

        }
Пример #3
0
 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();
     }
 }
Пример #4
0
 private static void OnSessionCalleeAckNotify(long channel_id, string uid, int mode, bool accept)
 {
     if (accept)
     {
         DemoTrace.WriteLine("对方接听");
     }
     else
     {
         NIMDemo.MainForm.VideoChatForm vchat_form = MainForm.VideoChatForm.GetInstance();
         if(vchat_form.VchatInfo.state==MainForm.VChatState.kVChatInvite)
         {
             MainForm.VideoChatInfo vchat_info = vchat_form.VchatInfo;
             vchat_info.state = MainForm.VChatState.kVChatInviteRefuse;
             vchat_form.VchatInfo = vchat_info;
         }
     }
 }
Пример #5
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);
			}
        }