public void RemoveSelection(IListSelection selection) { if (selection is null) { throw new ArgumentNullException(nameof(selection)); } if (selection.Count == 0) { throw new ArgumentNullException(nameof(selection)); } var values = BaseList.GetSelectionData(selection); WriteData( () => BaseList.RemoveSelection(values.Selection), () => BaseList.InsertSelection(values)); }
public void Cut(IListSelection selection) { if (!CanCut) { return; } var e = new CancelEventArgs(); OnBeginCut(e); if (e.Cancel) { return; } CopyData = this.GetSelectionData(selection); Parent.Cut(GetByteSelection(selection)); OnCutComplete(EventArgs.Empty); }
public void TransformSelection( IListSelection selection, Func <T, T> func) { if (selection is null) { throw new ArgumentNullException(nameof(selection)); } if (selection.Count == 0) { return; } var values = BaseList.GetSelectionData(selection); WriteData( () => BaseList.TransformSelection(selection, func), () => BaseList.WriteSelection(values)); }
public static int FindLastIndex <T>( this IReadOnlyList <T> list, IListSelection selection, Predicate <T> match) { if (list is null) { throw new ArgumentNullException(nameof(list)); } if (selection is null) { throw new ArgumentNullException(nameof(selection)); } if (match is null) { throw new ArgumentNullException(nameof(match)); } for (var i = selection.Count; --i >= 0;) { var index = selection[i]; if ((uint)index >= list.Count) { continue; } if (match(list[index])) { return(index); } } return(-1); }
public void TransformSelection(IListSelection selection, Func <byte, byte> func) { BaseList.TransformSelection(selection, func); }
public void RemoveSelection(IListSelection selection) { BaseList.RemoveSelection(selection); }
public KeyCollection(IListSelection selection) { Selection = selection; }
public static void ClearSelection <T>( this List <T> list, IListSelection selection) { TransformSelection(list, selection, _ => default); }
public static ListSelectionData <T> GetSelectionData <T>( this IReadOnlyList <T> list, IListSelection selection) { return(new ListSelectionData <T>(selection, list)); }