Exemple #1
0
        protected override void InternalExecute(ICommandAdapter adapter)
        {
            SendKeysCommand sendKeysCommand;

            if (Parameters.MainParameter != null)
            {
                var dblClickCommand = new DblClickCommand();
                dblClickCommand.Parameters.MainParameter = Parameters.MainParameter;
                dblClickCommand.Execute(adapter);
            }
            else
            {
                sendKeysCommand = new SendKeysCommand();
                sendKeysCommand.Parameters.Add(new Parameter("Keys", "F2", true, EndPosition));
                sendKeysCommand.Execute(adapter);
                Thread.Sleep(500);
                sendKeysCommand = new SendKeysCommand();
                sendKeysCommand.Parameters.Add(new Parameter("Modifiers", "Control", true, EndPosition));
                sendKeysCommand.Parameters.Add(new Parameter("Keys", "a", true, EndPosition));
                sendKeysCommand.Execute(adapter);
                Thread.Sleep(500);
            }
            sendKeysCommand = new SendKeysCommand();
            sendKeysCommand.Parameters.Add(new Parameter("Modifiers", "Control", true, EndPosition));
            sendKeysCommand.Parameters.Add(new Parameter("Keys", "c", true, EndPosition));
            sendKeysCommand.Execute(adapter);
        }
