Пример #1
0
        public object Execute(IUIAutomationRunner action)
        {
            AutomationElement element = UIAutomationHelper.FindWindow(this, this.Timeout);

            //AssertionHelper.AssertWindowElementNotNull(context, element, this);
            if (base.WindowName != null)
            {
                //action.Runner.UIAutomation().AssertWindowStateByName(base.WindowName, WindowCurrentState.ReadyForInput, this.Timeout);
            }
            try
            {
                element.SetFocus();
            }
            catch (Exception exception)
            {
                // action.Logger.LogComment(string.Format("Could not set focus on window. {0}", exception.ToString()));
            }
            string keys = "";

            foreach (string str2 in this.Keys)
            {
                keys = keys + str2;
            }
            Thread.Sleep(200);
            if ((this.ContainsUnescapedKey(keys, '^') || this.ContainsUnescapedKey(keys, '%')) || this.ContainsUnescapedKey(keys, '+'))
            {
                keys = keys.ToLower();
            }
            System.Windows.Forms.SendKeys.SendWait(keys);
            Thread.Sleep(0x3e8);

            return(null);
        }