コード例 #1
0
        private static Process CreateProcess(LaunchProgramActionSettings settings, SessionRecording recording)
        {
            var process = new Process();

            string path      = Path.Combine(settings.Path);
            string directory = settings.WorkingDirectoryPath ?? Path.GetDirectoryName(settings.Path);

            string arguments = settings.Arguments ?? String.Empty;

            if (settings.ArgumentsParameters != null && settings.ArgumentsParameters.Any())
            {
                arguments = SessionRecordingSettingsHelper.FillParameters(arguments, settings.ArgumentsParameters, recording.Settings);
            }

            process.StartInfo = new ProcessStartInfo(settings.Path, arguments)
            {
                WorkingDirectory       = directory,
                UseShellExecute        = true,
                RedirectStandardError  = false,
                RedirectStandardOutput = false
            };

            if (settings.RunInBackground)
            {
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
            }
            else
            {
                process.StartInfo.CreateNoWindow = false;
                process.StartInfo.WindowStyle    = ProcessWindowStyle.Maximized;
            }

            return(process);
        }
コード例 #2
0
 public override void Execute(SessionRecordingViewModel recording)
 {
     if (_settings.Parameters != null && _settings.Parameters.Any())
     {
         Instructions = SessionRecordingSettingsHelper.FillParameters(Instructions, _settings.Parameters, recording.Recording.Settings);
         Title        = SessionRecordingSettingsHelper.FillParameters(Title, _settings.Parameters, recording.Recording.Settings);
     }
 }