/* ----------------------------------------------------------------- */ /// /// MoveNext /// /// <summary> /// Moves selected items according to the specified condition. /// </summary> /// /* ----------------------------------------------------------------- */ private static void MoveNext(this MainFacade src, DragDropObject obj) { var delta = obj.DropIndex - obj.DragIndex; var n = src.Value.Images.Selection.Indices .Where(i => i > obj.DragIndex && i <= obj.DropIndex).Count(); src.Move(delta - n); }
/* ----------------------------------------------------------------- */ /// /// MovePrevious /// /// <summary> /// Moves selected items accoding to the specified condition. /// </summary> /// /// <param name="src">Facade object.</param> /// <param name="obj">Drag&Drop result.</param> /// /* ----------------------------------------------------------------- */ private static void MovePrevious(this MainFacade src, DragDropObject obj) { var delta = obj.DropIndex - obj.DragIndex; var n = src.Bindable.Images.Selection.Indices .Where(i => i < obj.DragIndex && i >= obj.DropIndex).Count(); src.Move(delta + n); }
/* ----------------------------------------------------------------- */ /// /// InsertOrMove /// /// <summary> /// Inserts or moves the specified pages according to the specified /// condition. /// </summary> /// /// <param name="src">Source object.</param> /// <param name="obj">Drag&Drop result.</param> /// /* ----------------------------------------------------------------- */ public static void InsertOrMove(this MainFacade src, DragDropObject obj) { if (!obj.IsCurrentProcess) { var index = Math.Min(obj.DropIndex + 1, src.Value.Count); src.Insert(index, obj.Pages); } else if (obj.DragIndex < obj.DropIndex) { src.MoveNext(obj); } else { src.MovePrevious(obj); } }