Ejemplo n.º 1
0
        public bool LaunchApplication(string appPath, string appTitle)
        {
            var desktop = this.GetDektopRoot();

            desktop.PressKeysCombination(Keys.Windows, 'r');

            IUiElementWrapper runner = null;
            int attempts             = 0;

            while (runner == null && attempts < 15)
            {
                runner = this.GetApplicationRoot("Run");
            }

            runner.SendKeys(appPath);
            runner.PressKey(Keys.Enter);

            IUiElementWrapper result = null;

            while (result == null && attempts < 15)
            {
                result = this.GetApplicationRoot(appTitle);
            }

            return(result != null);
        }
Ejemplo n.º 2
0
        public bool CloseApplication(string appTitle)
        {
            var desktop = this.GetDektopRoot();

            desktop.PressKeysCombination(Keys.Windows, 'r');

            IUiElementWrapper runner = null;
            int attempts             = 0;

            while (runner == null && attempts < this.settings.TryAttemptsFindOrClose)
            {
                runner = this.GetApplicationRoot("Run");
            }

            runner.SendKeys($"taskkill /IM notepad.exe /F");
            runner.PressKey(Keys.Enter);

            return(true);
        }