예제 #1
0
 public void Run(KeyCommandContext context)
 {
     foreach (IKeyCommand command in SubCommands)
     {
         var runableCommand = command as IRunableKeyCommand;
         if (runableCommand != null)
         {
             runableCommand.Run(context);
         }
     }
 }
예제 #2
0
        public void Run(KeyCommandContext context)
        {
            var messageParams = string.Empty;

            string[] parametersArray = Parameters != null?Parameters.Split(new[] { ';' }) : null;

            if (parametersArray != null)
            {
                var sb = new StringBuilder();
                foreach (var param in parametersArray)
                {
                    sb.Append(", ");
                    sb.Append(param);
                }

                messageParams = sb.ToString();
                if (messageParams.Length > 1)
                {
                    messageParams = messageParams.Substring(2);
                }
            }

            var wText = new StringBuilder();

            if (context != null && context.ActiveWindow != null)
            {
                User32.GetWindowText(context.ActiveWindow, wText, 255);

                MessageBox.Show(Description + Environment.NewLine +
                                Resources.TestCommand_Run_ActiveWindow__ + wText + Environment.NewLine +
                                Resources.TestCommand_Run_Parameters_ + messageParams, Resources.TestCommand_Run_Test);
            }
            else
            {
                MessageBox.Show(Description + Environment.NewLine +
                                Resources.TestCommand_Run_ActiveWindow__ + Resources.TestCommand_Run__No_Active_Window_ + Environment.NewLine +
                                Resources.TestCommand_Run_Parameters_ + messageParams, Resources.TestCommand_Run_Test);
            }
        }
예제 #3
0
        public void Run(KeyCommandContext context)
        {
            string paraemters;
            string shellCommand = GetShellCommand(out paraemters);

            if (!string.IsNullOrWhiteSpace(shellCommand))
            {
                Process p = Process.Start(shellCommand, paraemters);
                if (p != null)
                {
                    try
                    {
                        p.WaitForInputIdle();
                    }
                    catch (InvalidOperationException)
                    {
                        LogManager.Logger(GetType()).Debug("Can't wait for Idle, process does not have UI.");
                    }
                    p.WaitForExit();
                }
            }
        }