private void OpenRoom() { ArrayList alOnlineUser = new ArrayList(); FormChatRoom objChatWin; if (chan == null) { chan = new TcpChannel(); ChannelServices.RegisterChannel(chan, false); //Download source code FREE tai Sharecode.vn objChatWin = new FormChatRoom(); objChatWin.MyGetData = new FormChatRoom.GetString(GetValue); objChatWin.remoteObj = (SampleObject)Activator.GetObject(typeof(LanMessengerChatRoomBase.SampleObject), "tcp://" + Global.server.GetIP(txtNick.Text) + ":7070/" + txtNick.Text); if (!objChatWin.remoteObj.JoinToChatRoom(Global.username)) { MessageBox.Show(Global.username + " đã đăng nhập rồi!. Có thể mạng bị lag, hãy thử lại sau!"); ChannelServices.UnregisterChannel(chan); chan = null; objChatWin.Dispose(); return; } objChatWin.key = objChatWin.remoteObj.CurrentKeyNo(); objChatWin.yourName = Global.username; this.Hide(); objChatWin.Show(); } else { MessageBox.Show("Đã có lỗi xảy ra khi tạo Room Chat, vui lòng thử lại sau!"); ChannelServices.UnregisterChannel(chan); chan = null; } }
private void OpenRoom() { ArrayList alOnlineUser = new ArrayList(); FormChatRoom objChatWin; if (chan == null) { chan = new TcpChannel(); ChannelServices.RegisterChannel(chan, false); //Download source code FREE tai Sharecode.vn objChatWin = new FormChatRoom(); objChatWin.MyGetData = new FormChatRoom.GetString(GetValue); objChatWin.remoteObj = (SampleObject)Activator.GetObject(typeof(LanMessengerChatRoomBase.SampleObject), "tcp://" + Global.server.GetIP(txtNick.Text) + ":7070/" + txtNick.Text); if (!objChatWin.remoteObj.JoinToChatRoom(Global.username)) { MessageBox.Show(Global.username + " Signed in! Can lag network, try again later!"); ChannelServices.UnregisterChannel(chan); chan = null; objChatWin.Dispose(); return; } objChatWin.key = objChatWin.remoteObj.CurrentKeyNo(); objChatWin.yourName = Global.username; this.Hide(); objChatWin.Show(); } else { MessageBox.Show("An error occurred while creating Room Chat, please try again later!"); ChannelServices.UnregisterChannel(chan); chan = null; } }