private void studentsList_MouseDoubleClick(object sender, MouseEventArgs e) { Console.WriteLine("Click"); ListViewHitTestInfo hit = studentsList.HitTest(studentsList.PointToClient(Control.MousePosition)); int day = 0; if (hit.Item.SubItems.IndexOf(hit.SubItem) > 0) { day = dayIndexes[hit.Item.SubItems.IndexOf(hit.SubItem)]; } DateTime dt = listedDate; if (day != 0) { dt = new DateTime(listedDate.Year, listedDate.Month, day); } ListViewItem studentItem = studentsList.FocusedItem; Student newStudent = null; foreach (Student student in studentsInListView.Keys) { if (student.Name == studentItem.Text) { newStudent = student; break; } } if (newStudent != null) { WriteAbsenceForm writeAbsenceForm = new WriteAbsenceForm(newStudent, dt); if (writeAbsenceForm.ShowDialog() == DialogResult.OK) { OnPresenceChangedAction.Invoke(newStudent, writeAbsenceForm.Presence); } } }
public void PresenceChange(PresenceChange p) { OnPresenceChanged?.Invoke(p); }