/// <summary> /// Add a vCard to the collection /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAdd_Click(object sender, EventArgs e) { using (VCardPropertiesDlg dlg = new VCardPropertiesDlg()) { if (dlg.ShowDialog() == DialogResult.OK) { VCard newVCard = new VCard(); dlg.GetValues(newVCard); // Create a unique ID for the new vCard newVCard.UniqueId.AssignNewId(true); vCards.Add(newVCard); } } }
/// <summary> /// Edit a vCard in the collection /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnEdit_Click(object sender, EventArgs e) { if (dgvCards.CurrentCellAddress.Y == -1) { MessageBox.Show("Please select a vCard to edit", "No vCard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } using (VCardPropertiesDlg dlg = new VCardPropertiesDlg()) { this.Cursor = Cursors.WaitCursor; dlg.SetValues(vCards[dgvCards.CurrentCellAddress.Y]); this.Cursor = Cursors.Default; if (dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCards[dgvCards.CurrentCellAddress.Y]); wasModified = true; } } }
/// <summary> /// Edit a vCard in the collection /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnEdit_Click(object sender, EventArgs e) { if(dgvCards.CurrentCellAddress.Y == -1) { MessageBox.Show("Please select a vCard to edit", "No vCard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } using(VCardPropertiesDlg dlg = new VCardPropertiesDlg()) { this.Cursor = Cursors.WaitCursor; dlg.SetValues(vCards[dgvCards.CurrentCellAddress.Y]); this.Cursor = Cursors.Default; if(dlg.ShowDialog() == DialogResult.OK) { dlg.GetValues(vCards[dgvCards.CurrentCellAddress.Y]); wasModified = true; } } }
/// <summary> /// Add a vCard to the collection /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAdd_Click(object sender, EventArgs e) { using(VCardPropertiesDlg dlg = new VCardPropertiesDlg()) { if(dlg.ShowDialog() == DialogResult.OK) { VCard newVCard = new VCard(); dlg.GetValues(newVCard); // Create a unique ID for the new vCard newVCard.UniqueId.AssignNewId(true); vCards.Add(newVCard); } } }