private void xRequestRadioButton_Checked(object sender, RoutedEventArgs e)
 {
     if (mRemoterequest == null)
     {
         mRemoterequest = new RemoteExecutionRequestConfig();
     }
     if (mAutoRunWizard != null)
     {
         mAutoRunWizard.AutoRunConfiguration.SelectedCLI          = mRemoterequest;
         mAutoRunWizard.AutoRunConfiguration.AutoRunEexecutorType = eAutoRunEexecutorType.Remote;
         ShowHelp();
         ResetCLIContent(mAutoRunWizard.ResetCLIContent = true);
         ShowContent();
     }
     xConfigFileSettingsPnl.Visibility = Visibility.Collapsed;
     xCLIContentTextBox.AddValidationRule(new ValidateJsonFormat());
 }
Exemple #2
0
        private string ExecuteCommand(string userMsg)
        {
            try
            {
                var count        = 1;
                var successCount = 0;
                var failCount    = 0;
                if (AutoRunConfiguration.AutoRunEexecutorType == eAutoRunEexecutorType.Remote)
                {
                    Reporter.ToStatus(eStatusMsgKey.StaticStatusMessage, null, "Sending the execution requests is in progress...");
                }
                else
                {
                    Reporter.ToStatus(eStatusMsgKey.StaticStatusProcess, null, "Starting execution process is in progress...");
                }
                while (count <= AutoRunConfiguration.ParallelExecutionCount)
                {
                    try
                    {
                        if (AutoRunConfiguration.AutoRunEexecutorType == eAutoRunEexecutorType.Remote)
                        {
                            var responseString = new RemoteExecutionRequestConfig().ExecuteFromRunsetShortCutWizard(AutoRunConfiguration.ExecutionServiceUrl, AutoRunConfiguration.CLIContent);

                            if (responseString == "Created")
                            {
                                successCount++;
                            }
                            else
                            {
                                failCount++;
                                userMsg += "Failed to start remote execution, error: " + responseString + Environment.NewLine;
                            }
                        }
                        else
                        {
                            var args = AutoRunConfiguration.CLIContent;

                            if (AutoRunConfiguration.AutoRunEexecutorType == eAutoRunEexecutorType.DynamicFile)
                            {
                                args = "dynamic --filename " + AutoRunConfiguration.ConfigFileFullPath;
                            }
                            System.Diagnostics.Process.Start(AutoRunShortcut.ExecuterFullPath, args);
                            successCount++;
                        }
                    }
                    catch (Exception ex)
                    {
                        userMsg += "Execution process failed to start, error: " + ex.Message + Environment.NewLine;
                        Reporter.ToLog(eLogLevel.ERROR, "Execution process starting failed.", ex);
                        failCount++;
                    }

                    count++;
                }
                if (failCount == 0 && successCount > 0)
                {
                    userMsg += "Total " + successCount + " process/es started successfully." + Environment.NewLine;
                }
                else if (failCount > 0)
                {
                    userMsg += "Total " + successCount + " process/es started successfully." + Environment.NewLine + "Total " + failCount + " process failed to start." + Environment.NewLine;
                }

                return(userMsg);
            }
            finally
            {
                Reporter.HideStatusMessage();
            }
        }