private void deleteTemplateButton_Click(object sender, EventArgs e) { TemplateView view = templateViewBindingSource.Current as TemplateView; if (view == null) return; using (ConfirmDeleteDialog cfd = new ConfirmDeleteDialog( String.Format("Are you sure you want to delete the template '{0}'?", view.Name), "Any entries that use this template will be given custom fields with the old values.", "Delete Template", "Delete Template")) { if (cfd.ShowDialog() == DialogResult.OK) _templateViews.Remove(view); } }
private void deleteEntryToolStripMenuItem_Click(object sender, EventArgs e) { if (_activeClient == null || entryListView.SelectedItems.Count < 1) return; var entry = entryListView.SelectedItems[0].Tag as ClientEntry; if (entry == null) return; using (var pcd = new ConfirmDeleteDialog(entry)) { if (pcd.ShowDialog() == DialogResult.OK) { _activeClient.RemoveEntry(entry); this.CurrentDatabase.CommitClient(_activeClient); } } }
private void removeFieldButton_Click(object sender, EventArgs e) { var templateView = templateViewBindingSource.Current as TemplateView; var fieldView = fieldViewsBindingSource.Current as EntryFieldView; if (templateView == null || fieldView == null) return; using (ConfirmDeleteDialog cfd = new ConfirmDeleteDialog( String.Format("Are you sure you want to delete the '{0}' field from the template '{1}'?", fieldView.Name, templateView.Name), "Any entries that use this field will be given custom fields with the old values.", "Delete Field", "Delete Template Field")) { if (cfd.ShowDialog() == DialogResult.OK) templateView.RemoveView(fieldView); } }