コード例 #1
0
 private void CreateMultiVChatRoomCallback(int code, long channel_id, string json_extension)
 {
     if (code == 200)
     {
         NIM.NIMJoinRoomJsonEx joinRoomJsonEx = new NIMJoinRoomJsonEx();
         CustomLayout          layout_json    = new CustomLayout();
         layout_json.Hostarea   = new HostArea();
         layout_json.Background = new BackGround();
         joinRoomJsonEx.Layout  = layout_json.Serialize();
         //创建房间成功,将内容抛至UI线程
         Action action = () =>
         {
             if (VChatAPI.JoinRoom(NIMVideoChatMode.kNIMVideoChatModeVideo, room_name, joinRoomJsonEx, _joinroomcb))
             {
                 //调用成功
             }
             else
             {
                 string info = String.Format("加入房间-{0}-失败", room_name);
                 MessageBox.Show(info);
             }
         };
         this.Invoke(action);
     }
     else
     {
         Action action = () =>
         {
             MessageBox.Show("创建房间失败-错误码:" + code.ToString());
         };
         this.BeginInvoke(action);
     }
 }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            // string json_extension = "{\"session_id\":\"\"}";
            _room_name = tb_roomid.Text;
            NIM.NIMJoinRoomJsonEx joinRoomJsonEx = new NIMJoinRoomJsonEx();
            CustomLayout          layout         = new CustomLayout();

            layout.Hostarea       = new HostArea();
            layout.Background     = new BackGround();
            joinRoomJsonEx.Layout = layout.Serialize();
            if (VChatAPI.JoinRoom(NIMVideoChatMode.kNIMVideoChatModeVideo, _room_name, joinRoomJsonEx, _joinroomcb))
            {
                //调用成功
            }
            else
            {
                Action action = () =>
                {
                    MessageBox.Show("JoinRoom 调用失败:");
                };
                this.BeginInvoke(action);
            }
        }