예제 #1
0
 protected void DoubleClickImplementation(PointerButtons button, double offsetX, double offsetY)
 {
     if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: "DoubleClick", button, (object)offsetX, (object)offsetY)) != ActionResult.Unhandled)
     {
         return;
     }
     MovePointer(offsetX: offsetX, offsetY: offsetY);
     PointerInput.Click(button: button, count: 2);
 }
예제 #2
0
        public override string ToString()
        {
            object overridden;

            if (ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: nameof(ToString)), overridden: out overridden) == ActionResult.Handled)
            {
                return((string)overridden);
            }
            return("{" + Name + ", " + ClassName + ", " + RuntimeId + "}");
        }
예제 #3
0
        public void SetFocus()
        {
            var num = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));

            if (ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: nameof(SetFocus))) != ActionResult.Unhandled || (bool)AutomationElement.GetCurrentPropertyValue(property: AutomationElement.HasKeyboardFocusProperty))
            {
                return;
            }
            AutomationElement.SetFocus();
        }
예제 #4
0
 public void SendKeys(string text)
 {
     Validate.StringNeitherNullNorEmpty(parameter: text, parameterName: nameof(text));
     SetFocus();
     if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(SendKeys), text)) != ActionResult.Unhandled)
     {
         return;
     }
     TextInput.SendText(text: text);
 }
예제 #5
0
        public void SaveImage(string fileName)
        {
            Validate.StringNeitherNullNorEmpty(parameter: fileName, parameterName: nameof(fileName));
            var num = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));

            if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(SaveImage), fileName)) != ActionResult.Unhandled)
            {
                return;
            }
            ScreenCapture.SaveImage(rectangle: BoundingRectangle, fileName: fileName);
        }
예제 #6
0
        public virtual void TapAndHold(double offsetX, double offsetY, uint duration)
        {
            var num1 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));
            var num2 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "MakeVisible"));

            if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(TapAndHold), offsetX, (object)offsetY, (object)duration)) != ActionResult.Unhandled)
            {
                return;
            }
            SinglePointGesture.Current.Move(point: ObjectPointToScreenPoint(objectPoint: new PointI(x: (int)Math.Round(a: offsetX), y: (int)Math.Round(a: offsetY))));
            SinglePointGesture.PressAndHold(holdDuration: duration);
        }
예제 #7
0
        public void ClickDrag(PointerButtons button, UIObject uiObject)
        {
            Validate.ArgumentNotNull(parameter: uiObject, parameterName: nameof(uiObject));
            var num1 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));
            var num2 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "MakeVisible"));

            if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(ClickDrag), button, (object)uiObject)) != ActionResult.Unhandled)
            {
                return;
            }
            PointerInput.ClickDrag(targetObject: this, destinationObject: uiObject, button: button);
        }
예제 #8
0
        public virtual void DoubleTap(double offsetX, double offsetY)
        {
            var num1 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));
            var num2 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "MakeVisible"));

            if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(DoubleTap), offsetX, (object)offsetY)) != ActionResult.Unhandled)
            {
                return;
            }
            using (InputController.Activate(inputType: PointerInputType.MultiTouch)) {
                PointerInput.DoubleClick(uiObject: this, button: PointerButtons.Primary, offsetX: offsetX, offsetY: offsetY);
            }
        }
예제 #9
0
        public virtual void Flick(PointI startPoint, PointI endPoint)
        {
            var num1 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));
            var num2 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "MakeVisible"));

            if (ActionHandler.Invoke(sender: this, actionInfo: new ActionEventArgs(action: nameof(Flick), startPoint, (object)endPoint)) == ActionResult.Unhandled)
            {
                var screenPoint1 = ObjectPointToScreenPoint(objectPoint: startPoint);
                var screenPoint2 = ObjectPointToScreenPoint(objectPoint: endPoint);
                SinglePointGesture.Current.Move(point: screenPoint1);
                var    defaultPressDuration = (int)InputManager.DefaultPressDuration;
                double flickAcceleration    = SinglePointGesture.DefaultFlickAcceleration;
                SinglePointGesture.Flick(endPoint: screenPoint2, holdDuration: (uint)defaultPressDuration, acceleration: (float)flickAcceleration);
            }

            var num3 = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "UIScrollComplete"));
        }
예제 #10
0
        public PointI GetClickablePoint()
        {
            var    num = (int)ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: "WaitForReady"));
            object overridden;

            if (ActionHandler.Invoke(sender: this, actionInfo: ActionEventArgs.GetDefault(action: nameof(GetClickablePoint)), overridden: out overridden) == ActionResult.Handled)
            {
                return((PointI)overridden);
            }
            Point pt;

            if (AutomationElement.TryGetClickablePoint(pt: out pt))
            {
                return(new PointI(x: (int)pt.X, y: (int)pt.Y));
            }
            var boundingRectangle = BoundingRectangle;

            return(new PointI(x: boundingRectangle.X + boundingRectangle.Width / 2, y: boundingRectangle.Y + boundingRectangle.Height / 2));
        }
예제 #11
0
        public static UIObject FromPoint(PointI pixelLocation)
        {
            object overridden;

            return(ActionHandler.Invoke(sender: null, actionInfo: new ActionEventArgs(action: nameof(FromPoint), (object)pixelLocation), overridden: out overridden) == ActionResult.Handled ? (UIObject)overridden : new UIObject(element: AutomationElement.FromPoint(pt: new Point(x: pixelLocation.X, y: pixelLocation.Y))));
        }
예제 #12
0
        public static UIObject FromHandle(IntPtr hwnd)
        {
            object overridden;

            return(ActionHandler.Invoke(sender: null, actionInfo: new ActionEventArgs(action: nameof(FromHandle), (object)hwnd), overridden: out overridden) == ActionResult.Handled ? (UIObject)overridden : new UIObject(element: AutomationElement.FromHandle(hwnd: hwnd)));
        }