private void registerMeButton_Click(object sender, EventArgs e) { if (hostIPAddressTextBoxCreate.Text == "" || portTextBoxCreate.Text == "") { MessageBox.Show("IP Address and Port mustn't be empty !"); return; } String ip = hostIPAddressTextBoxCreate.Text; int port = int.Parse(portTextBoxCreate.Text); bool connected = client.Connect(ip, port); if (connected) { if (client.RegisterUser(userTextBox.Text, emailTextBox.Text, passwordTextBox.Text)) { MessageBox.Show("User successfuly registered !"); this.Hide(); (new LoginFormUserWindow()).Show(); } else { MessageBox.Show("Error registering user !"); } } else { MessageBox.Show("Error connecting to the server !"); } }
private void logMeInButtonLog_Click(object sender, EventArgs e) { if (ipAddressTextBoxLog.Text == "" || portTextBoxLog.Text == "") { MessageBox.Show("IP Address and Port mustn't be empty !"); return; } String ip = ipAddressTextBoxLog.Text; int port = int.Parse(portTextBoxLog.Text); bool connected = client.Connect(ip, port); if (connected) { if (client.LoginUser(userNameTextBoxLog.Text, passwordTextBoxLog.Text)) { MessageBox.Show("User successfuly logged in !"); this.Hide(); (new ChatWindowClient()).Show(); } } else { MessageBox.Show("Error connecting to the server !"); } }