Example #1
0
 public Main()
 {
     pChat = new PrivateChat(this);
     InitializeComponent();
     listener = new Listener(2014);
     listener.SocketAccepted += listener_SocketAccepted;
 }
Example #2
0
 public Main()
 {
     pChat = new PrivateChat(this);
     InitializeComponent();
     listener = new Listener(2014);
     listener.SocketAccepted += listener_SocketAccepted;
 }
Example #3
0
 private void chatWithClientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (var client in from ListViewItem item in clientList.SelectedItems select(Client) item.Tag)
     {
         client.Send("Chat|");
         pChat = new PrivateChat(this);
         pChat.Show();
     }
 }
Example #4
0
 private void chatWithClientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (var client in from ListViewItem item in clientList.SelectedItems select (Client) item.Tag)
     {
         client.Send("Chat|");
         pChat = new PrivateChat(this);
         pChat.Show();
     }
 }
Example #5
0
 //Gửi yêu cầu chat riêng với client
 private void privateChatToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (var client in from ListViewItem item in userlist.SelectedItems select(User) item.Tag)
     {
         string to    = userlist.SelectedItems[0].SubItems[0].Text;
         var    value = listpChat.SingleOrDefault(r => r.getTo() == to);
         if (value == null) //Neu chua co form
         {
             client.SendData("Chat|" + to);
             pChat = new PrivateChat(this);
             pChat.SetTo(to);
             pChat.Show();
             listpChat.Add(pChat);
         }
     }
 }
Example #6
0
        //Chat riêng tư với client
        private void ChatPrivateWithUser(string [] cmd)
        {
            var value = listpChat.SingleOrDefault(r => r.getTo() == cmd[1]);

            if (value != null) //Neu trong list ton tai form
            {
                value.chatBox.Text += cmd[1] + " : " + cmd[2] + "\r\n";
            }
            else
            {
                this.Invoke(() =>
                {
                    pChat = new PrivateChat(this);
                    pChat.SetTo(cmd[1]);
                    pChat.Show();
                    listpChat.Add(pChat);
                    pChat.chatBox.Text += cmd[1] + " : " + cmd[2] + "\r\n";
                });
            }
        }
Example #7
0
 public void Remove(PrivateChat p)
 {
     listpChat.Remove(p);
 }