예제 #1
0
        private void createNoteBtn_Click(object sender, EventArgs e)
        {
            var dialog = new NoteDialog(new Note(), false);
            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                _noteRepo.Add(dialog.Item);
                reloadNotes();
            }
        }
예제 #2
0
        private void editNoteBtn_Click(object sender, EventArgs e)
        {
            var selected = notesLv.SelectedIndices;

            if (selected.Count == 1)
            {
                var selectedIndex = selected[0];
                var note          = _notes[selectedIndex];

                var dialog = new NoteDialog(note, true);
                var result = dialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _noteRepo.Edit(dialog.Item);
                    reloadNotes();
                }
            }
        }