예제 #1
0
파일: DragDrop.cs 프로젝트: yas/Cube.Pdf
        /* ----------------------------------------------------------------- */
        ///
        /// 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);
        }
예제 #2
0
        /* ----------------------------------------------------------------- */
        ///
        /// MovePrevious
        ///
        /// <summary>
        /// Moves selected items accoding to the specified condition.
        /// </summary>
        ///
        /// <param name="src">Facade object.</param>
        /// <param name="obj">Drag&amp;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);
        }
예제 #3
0
파일: DragDrop.cs 프로젝트: yas/Cube.Pdf
 /* ----------------------------------------------------------------- */
 ///
 /// InsertOrMove
 ///
 /// <summary>
 /// Inserts or moves the specified pages according to the specified
 /// condition.
 /// </summary>
 ///
 /// <param name="src">Source object.</param>
 /// <param name="obj">Drag&amp;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);
     }
 }