Exemple #2
0
        protected override void InternalExecute(ICommandAdapter adapter)
        {
            var sendKeysParameter = Parameters[SendKeys];

            if (sendKeysParameter != null && (adapter.IsWinAdapter()))
            {
                var sendKeysCommand = new SendKeysCommand().SynchWith(this);
                sendKeysCommand.Parameters.MainParameter = new MainParameter(Parameters.First().Value);
                sendKeysCommand.Execute(adapter);
            }
            else
            {
                var processRecordCommand = new FillFormCommand();
                processRecordCommand.SynchWith(this);
                if (sendKeysParameter != null)
                {
                    processRecordCommand.Parameters.Remove(sendKeysParameter);
                }
                try{
                    processRecordCommand.Execute(adapter);
                }
                catch (Exception) {
                    if (ExpectException)
                    {
                        throw;
                    }
                    if (this.ParameterValue("Throw", true))
                    {
                        throw;
                    }
                }
            }
        }
 protected override void InternalExecute(ICommandAdapter adapter){
     var sendKeysParameter = Parameters[SendKeys];
     if (sendKeysParameter != null && (adapter.IsWinAdapter())) {
         var sendKeysCommand = new SendKeysCommand().SynchWith(this);
         sendKeysCommand.Parameters.MainParameter = new MainParameter(Parameters.First().Value);
         sendKeysCommand.Execute(adapter);
     }
     else {
         var processRecordCommand = new FillFormCommand();
         processRecordCommand.SynchWith(this);
         if (sendKeysParameter != null)
             processRecordCommand.Parameters.Remove(sendKeysParameter);
         processRecordCommand.Execute(adapter);
     }
 }
        private void ExecuteAdditionalCommands(ICommandAdapter adapter)
        {
            _additionalCommands = this.ParameterValue("AdditionalCommands", true);
            if (!_additionalCommands)
            {
                return;
            }
            if (this.ParameterValue(ToggleNavigationCommand.Name, true))
            {
                var toggleNavigationCommand = new ToggleNavigationCommand();
                toggleNavigationCommand.Execute(adapter);
            }
            var activeWindowSize    = this.ParameterValue("ActiveWindowSize", _defaultWindowSize);
            var resizeWindowCommand = new ResizeWindowCommand();

            resizeWindowCommand.Parameters.MainParameter = new MainParameter(
                $"{activeWindowSize.Width}x{activeWindowSize.Height}");
            resizeWindowCommand.Execute(adapter);

            if (this.ParameterValue(HideCursorCommand.Name, true))
            {
                var hideCaretCommand = new HideCursorCommand();
                hideCaretCommand.Execute(adapter);
            }

            if (this.ParameterValue(KillFocusCommand.Name, true))
            {
                var helperAutomation = new HelperAutomation();
                Win32Declares.Message.SendMessage(helperAutomation.GetFocusControlHandle(), Win32Declares.Message.EM_SETSEL, -1, 0);
                var hideCaretCommand = new KillFocusCommand();
                hideCaretCommand.Execute(adapter);
            }

            var sendKeys = this.ParameterValue <string>("SendKeys");

            if (!string.IsNullOrEmpty(sendKeys))
            {
                var sendKeysCommand = new SendKeysCommand();
                sendKeysCommand.Parameters.MainParameter = new MainParameter(sendKeys);
                sendKeysCommand.Execute(adapter);
            }

            Wait(adapter, 1000);
        }
        protected override void InternalExecute(ICommandAdapter adapter)
        {
            var sendKeysParameter = Parameters[SendKeys];

            if (sendKeysParameter != null && (adapter.IsWinAdapter()))
            {
                var sendKeysCommand = new SendKeysCommand().SynchWith(this);
                sendKeysCommand.Parameters.MainParameter = new MainParameter(Parameters.First().Value);
                sendKeysCommand.Execute(adapter);
            }
            else
            {
                var processRecordCommand = new FillFormCommand();
                processRecordCommand.SynchWith(this);
                if (sendKeysParameter != null)
                {
                    processRecordCommand.Parameters.Remove(sendKeysParameter);
                }
                processRecordCommand.Execute(adapter);
            }
        }
 protected override void InternalExecute(ICommandAdapter adapter){
     var sendKeysParameter = Parameters[SendKeys];
     if (sendKeysParameter != null && (adapter.IsWinAdapter())) {
         var sendKeysCommand = new SendKeysCommand().SynchWith(this);
         sendKeysCommand.Parameters.MainParameter = new MainParameter(Parameters.First().Value);
         sendKeysCommand.Execute(adapter);
     }
     else {
         var processRecordCommand = new FillFormCommand();
         processRecordCommand.SynchWith(this);
         if (sendKeysParameter != null)
             processRecordCommand.Parameters.Remove(sendKeysParameter);
         try{
             processRecordCommand.Execute(adapter);
         }
         catch (Exception){
             if (ExpectException)
                 throw;
             if (this.ParameterValue("Throw", true))
                 throw;
         }
     }
 }
        private void ExecuteAdditionalCommands(ICommandAdapter adapter) {
            _additionalCommands = this.ParameterValue("AdditionalCommands", true);
            if (!_additionalCommands)
                return;
            if (this.ParameterValue("ToggleNavigation", true)) {
                ToggleNavigation(adapter);
            }

            var activeWindowSize = this.ParameterValue("ActiveWindowSize", _defaultWindowSize);
            var activeWindowSizeCommand = new ResizeWindowCommand();
            activeWindowSizeCommand.Parameters.MainParameter = new MainParameter(String.Format("{0}x{1}", activeWindowSize.Width, activeWindowSize.Height));
            activeWindowSizeCommand.Execute(adapter);

            if (this.ParameterValue(HideCursorCommand.Name, true)) {
                var hideCaretCommand = new HideCursorCommand();
                hideCaretCommand.Execute(adapter);
            }

            if (this.ParameterValue(KillFocusCommand.Name, true)) {
                var helperAutomation = new HelperAutomation();
                Win32Declares.Message.SendMessage(helperAutomation.GetFocusControlHandle(), Win32Declares.Message.EM_SETSEL, -1, 0);
                var hideCaretCommand = new KillFocusCommand();
                hideCaretCommand.Execute(adapter);
            }

            var sendKeys = this.ParameterValue<string>("SendKeys");
            if (!string.IsNullOrEmpty(sendKeys)) {
                var sendKeysCommand = new SendKeysCommand();
                sendKeysCommand.Parameters.MainParameter = new MainParameter(sendKeys);
                sendKeysCommand.Execute(adapter);
            }

            Wait(adapter, 1000);
        }