private void BtnSend_Click(object sender, EventArgs e) { if (selectedContact != null) { if (string.IsNullOrWhiteSpace(TxtInput.Text)) { MessageBox.Show("The message must not be empty."); } else { MessageService.SendMessage(selectedContact, TxtInput.Text); PrintMessage(MessageRepo.GetLastMessage(selectedContact)); TxtInput.ResetText(); } } else { MessageBox.Show("Plz select a contact before sending a message."); } }