示例#1
0
 public static void SetText(this Ranorex.Unknown container, string text)
 {
     if (Functions.GoodData(text))
     {
         container.PressKeys(text);
     }
 }
示例#2
0
 public static void MoveDown(this Ranorex.Unknown container, int moveNum)
 {
     for (int i = 0; i < moveNum; i++)
     {
         container.PressKeys("{Down}");
     }
 }
示例#3
0
 public static void MoveLeft(this Ranorex.Unknown container, int moveNum)
 {
     for (int i = 0; i < moveNum; i++)
     {
         container.PressKeys("{Shift down}{Tab}{Shift up}");
     }
 }
示例#4
0
        public static void MoveToField(this Ranorex.Unknown container, int rowNum, int colNum)
        {
            container.SetToLine(rowNum);

            for (int i = 0; i < colNum; i++)
            {
                container.PressKeys("{Tab}");
            }
        }
示例#5
0
        public static void SetToLine(this Ranorex.Unknown container, int rowNumber)
        {
            container.ClickFirstCell();

            for (int i = 0; i < rowNumber; i++)
            {
                container.PressKeys("{Down}");
            }
        }
        public override RanorexStepExecutionResponse Execute(Dictionary <string, object> arguments)
        {
            RanorexStepExecutionResponse stepResponse = new RanorexStepExecutionResponse();

            try
            {
                RepoItemInfo repoItemInfo = null;

                string target        = (string)arguments.GetValueOrDefault <string, object>("target");
                string sequence      = (string)arguments.GetValueOrDefault <string, object>("keySequence");
                int    duration      = Convert.ToInt32(arguments.GetValueOrDefault <string, object>("duration"));
                int    delay         = Convert.ToInt32(arguments.GetValueOrDefault <string, object>("delay"));
                int    timeout       = Convert.ToInt32(arguments.GetValueOrDefault <string, object>("timeout"));
                bool   retrieveImage = (bool)arguments.GetValueOrDefault <string, object>("retrieveImage");

                if (timeout == default(int))
                {
                    timeout = 10000;
                }

                if (duration == default(int))
                {
                    duration = 0;
                }

                if (target != default(string))
                {
                    repoItemInfo = CreateItemInfo(repo, target, timeout);
                    Ranorex.Unknown adapter = CreateAdapter(repoItemInfo);
                    Report.Log(ReportLevel.Info, "Keyboard", "Key '" + sequence + "' Press with focus on UI Element.", repoItemInfo, new RecordItemIndex(Agent.EXECUTION_INDEX));

                    adapter.PressKeys(sequence, duration);
                    if (retrieveImage)
                    {
                        stepResponse.image64 = GetImage64(adapter);
                    }
                }
                else
                {
                    Report.Log(ReportLevel.Info, "Keyboard", "Key '" + sequence + "' Press.", new RecordItemIndex(Agent.EXECUTION_INDEX));
                    Keyboard.Press(sequence, duration);
                }

                Delay.Milliseconds(200);

                stepResponse.success = true;
            }
            catch (Exception e)
            {
                stepResponse.message = "Ranorex Exception: " + e.Message;
                stepResponse.success = false;
            }
            return(stepResponse);
        }
示例#7
0
 public static void MoveDown(this Ranorex.Unknown container)
 {
     container.PressKeys("{Down}");
 }
示例#8
0
 public static void MoveLeft(this Ranorex.Unknown container)
 {
     container.PressKeys("{Shift down}{Tab}{Shift up}");
 }
示例#9
0
 public static void MoveRight(this Ranorex.Unknown container)
 {
     container.PressKeys("{Tab}");
 }
示例#10
0
 public static void Toggle(this Ranorex.Unknown container)
 {
     container.PressKeys("{Space}");
 }