public EmailControl(ContactEmailViewModel emailViewModel, ContactInfoViewModel contactInfoViewModel) { _emailViewModel = emailViewModel; _contactInfoViewModel = contactInfoViewModel; InitializeComponent(); _emailWatermark = new TextBoxWatermarkExtender(textBoxEmail, "email address"); _commentWatermark = new TextBoxWatermarkExtender(textBoxComment, "comment..."); textBoxEmail.Text = _emailViewModel.Email; textBoxComment.Text = _emailViewModel.Comment; _readOnly = textBoxEmail.ReadOnly = textBoxComment.ReadOnly = contactInfoViewModel.ReadOnly; toolStripMenuItemRemove.Enabled = !_readOnly; textBoxEmail.TextChanged += textBoxEmail_TextChanged; textBoxComment.TextChanged += textBoxComment_TextChanged; new TextBoxValidationHelper(textBoxEmail, () => IsValidEmail(_emailWatermark.GetText())); }
void TextBoxNumberTextChanged(object sender, EventArgs e) { _phoneViewModel.Number = _numberWatermark.GetText(); }
void TextBoxCommentTextChanged(object sender, EventArgs e) { _phoneViewModel.Comment = _commentWatermark.GetText(); }
void textBoxEmail_TextChanged(object sender, EventArgs e) { _emailViewModel.Email = _emailWatermark.GetText(); }
void textBoxComment_TextChanged(object sender, EventArgs e) { _emailViewModel.Comment = _commentWatermark.GetText(); }