public async Task Run(IProgress<string> progressOutput, IProgress<string> progressError, IDeploymentAppSettings settings) { var processInfo = CreateProcessStartInfo(settings); await Task.Factory.StartNew(() => { try { using (var process = Process.Start(processInfo)) { if (process == null) return; using (var taskReadOutput = Task.Factory.StartNew(state => ReadFromStreamAsync(state, progressOutput), process.StandardOutput)) using (var taskReadError = Task.Factory.StartNew(state => ReadFromStreamAsync(state, progressError), process.StandardError)) { process.WaitForExit(); Task.WaitAll(new Task[] { taskReadOutput, taskReadError }, 10000); progressOutput.Report(Environment.NewLine + "Deployer exited : " + DeployerResolution(process.ExitCode)); if(string.IsNullOrWhiteSpace(LogExchange.LogFilePath)) progressOutput.Report("Check log for information."); else progressOutput.Report("Check log file at link:[" + LogExchange.LogFilePath + ']'); } } } catch (Exception ex) { progressError.Report("Error: " + ex.Message); } }); }
public ViewModel(IDeploymentAppSettings appSettings, IWindowWrapper windowWrapper) { _windowWrapper = windowWrapper; IsBusy = false; ProjectFolder = appSettings.ProjectFolder; LogFolder = appSettings.LogFolder; SqlServer = appSettings.SqlServer; NoTransaction = appSettings.NoTransaction; ForceRollback = appSettings.ForceRollback; CheckFilesOnly = appSettings.CheckFilesOnly; BypassCheck = appSettings.BypassCheck; _serversList = new List<ComboBoxItem> { new ComboBoxItem { Content = "localhost" }, new ComboBoxItem { Content = "searching for servers...", IsEnabled = false} }; _projectFolderCommand = new DelegateCommand<string>(s => { string selectedPath; if (_windowWrapper.ShowFolderDialog("Select Project Folder", s, out selectedPath)) ProjectFolder = selectedPath; }, s => IsAvailable); _logFolderCommand = new DelegateCommand<string>(s => { string selectedPath; if (_windowWrapper.ShowFolderDialog("Select Log Folder", s, out selectedPath)) LogFolder = selectedPath; }, s => IsAvailable); }
private static ProcessStartInfo CreateProcessStartInfo(IDeploymentAppSettings settings) { var workingDir = Path.GetDirectoryName(settings.ApplicationPath) ?? AppDomain.CurrentDomain.BaseDirectory; return new ProcessStartInfo { WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, FileName = settings.ApplicationPath, WorkingDirectory = workingDir, Arguments = settings.ToString(), RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, ErrorDialog = false }; }
private static ProcessStartInfo CreateProcessStartInfo(IDeploymentAppSettings settings) { var workingDir = Path.GetDirectoryName(settings.ApplicationPath) ?? AppDomain.CurrentDomain.BaseDirectory; return(new ProcessStartInfo { WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, FileName = settings.ApplicationPath, WorkingDirectory = workingDir, Arguments = settings.ToString(), RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, ErrorDialog = false }); }
public ViewModel(IDeploymentAppSettings appSettings, IWindowWrapper windowWrapper) { _windowWrapper = windowWrapper; IsBusy = false; ProjectFolder = appSettings.ProjectFolder; LogFolder = appSettings.LogFolder; SqlServer = appSettings.SqlServer; NoTransaction = appSettings.NoTransaction; ForceRollback = appSettings.ForceRollback; CheckFilesOnly = appSettings.CheckFilesOnly; BypassCheck = appSettings.BypassCheck; _serversList = new List <ComboBoxItem> { new ComboBoxItem { Content = "localhost" }, new ComboBoxItem { Content = "searching for servers...", IsEnabled = false } }; _projectFolderCommand = new DelegateCommand <string>(s => { string selectedPath; if (_windowWrapper.ShowFolderDialog("Select Project Folder", s, out selectedPath)) { ProjectFolder = selectedPath; } }, s => IsAvailable); _logFolderCommand = new DelegateCommand <string>(s => { string selectedPath; if (_windowWrapper.ShowFolderDialog("Select Log Folder", s, out selectedPath)) { LogFolder = selectedPath; } }, s => IsAvailable); }
public async Task Run(IProgress <string> progressOutput, IProgress <string> progressError, IDeploymentAppSettings settings) { var processInfo = CreateProcessStartInfo(settings); await Task.Factory.StartNew(() => { try { using (var process = Process.Start(processInfo)) { if (process == null) { return; } using (var taskReadOutput = Task.Factory.StartNew(state => ReadFromStreamAsync(state, progressOutput), process.StandardOutput)) using (var taskReadError = Task.Factory.StartNew(state => ReadFromStreamAsync(state, progressError), process.StandardError)) { process.WaitForExit(); Task.WaitAll(new Task[] { taskReadOutput, taskReadError }, 10000); progressOutput.Report(Environment.NewLine + "Deployer exited : " + DeployerResolution(process.ExitCode)); if (string.IsNullOrWhiteSpace(LogExchange.LogFilePath)) { progressOutput.Report("Check log for information."); } else { progressOutput.Report("Check log file at link:[" + LogExchange.LogFilePath + ']'); } } } } catch (Exception ex) { progressError.Report("Error: " + ex.Message); } }); }