Пример #1
0
 private void btnInfo_Click(object sender, EventArgs e)
 {
     if (flag)
     {
         Note     note = NoteController.getNote(int.Parse(listView1.SelectedItems[0].Text));
         string[] arr  = note.NoteDescription.Split(' ');
         string[] arr1 = note.NoteDescription.Split('\n');
         int      a    = arr.Count() + arr1.Count() - 1;
         MessageBox.Show(note.NoteDescription.Length + "character\n" + a + "words\n" + "Modified: " + note.NoteModified.Value.ToString(), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnDelete.Enabled = btnInfo.Enabled = btnSave.Enabled = false;
     }
     else
     {
         Trash trash = TrashConntroller.GetTrash(int.Parse(listView1.SelectedItems[0].Text));
         Note  note  = new Note();
         note.NoteID          = NoteController.getID();
         note.NoteTitle       = trash.TrashTitle;
         note.NoteDescription = trash.TrashDescription;
         note.NoteModified    = DateTime.Now;
         TrashConntroller.deleteTrash(int.Parse(listView1.SelectedItems[0].Text));
         NoteController.addNote(note);
         loadNote();
         reset();
         btnDelete.Enabled = btnInfo.Enabled = btnSave.Enabled = false;
     }
 }
Пример #2
0
 private void listView1_Click(object sender, EventArgs e)
 {
     btnDelete.Enabled = btnInfo.Enabled = btnSave.Enabled = true;
     i = int.Parse(listView1.SelectedItems[0].Text);
     if (flag)
     {
         Note note = NoteController.getNote(int.Parse(listView1.SelectedItems[0].Text));
         tbTitle.Text        = note.NoteTitle;
         rtbDescreption.Text = note.NoteDescription;
     }
     else
     {
         Trash trash = TrashConntroller.GetTrash(int.Parse(listView1.SelectedItems[0].SubItems[0].Text));
         tbTitle.Text        = trash.TrashTitle;
         rtbDescreption.Text = trash.TrashDescription;
     }
 }