private void editNoteButton_Click(object sender, EventArgs e) { if (campaignTree.SelectedNode.Level != 2 || campaignTree.SelectedNode == null) { MessageBox.Show("Please select the note you wish to edit", "Select Note", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } noteType type; if (campaignTree.SelectedNode.Parent.Parent.Text == "General Notes") { type = noteType.generalNote; } else { type = noteType.note; } Note noteToEdit = currentCalendar.findNote(campaignTree.SelectedNode.Text, type); if (Calendar.CanEditOrDelete(noteToEdit)) { EditNotesDialog editNoteDialog = new EditNotesDialog(noteToEdit, currentCalendar); editNoteDialog.ShowDialog(this); UpdateTree(); } else { MessageBox.Show(this, "This note cannot be edited.", "Cannot edit note", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void editNotesButton_Click(object sender, EventArgs e) { if (noteBox.SelectedItem != null && noteBox.SelectedItem.ToString().Contains("(TIMER)") == false) { noteType type; // if the selected note is general Note selectedNote = currentCalendar.findNote(parseNoteContent(noteBox.SelectedItem.ToString(), out type), type); if (Calendar.CanEditOrDelete(selectedNote) == false) { MessageBox.Show(this, "This note cannot be edited.", "Cannot edit note", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } EditNotesDialog editNoteDialog = new EditNotesDialog(selectedNote, currentCalendar); editNoteDialog.ShowDialog(this); } UpdateCalendar(); }