public void DeleteSelection() { int idx = listSubrecord.SelectedIndices[0]; var objects = GetSelectedSubrecords(); if (!objects.Any()) { return; } subrecords.RemoveRange(objects); FireSelectionChanged(); if (idx > listSubrecord.Items.Count - 1) { idx = listSubrecord.Items.Count - 1; } if (idx > 0) { SelectIndex(idx); } UpdateToolStripSelection(); foreach (var sr in objects.Where(sr => sr.Parent is Record).Select(sr => sr.Parent).Distinct()) { sr.UpdateShortDescription(); } listSubrecord.Refresh(); }
public void DeleteSelection() { var objects = GetSelectedSubrecords(); if (!objects.Any()) { return; } subrecords.RemoveRange(objects); FireSelectionChanged(); UpdateToolStripSelection(); foreach (var sr in objects.Where(sr => sr.Parent is Record).Select(sr => sr.Parent).Distinct()) { sr.UpdateShortDescription(); } listSubrecord.Refresh(); }