public FormEditNote(MyNote.Tables.Note note) { InitializeComponent(); this.note = note; this.txtTitle.Text = note.Title; this.txtContent.Text = note.Content; }
private void btnOK_Click(object sender, EventArgs e) { MyNote.Tables.Note note = this.note; note.Title = this.txtTitle.Text; note.Content = this.txtContent.Text; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnAddNote_Click(object sender, EventArgs e) { FormAddNote frmAddNote = new FormAddNote(); if (frmAddNote.ShowDialog() == System.Windows.Forms.DialogResult.OK) { MyNote.Tables.Note note = frmAddNote.NewNote; this.database.Insert(note); this.UpdateAllNotes(); } }
private void lstNotes_SelectedIndexChanged(object sender, EventArgs e) { if (this.lstNotes.SelectedIndex >= 0) { this.selectedNoteList.Clear(); foreach (var item in this.lstNotes.SelectedItems) { MyNote.Tables.Note note = item as MyNote.Tables.Note; this.selectedNoteList.Add(note); } } UpdateSelectingUI(); }
private void lstNotes_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.lstNotes.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { MyNote.Tables.Note note = this.lstNotes.Items[index] as MyNote.Tables.Note; FormEditNote frmEditNote = new FormEditNote(note); if (frmEditNote.ShowDialog() == System.Windows.Forms.DialogResult.OK) { database.Update(note); UpdateAllNotes(); UpdateSelectingUI(); } } }