private Message Savedata() { var message = new Message(); message.Subject = _txtSubject.Text; message.Body = _txtBody.Text; message.MessageContact = CurrentContact.Address; return(message); }
private void OnSave(object sender, EventArgs e) { if (!ValidateChildren()) { return; } var message = Savedata(); try { ObjectValidator.Validate(message); } catch (ValidationException) { MessageBox.Show(this, "Message is not valid.", "Error", MessageBoxButtons.OK); return; } CurrentMessage = message; DialogResult = DialogResult.OK; Close(); }
public void Send(Message message) { _txtSentMessages.Text += $"To: {message.MessageContact}\r\nSubject: {message.Subject}\r\n{message.Body}\r\n\r\n"; return; }