private void AddNotes() { FormAddEditPostIt frmPostit = new FormAddEditPostIt(); string[] msg; frmPostit.ShowDialog(); if (frmPostit.DialogResult == DialogResult.OK) { ListViewItem itm = new ListViewItem(); itm.ImageIndex = frmPostit.Notes.Alerte == true ? 1 : 0; itm.Tag = frmPostit.Notes.Message; msg = frmPostit.Notes.Message.Split('\n'); itm.Text = msg[0].Substring(0, msg[0].Length - 1) + "..."; itm.SubItems.Add(frmPostit.Notes.Alerte.ToString()); itm.SubItems.Add(frmPostit.Notes.AlerteDateTime.ToString()); itm.SubItems.Add(frmPostit.Notes.Date.ToString()); itm.ToolTipText = frmPostit.Notes.Message; lvNote.Items.Add(itm); } ReloadPostItList(); }
/// <summary> /// Modifier une notes /// </summary> private void EditNotes() { try { if (lvNote.SelectedItems.Count > 0) { FormAddEditPostIt frmPostit = new FormAddEditPostIt(); string[] msg; frmPostit.Notes = NotesSelected; frmPostit.ShowDialog(); //Code apres edition if (frmPostit.DialogResult == DialogResult.OK) { msg = frmPostit.Notes.Message.Split('\n'); lvNote.SelectedItems[0].ImageIndex = frmPostit.Notes.Alerte == true ? 1 : 0; lvNote.SelectedItems[0].Tag = frmPostit.Notes.Message; lvNote.SelectedItems[0].Text = msg[0].Substring(0, msg[0].Length - 1) + "..."; lvNote.SelectedItems[0].SubItems[1].Text = frmPostit.Notes.Alerte.ToString(); lvNote.SelectedItems[0].SubItems[2].Text = frmPostit.Notes.AlerteDateTime.ToString(); lvNote.SelectedItems[0].SubItems[3].Text = frmPostit.Notes.Date.ToString(); lvNote.SelectedItems[0].ToolTipText = frmPostit.Notes.Message; } } } catch { } ReloadPostItList(); }