Ejemplo n.º 1
0
        /**
         * This method is called when the selected row in the note list changes.
         * It updates all the necessary components to reflect the change.
         */
        private void ChangeSelectedNote(int displayNotesIdx)
        {
            selectedNoteIdx = displayNotesIdx;
            selectedNote = null;

            if (selectedNoteIdx < 0)
            {
                noteTextArea.Text = "";
                noteCreatedLabel.Text = "";
                noteModifiedLabel.Text = "";
                return;
            }

            selectedNote = displayNotes[selectedNoteIdx];

            noteTextArea.Text = selectedNote.Text;

            noteCreatedLabel.Text = "Note created ";
            if (selectedNote.Created.Date == DateTime.Today)
                noteCreatedLabel.Text += "at " + selectedNote.CreatedText;
            else
                noteCreatedLabel.Text += "on " + selectedNote.CreatedText;

            noteModifiedLabel.Text = "Last saved ";
            if (selectedNote.Modified.Date == DateTime.Today)
                noteModifiedLabel.Text += "at " + selectedNote.ModifiedText;
            else
                noteModifiedLabel.Text += "on " + selectedNote.ModifiedText;
        }
Ejemplo n.º 2
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            allNotes.Remove(selectedNote);

            selectedNote = null;
            selectedNoteIdx = -1;

            RefreshDisplayNotes();
        }