public void _client_Received(ClientSettings cs, string received) { var cmd = received.Split('|'); switch (cmd[0]) { case "Users": this.Invoke(() => { userList.Items.Clear(); for (int i = 1; i < cmd.Length; i++) { if (cmd[i] != "Connected" | cmd[i] != "RefreshChat") { userList.Items.Add(cmd[i]); } } }); break; case "Message": this.Invoke(() => { txtReceive.Text += cmd[1] + "\r\n"; }); break; case "RefreshChat": this.Invoke(() => { txtReceive.Text = cmd[1]; }); break; case "Chat": this.Invoke(() => { pChat.Text = pChat.Text.Replace("user", formLogin.txtNickname.Text); pChat.Show(); }); break; case "pMessage": this.Invoke(() => { pChat.txtReceive.Text += "Server says: " + cmd[1] + "\r\n"; }); break; case "Disconnect": Application.Exit(); break; } }
public LoginForm() { Client = new ClientSettings(); InitializeComponent(); }
private static void Client_Disconnected(ClientSettings cs) { }