Exemple #1
0
        /// <summary>
        /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
        /// whether they are same application or different. To drop items on desktop use Desktop
        /// class's Drop method. White starts and ends the drag from center of the UIItems.
        /// Some drag and drop operation need to wait for application to process something while item is being dragged.
        /// This can be set but configuring DragStepCount property. This is by default set to 1.
        /// </summary>
        /// <param name="draggedItem"></param>
        /// <param name="startPosition">Start point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
        /// <param name="dropItem"></param>
        /// <param name="endPosition">End point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
        public virtual void DragAndDrop(IUIItem draggedItem, Point startPosition, IUIItem dropItem, Point endPosition)
        {
            Location = startPosition;
            HoldForDrag();
            draggedItem.ActionPerformed(Action.WindowMessage);
            var dragStepFraction = (float)(1.0 / CoreAppXmlConfiguration.Instance.DragStepCount);

            WhiteLogger.Instance.Info(CoreAppXmlConfiguration.Instance.DragStepCount + ":" + dragStepFraction);
            for (int i = 1; i <= CoreAppXmlConfiguration.Instance.DragStepCount; i++)
            {
                double newX     = startPosition.X + (endPosition.X - startPosition.X) * (dragStepFraction * i);
                double newY     = startPosition.Y + (endPosition.Y - startPosition.Y) * (dragStepFraction * i);
                var    newPoint = new Point((int)newX, (int)newY);
                Location = newPoint;
                draggedItem.ActionPerformed(Action.WindowMessage);
            }
            LeftUp();
            dropItem.ActionPerformed(Action.WindowMessage);
        }
Exemple #2
0
        /// <summary>
        /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
        /// whether they are same application or different. To drop items on desktop use Desktop
        /// class's Drop method. White starts and ends the drag from center of the UIItems.
        /// Some drag and drop operation need to wait for application to process something while item is being dragged.
        /// This can be set but configuring DragStepCount property. This is by default set to 1.
        /// </summary>
        /// <param name="mouseButton">The mouse button used for dragging</param>
        /// <param name="draggedItem"></param>
        /// <param name="startPosition">Start point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
        /// <param name="dropItem"></param>
        /// <param name="endPosition">End point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
        public virtual void DragAndDrop(MouseButton mouseButton, IUIItem draggedItem, Point startPosition, IUIItem dropItem, Point endPosition)
        {
            Location = startPosition;
            MouseButtonDown(mouseButton);
            var dragStepFraction = (float)(1.0 / CoreAppXmlConfiguration.Instance.DragStepCount);

            for (int i = 1; i <= CoreAppXmlConfiguration.Instance.DragStepCount; i++)
            {
                var newX     = startPosition.X + (endPosition.X - startPosition.X) * (dragStepFraction * i);
                var newY     = startPosition.Y + (endPosition.Y - startPosition.Y) * (dragStepFraction * i);
                var newPoint = new Point((int)newX, (int)newY);
                Location = newPoint;
            }
            MouseButtonUp(mouseButton);
            dropItem.ActionPerformed(Action.WindowMessage);
        }
Exemple #3
0
 /// <summary>
 /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
 /// whether they are same application or different. To drop items on desktop use Desktop 
 /// class's Drop method. White starts and ends the drag from center of the UIItems.
 /// Some drag and drop operation need to wait for application to process something while item is being dragged.
 /// This can be set but configuring DragStepCount property. This is by default set to 1.
 /// </summary>
 /// <param name="draggedItem"></param>
 /// <param name="startPosition">Start point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
 /// <param name="dropItem"></param>
 /// <param name="endPosition">End point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
 public virtual void DragAndDrop(IUIItem draggedItem, Point startPosition, IUIItem dropItem, Point endPosition)
 {
     Location = startPosition;
     HoldForDrag();
     draggedItem.ActionPerformed(Action.WindowMessage);
     var dragStepFraction = (float)(1.0 / CoreAppXmlConfiguration.Instance.DragStepCount);
     WhiteLogger.Instance.Info(CoreAppXmlConfiguration.Instance.DragStepCount + ":" + dragStepFraction);
     for (int i = 1; i <= CoreAppXmlConfiguration.Instance.DragStepCount; i++)
     {
         double newX = startPosition.X + (endPosition.X - startPosition.X) * (dragStepFraction * i);
         double newY = startPosition.Y + (endPosition.Y - startPosition.Y) * (dragStepFraction * i);
         var newPoint = new Point((int)newX, (int)newY);
         Location = newPoint;
         draggedItem.ActionPerformed(Action.WindowMessage);
     }
     LeftUp();
     dropItem.ActionPerformed(Action.WindowMessage);
 }
Exemple #4
0
 /// <summary>
 /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
 /// whether they are same application or different. To drop items on desktop use Desktop 
 /// class's Drop method. White starts and ends the drag from center of the UIItems.
 /// Some drag and drop operation need to wait for application to process something while item is being dragged.
 /// This can be set but configuring DragStepCount property. This is by default set to 1.
 /// </summary>
 /// <param name="mouseButton">The mouse button used for dragging</param>
 /// <param name="draggedItem"></param>
 /// <param name="startPosition">Start point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
 /// <param name="dropItem"></param>
 /// <param name="endPosition">End point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
 public virtual void DragAndDrop(MouseButton mouseButton, IUIItem draggedItem, Point startPosition, IUIItem dropItem, Point endPosition)
 {
     Location = startPosition;
     MouseButtonDown(mouseButton);
     var dragStepFraction = (float)(1.0 / CoreAppXmlConfiguration.Instance.DragStepCount);
     for (int i = 1; i <= CoreAppXmlConfiguration.Instance.DragStepCount; i++)
     {
         var newX = startPosition.X + (endPosition.X - startPosition.X) * (dragStepFraction * i);
         var newY = startPosition.Y + (endPosition.Y - startPosition.Y) * (dragStepFraction * i);
         var newPoint = new Point((int)newX, (int)newY);
         Location = newPoint;
     }
     MouseButtonUp(mouseButton);
     dropItem.ActionPerformed(Action.WindowMessage);
 }