//new contact private void OnContactsNew(object sender, EventArgs e) { var form = new NewContactForm(); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.AddContact(form.Contact); RefreshContact(); }
//helpers private void EditContact() { var item = GetSelectedContact(); if (item == null) { return; } var form = new NewContactForm(); form.Contact = item; if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.EditContact(item.Name, form.Contact); RefreshContact(); }