示例#1
0
        private void _cacheController_OnCacheLoadingStarted()
        {
            string message = string.Format("Reading {0} cache...", _cacheController.RomType.GetUserFriendlyName());

            InformationTextBox.AppendTextWithNewLine(message);
            progressInformationLabel.Text = message;
        }
示例#2
0
        private void UpdateFilesToRearchve()
        {
            int    filesToRearchiveCount = _cacheController.DatCacheEntities.Count(x => x.IsAltered || !x.IsArchived);
            int    total   = _cacheController.DatCacheEntities.Count();
            string message = string.Format("{0}/{1} files need rearchiving.", filesToRearchiveCount, total);

            InformationTextBox.AppendTextWithNewLine(message);
        }
示例#3
0
 private void ShowOutputButton_Click(object sender, RoutedEventArgs e)
 {
     ShowStdOut = true;
     lock (InformationTextBox)
     {
         InformationTextBox.Document.Blocks.Clear();
         InformationTextBox.AppendText(DockerStdOut);
     }
 }
示例#4
0
 private void ArchiveController_OnExceptionOccured(string errorMessage)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <string>(ArchiveController_OnExceptionOccured), new object[] { errorMessage });
         return;
     }
     InformationTextBox.AppendTextWithNewLine(errorMessage);
 }
示例#5
0
 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;
 }
示例#6
0
        private void _cacheController_OnCacheLoadingAborted()
        {
            string message = string.Format("{0} Cache loading aborted.", _cacheController.RomType.GetUserFriendlyName());

            InformationTextBox.AppendTextWithNewLine(message);
            progressInformationLabel.Text = message;
            progressProgressBar.Value     = 0;

            UpdateLoadCacheButton();
            UpdateFilesToRearchve();
        }
示例#7
0
        private void ArchiveController_OnRearchiveStarted(DatCacheEntity datCacheEntity)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <DatCacheEntity>(ArchiveController_OnRearchiveStarted), new object[] { datCacheEntity });
                return;
            }

            string message = string.Format("Re-Archiving: '{0}'", datCacheEntity.FilenameInArchive);

            InformationTextBox.AppendTextWithNewLine(message);
        }
示例#8
0
        private void ArchiveController_OnRearchiveOverallAborted()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(ArchiveController_OnRearchiveOverallAborted));
                return;
            }
            string message = string.Format("Re-Archiving: aborted.");

            InformationTextBox.AppendTextWithNewLine(message);
            ClearRearchivingProgress();
            UpdateRearchiveButton();

            _cacheController.WriteCache();
        }
示例#9
0
        private void ArchiveController_OnRearchiveOverallStarted(int filesToRearchive)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <int>(ArchiveController_OnRearchiveOverallStarted), new object[] { filesToRearchive });
                return;
            }

            string message = "Rearchive started.";

            InformationTextBox.AppendTextWithNewLine(message);
            InformationTextBox.AppendTextWithNewLine(string.Format("{0} files to re-archive.", filesToRearchive));

            progressProgressBar.Value     = 0;
            progressInformationLabel.Text = message;
        }
示例#10
0
        private void ArchiveController_OnRearchiveOverallCompleted()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(ArchiveController_OnRearchiveOverallCompleted));
                return;
            }
            string message = string.Format("Re-Archiving: done.");

            InformationTextBox.AppendTextWithNewLine(message);
            progressInformationLabel.Text = message;
            progressProgressBar.Value     = 100;
            ClearRearchivingProgress();
            UpdateRearchiveButton();

            _cacheController.WriteCache();
        }
示例#11
0
        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();
            });
        }
示例#12
0
        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
            }
        }
示例#13
0
 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);
             }
         }
     });
 }
示例#14
0
 private void WarningsTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     InformationTextBox.ScrollToEnd();
 }