Exemple #1
0
        public bool InviteClient(IClient client)
        {
            if (client == null)
            {
                return(false);
            }

            PeerCommunicator pc;

            if (peers.TryGetValue(client.Nickname, out pc))
            {
                MessageBox.Show(client.RealName + " [" + client.Nickname +
                                "] is already chatting with you!", "Invitation Not Allowed",
                                MessageBoxButtons.OK);
                return(false);
            }

            pc = Utils.GetClientCommunicator(client);
            bool result = pc.RequestChat(this);

            if (result)
            {
                peers.Add(client.Nickname, pc);
                NewChatEvent?.Invoke(client);
            }
            return(result);
        }
Exemple #2
0
        public override bool HandleInvite(IClient requestingClient)
        {
            var confirmResult = MessageBox.Show(requestingClient.RealName + " [" + requestingClient.Nickname +
                                                "] invited you to chat. Do you want accept his invite?", "Chat invite",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                peers.Add(requestingClient.Nickname, Utils.GetClientCommunicator(requestingClient));
                NewChatEvent?.Invoke(requestingClient);
                return(true);
            }

            return(false);
        }