Exemple #1
0
        private void deleteNoteButton_Click(object sender, EventArgs e)
        {
            if (noteBox.SelectedItem == null || noteBox.SelectedItem.ToString().Contains("(TIMER)"))
            {
                return;
            }
            noteType type;
            Note     noteToDelete = currentCalendar.findNote(parseNoteContent(noteBox.SelectedItem.ToString(), out type), type);

            if (Calendar.CanEditOrDelete(noteToDelete) == false)
            {
                MessageBox.Show(this, "This note cannot be deleted", "Cannot delete note", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else if (MessageBox.Show(this, "Are you sure you wish to delete this note?", "Delete note", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                if (noteToDelete.Campaign == null)
                {
                    currentCalendar.deleteNote(noteToDelete);
                }
                else
                {
                    noteToDelete.Campaign.deleteNote(noteToDelete);
                }
            }
            UpdateCalendar();
        }
        private void deleteNoteButton_Click(object sender, EventArgs e)
        {
            if (campaignTree.SelectedNode.Level != 2 || campaignTree.SelectedNode == null)
            {
                MessageBox.Show("Please select the note you wish to delete", "Delete Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            noteType type;

            if (campaignTree.SelectedNode.Parent.Parent.Text == "General Notes")
            {
                type = noteType.generalNote;
            }
            else
            {
                type = noteType.note;
            }

            Note noteToDelete = currentCalendar.findNote(campaignTree.SelectedNode.Text, type);

            if (Calendar.CanEditOrDelete(noteToDelete))
            {
                if (MessageBox.Show("Are you sure you want to delete this note?", "Delete Note", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    currentCalendar.deleteNote(noteToDelete);
                }
            }
            else
            {
                MessageBox.Show(this, "This note cannot be deleted.", "Cannot delete note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            UpdateTree();
        }
        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;
            }
        }
Exemple #4
0
 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();
 }