private void RegisterButton_Click(object sender, EventArgs e) { if (!(TextBoxIP.Text == null || TextBoxPort.Text == null) && (TextBoxIP.Text != this.ip || TextBoxPort.Text != this.port)) { _client.Disconnect(); _client.ConnectAsync(IPAddress.Parse(TextBoxIP.Text), Convert.ToInt32(TextBoxPort.Text)); this.ip = TextBoxIP.Text; this.port = TextBoxPort.Text; } _client.SendRegister(TextBoxUsername.Text, TextBoxPassword.Text); }