private void createContact_Click(object sender, System.EventArgs e) { ContactEditor editor = new ContactEditor(); editor.LoadPath = LoadPath; editor.CurrentAddressBook = this.addressBook; DialogResult result = editor.ShowDialog(); if (result == DialogResult.OK) { AddContactToListView(editor.CurrentContact, 1, true); } }
private void editContact_Click(object sender, EventArgs e) { ListViewItem selectedItem = null; foreach (ListViewItem lvitem in this.contacts.SelectedItems) { selectedItem = lvitem; } if (selectedItem != null) { ContactEditor editor = new ContactEditor(); editor.LoadPath = LoadPath; editor.CurrentAddressBook = this.addressBook; editor.CurrentContact = (Contact)selectedItem.Tag; DialogResult result = editor.ShowDialog(); if (result == DialogResult.OK) { selectedItem.Text = editor.CurrentContact.FN; } } }
private void edit_Click(object sender, System.EventArgs e) { ContactEditor editor = new ContactEditor(); editor.LoadPath = LoadPath; IEnumerator contactEnumerator = booksContacts.SelectedContacts.GetEnumerator(); ListViewItem item = null; while (contactEnumerator.MoveNext()) { item = (ListViewItem)contactEnumerator.Current; } if (item != null) { editor.CurrentContact = (Contact)item.Tag; editor.CurrentAddressBook = this.addressBook; DialogResult result = editor.ShowDialog(); if (result == DialogResult.OK) { try { item.Text = editor.CurrentContact.FN; } catch (SimiasException ex) { ex.LogError(); item.Text = editor.CurrentContact.UserName; } catch (Exception ex) { logger.Debug(ex, "Get Contact.FN"); } } } }