private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            //TODO: check e.key and do keyevent for delete backspace etc..., or send text for simple char
            // Create amp and handle key event
            // meanwhile we send the text...
            if (!mSendKeyboardKeys)
            {
                return;
            }


            string AndroidKey = GetAndroidKey(e.Key);


            if (AndroidKey != null)
            {
                if (IsRecording)
                {
                    ActDeviceButton act = new ActDeviceButton();
                    act.Description = "Press Key '" + AndroidKey + "'";
                    act.Value       = AndroidKey;
                    mBusinessFlow.AddAct(act);
                }

                // TODO: check if we use UIAutomation PressKey with some keys maps if it is faster then shell command
                string result = mAndroidADBDriver.ExecuteShellCommand("input text " + AndroidKey);
            }
        }
Пример #2
0
        public ActDeviceButtonEditPage(ActDeviceButton act)
        {
            InitializeComponent();

            mAct = act;

            ButtonActionComboBox.BindControl(mAct, ActDeviceButton.Fields.DeviceButtonAction);
        }
        private void DeviceViewPage_OnButtonClick(object sender, DeviceViewPage.ButtonEventArgs e)
        {
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

            DeviceButton DB = e.DeviceButton;

            if (IsRecording)
            {
                ActDeviceButton act = new ActDeviceButton();
                act.Description = DB.SendCommand;
                act.Value       = DB.SendCommand;
                mAndroidADBDriver.BusinessFlow.AddAct(act);
            }


            if (DB.SendCommand.StartsWith("Press "))
            {
                string key = DB.SendCommand.Replace("Press ", "");
                mAndroidADBDriver.Press(key);
            }
            // Change to PressKeyCode
            else if (DB.SendCommand.StartsWith("PressKey "))
            {
                string key     = DB.SendCommand.Replace("PressKey ", "");
                int    KeyCode = int.Parse(key);
                mAndroidADBDriver.PressKeyCode(KeyCode);
            }
            else
            {
                //Remove from here and create special action
                // we assume it is shell command
                string result = mAndroidADBDriver.ExecuteShellCommand(DB.SendCommand);
            }

            Mouse.OverrideCursor = null;
        }