예제 #1
0
        /// <summary>
        /// 如果 isAbsolute  != true,  在相对坐标(x, y)上点击一次
        /// 否则 在绝对坐标(x, y)上点击一次
        /// </summary>
        /// <param name="p12"></param>
        /// <param name="isAbsolute"></param>
        public void ClickBtnOnceAtPoint(CoordPoint p12, string memo = "", bool isAbsolute = false, int delayMills = 0, int clickCount = 1)
        {
            if (delayMills > 0)
            {
                KK.Sleep(delayMills);
            }

            long       t1 = KK.CurrentMills();
            CoordPoint po = p12;

            if (!isAbsolute)
            {
                po = Datum.AddDelta(p12.x, p12.y);
            }

            int ret = robot.MoveTo(po.x, po.y);

            robot.LeftClick();
            if (clickCount > 1)
            {
                robot.LeftClick();
            }

            logger.InfoFormat("点击按钮#{0} @ {1} with count#{2}, elapsed {3}.", memo, po.ToString(), clickCount, KK.CurrentMills() - t1);
        }
예제 #2
0
        public void ClickButtonByFenceWayRToL(CoordPoint pot)
        {
            long t1 = KK.CurrentMills();

            // 按钮的位置 可能 会变化, 这里使用 栅栏模式多次点击
            foreach (var p in fenceEndPointsReverse)
            {
                robot.MoveTo(p.x, p.y);
                robot.LeftClick();
            }

            logger.InfoFormat("栅栏模式(从左到右) 点击 - 按钮 - {0}, elpased {1}.", pot.ToString(), KK.CurrentMills() - t1);
        }
예제 #3
0
        public void ClickButtonAtPoint(CoordPoint p13, bool needMoreOnceClick, string memo)
        {
            long t1 = KK.CurrentMills();

            robot.MoveTo(p13.x, p13.y);
            robot.LeftClick();
            if (needMoreOnceClick)
            {
                robot.LeftClick();
            }

            logger.InfoFormat("{0}#点击按钮 @ {1} with more#{2}, elapsed {3}.", memo, p13.ToString(), needMoreOnceClick, KK.CurrentMills() - t1);
        }
예제 #4
0
        public void InputTextAtPoint(CoordPoint p13, string text, bool needClearFirst, string memo)
        {
            long t1 = KK.CurrentMills();

            robot.MoveTo(p13.x, p13.y);
            robot.LeftClick();

            // 先清空已输入的验证码
            if (needClearFirst)
            {
                for (int i = 0; i < text.Length; i++)
                {
                    robot.PressBackspacKey();
                    robot.PressDeleteKey();
                }
            }

            robot.KeyPressString(text);
            logger.InfoFormat("{0}#输入: {1} @ {2}, Elapsed {3}.", memo, text, p13.ToString(), KK.CurrentMills() - t1);
        }