Example #1
0
        private void Retry(ChromatogramLoadingStatus status)
        {
            ChromatogramManager.RemoveFile(status.FilePath);
            if (!_partialProgressList.Contains(status.FilePath))
            {
                _partialProgressList.Add(status.FilePath);
            }
            graphChromatograms.ClearGraph(status.FilePath);
            for (int i = 0; i < flowFileStatus.Controls.Count; i++)
            {
                var control = (FileProgressControl)flowFileStatus.Controls[i];
                if (control.FilePath.Equals(status.FilePath))
                {
                    control.Reset();
                    Selected = i;
                    break;
                }
            }

            // Add this file back into the chromatogram set for each of its replicates.
            ModifyDocument(Resources.AllChromatogramsGraph_Retry_Retry_import_results, monitor =>
            {
                Program.MainWindow.ModifyDocumentNoUndo(doc =>
                {
                    var oldResults = doc.Settings.MeasuredResults ??
                                     new MeasuredResults(new ChromatogramSet[0]);
                    var newResults = oldResults.AddDataFile(status.FilePath, status.ReplicateNames);
                    return(doc.ChangeMeasuredResults(newResults, monitor));
                });
            });
        }
Example #2
0
        private void ElapsedTimer_Tick(object sender, EventArgs e)
        {
            // Update timer and overall progress bar.
            // ReSharper disable LocalizableElement
            lblDuration.Text = _stopwatch.Elapsed.ToString(@"hh\:mm\:ss");
            // ReSharper restore LocalizableElement

            // Determine if we should automatically retry any failed file.
            if (_retryTime <= DateTime.Now)
            {
                _retryTime = DateTime.MaxValue;
                _retryDlg  = new ImportResultsRetryCountdownDlg(RETRY_COUNTDOWN,
                                                                () =>
                {
                    for (int i = 0; i < flowFileStatus.Controls.Count; i++)
                    {
                        var control = (FileProgressControl)flowFileStatus.Controls[_nextRetry];
                        if (++_nextRetry == flowFileStatus.Controls.Count)
                        {
                            _nextRetry = 0;
                        }
                        if (control.Error != null)
                        {
                            ChromatogramManager.RemoveFile(control.FilePath);
                            Retry(control.Status);
                            break;
                        }
                    }
                    _retryDlg.Dispose();
                },
                                                                () =>
                {
                    _stopwatch.Stop();
                    elapsedTimer.Stop();
                    _retryDlg.Dispose();
                });
                _retryDlg.ShowDialog(this);
            }
        }