Example #1
0
    public void SendGroupChatMessage(String name, Message msg)
    {
        GroupChat gc = (GroupChat)groupChats[name];

        foreach (string username in gc.users)
        {
            if (username != msg.sender)
            {
                IClientRem rem = (IClientRem)RemotingServices.Connect(typeof(IClientRem), (string)activeUsers[username]);
                rem.ReceiveMessage(msg);
            }
        }
    }
Example #2
0
        private void sendBtn_Click(object sender, EventArgs e)
        {
            if (!groupChatActive)
            {
                activeUserRemObj.ReceiveMessage(new Message(username, msgToSend.Text, username));
            }
            else
            {
                server.SendGroupChatMessage(activeUser, new Message(username, msgToSend.Text, activeUser));
            }
            ChatTab tab = (ChatTab)chatTabs[activeUser];

            tab.AddSenderText(msgToSend.Text, username);
            msgToSend.Clear();
        }