Exemple #1
0
        public void GetPosition(List <string> words)
        {
            var    pos          = InputControl.CursorPosition();
            double screenWidth  = System.Windows.SystemParameters.PrimaryScreenWidth;
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
            var    x            = pos[0] / screenWidth;
            var    y            = pos[1] / screenHeight;

            System.Console.WriteLine(x.ToString() + ", " + y.ToString());
        }
        public void MoveDirection(List <string> words)
        {
            string moveAmount = ""; double moveAmountDouble;

            for (var i = 1; i < words.Count; i++)
            {
                string word = words[i] == "point" ? "." : words[i];
                moveAmount += word;
            }
            bool result = Double.TryParse(moveAmount, out moveAmountDouble);

            if (!result)
            {
                return;
            }
            int moveAmountInt = (int)Math.Ceiling(moveAmountDouble * 200);

            int[] currentPos = InputControl.CursorPosition();
            switch (words[0])
            {
            case "up":
                InputControl.SetCursorPosition(currentPos[0], currentPos[1] - moveAmountInt);
                break;

            case "right":
                InputControl.SetCursorPosition(currentPos[0] + moveAmountInt, currentPos[1]);
                break;

            case "down":
                InputControl.SetCursorPosition(currentPos[0], currentPos[1] + moveAmountInt);
                break;

            case "left":
                InputControl.SetCursorPosition(currentPos[0] - moveAmountInt, currentPos[1]);
                break;
            }
        }
        public void GetPosition(List <string> words)
        {
            var pos = InputControl.CursorPosition();

            System.Console.WriteLine(pos[0].ToString() + ", " + pos[1].ToString());
        }