private void EditContactByItem(Contact contact) { if (contact == null) { return; } var copy = contact.Duplicate(); using (var dlg = new EditContactDialog(copy)) { dlg.Text = "Edit Contact"; if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { gridViewContacts.BeginDataUpdate(); var index = contacts.IndexOf(contact); contacts[index] = copy; gridViewContacts.EndDataUpdate(); } } }
private void tbbView_ItemClick(object sender, ItemClickEventArgs e) { var contact = gridViewContacts.GetFocusedRow() as Contact; if (contact == null) { return; } using (var dlg = new EditContactDialog(contact)) { var title = "Contact"; var name = contact.Name; if (name != null) { title = name.GetDisplay(); } dlg.Text = "View " + title; dlg.SetToViewMode(); dlg.ShowDialog(this); } }
private void tbbAdd_ItemClick(object sender, ItemClickEventArgs e) { var contact = new Contact { Addresses = new List <StreetAddress>(), Dates = new List <SpecialDate>(), Emails = new List <EmailAddress>(), ID = Arbiter.ID, Name = new ContactName(), Notes = "", Phones = new List <PhoneNumber>(), }; using (var dlg = new EditContactDialog(contact)) { dlg.Text = "Add Contact"; if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { contacts.Add(contact); } } }