Esempio n. 1
0
        private void ImportPeakBoundaries(string fileName, long lineCount, string description)
        {
            var docCurrent = DocumentUI;
            SrmDocument docNew = null;
            using (var longWaitDlg = new LongWaitDlg(this) { Text = description })
            {
                var peakBoundaryImporter = new PeakBoundaryImporter(docCurrent);
                longWaitDlg.PerformWork(this, 1000, longWaitBroker =>
                           docNew = peakBoundaryImporter.Import(fileName, longWaitBroker, lineCount));

                if (docNew == null)
                    return;
                if (!peakBoundaryImporter.UnrecognizedPeptidesCancel(this))
                    return;
                if (longWaitDlg.IsDocumentChanged(docCurrent))
                {
                    MessageDlg.Show(this, Resources.SkylineWindow_ImportPeakBoundaries_Unexpected_document_change_during_operation);
                    return;
                }
            }

            ModifyDocument(description, doc =>
            {
                if (!ReferenceEquals(doc, docCurrent))
                    throw new InvalidDataException(Resources.SkylineWindow_ImportPeakBoundaries_Unexpected_document_change_during_operation);
                return docNew;
            });
        }