private void ShowOutputButton_Click(object sender, RoutedEventArgs e) { ShowStdOut = true; lock (InformationTextBox) { InformationTextBox.Document.Blocks.Clear(); InformationTextBox.AppendText(DockerStdOut); } }
private void DisplayAnyErrors(Task obj) { Dispatcher.Invoke(() => InformationTextBox.AppendText("Done!" + Environment.NewLine)); if (StaticTasksObservableCollection.Count > 0) { Dispatcher.Invoke(() => MessageBox.Show("Finished! Workflow summary is located in " + StaticTasksObservableCollection.First().options.AnalysisDirectory, "Spritz Workflow", MessageBoxButton.OK, MessageBoxImage.Information)); } IsRunning = false; }
private void ShowTopButton_Click(object sender, RoutedEventArgs e) { ShowStdOut = false; Dispatcher.Invoke(() => { InformationTextBox.Document.Blocks.Clear(); Process proc = new Process(); proc.StartInfo.FileName = "Powershell.exe"; proc.StartInfo.Arguments = Everything.GenerateTopComand(); proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.CreateNoWindow = true; proc.Start(); StreamReader outputReader = proc.StandardOutput; InformationTextBox.AppendText(outputReader.ReadToEnd()); proc.WaitForExit(); }); }
private void RunWorkflowButton_Click(object sender, RoutedEventArgs e) { try { if (StaticTasksObservableCollection.Count == 0) { MessageBox.Show("You must add a workflow before a run.", "Run Workflows", MessageBoxButton.OK, MessageBoxImage.Information); return; } else if (RnaSeqFastqCollection.Any() && GetPathToFastqs().CompareTo(OutputFolderTextBox.Text) != 0) // to be edited { MessageBox.Show("FASTQ files do not exist in the user-defined analysis directory.", "Run Workflows", MessageBoxButton.OK, MessageBoxImage.Information); return; } DynamicTasksObservableCollection = new ObservableCollection <InRunTask>(); DynamicTasksObservableCollection.Add(new InRunTask("Workflow 1", StaticTasksObservableCollection.First().options)); WorkflowTreeView.DataContext = DynamicTasksObservableCollection; Everything = new EverythingRunnerEngine(DynamicTasksObservableCollection.Select(b => new Tuple <string, Options>(b.DisplayName, b.options)).First(), OutputFolderTextBox.Text); InformationTextBox.Document.Blocks.Clear(); InformationTextBox.AppendText($"Command executing: Powershell.exe {Everything.GenerateCommandsDry(DockerImage)}\n\n"); // keep for debugging InformationTextBox.AppendText($"Saving output to {Everything.PathToWorkflow}. Please monitor it there...\n\n"); IsRunning = true; Everything.WriteConfig(StaticTasksObservableCollection.First().options); var t = new Task(RunEverythingRunner); t.Start(); t.ContinueWith(DisplayAnyErrors); // update gui RunWorkflowButton.IsEnabled = false; ClearTasksButton.IsEnabled = true; BtnWorkFlow.IsEnabled = false; ResetTasksButton.IsEnabled = true; } catch (TaskCanceledException) { // Ignore error } }
private void OutputHandler(object source, DataReceivedEventArgs e) { Dispatcher.Invoke(() => { if (!string.IsNullOrEmpty(e.Data)) { string output = outputScrub.Replace(e.Data, ""); DockerStdOut += output + Environment.NewLine; if (ShowStdOut) { lock (InformationTextBox) InformationTextBox.AppendText(output + Environment.NewLine); } using (StreamWriter sw = File.Exists(Everything.PathToWorkflow) ? File.AppendText(Everything.PathToWorkflow) : File.CreateText(Everything.PathToWorkflow)) { sw.WriteLine(output); } } }); }