public int SendToServer(string Message) { byte[] Buffer = new byte[MAX]; Buffer = Encoding.Unicode.GetBytes(Message); if (!Sock.Connected) { Dictionary <string, string> Args = new Dictionary <string, string>(); Args.Add("ERROR", "no connection to server"); Loop.AddTask("SystemError", Args); return(-1); } return(Sock.Send(Buffer)); }
private void SendButton_Click(object sender, EventArgs e) { string Message = MsgEnterBox.Text; if (Message.Length == 0) { return; } MsgEnterBox.Clear(); Dictionary <string, string> Args = new Dictionary <string, string>(); Args.Add("TYPE", "global"); Args.Add("RECIEVERS", "all"); Args.Add("MSG", Message); Loop.AddTask("SendToServer", Args); return; }
private void LoginButton_Click(object sender, EventArgs e) { ErrorLabel.Visible = false; String Login = LoginBox.Text; String Password = PassBox.Text; if (Login.Length == 0 || Password.Length == 0) { ErrorLabel.Text = "Введите логин и/или пароль"; ErrorLabel.Visible = true; PassBox.Clear(); return; } Dictionary <string, string> Args = new Dictionary <string, string>(); Args["TYPE"] = "login"; Args["LOGIN"] = Login; Args["PASSWORD"] = Password; Loop.AddTask("SendToServer", Args); }