private bool UpdateModificationSettings() { var newSettings = MatchModificationsControl.AddCheckedModifications(Document); if (ReferenceEquals(Document.Settings, newSettings)) { return(true); } ModifyDocumentNoUndo(doc => doc.ChangeSettings(newSettings)); Document.Settings.UpdateDefaultModifications(false); _modificationSettingsChanged = true; return(true); }
private bool UpdateModificationSettings() { var newSettings = MatchModificationsControl.AddCheckedModifications(SkylineWindow.Document); if (ReferenceEquals(SkylineWindow.Document.Settings, newSettings)) { return(true); } if (SkylineWindow.ChangeSettings(newSettings, true, Resources.MatchModificationsControl_AddCheckedModifications_Add_checked_modifications)) { SkylineWindow.Document.Settings.UpdateDefaultModifications(false); _modificationSettingsChanged = true; } return(true); }
private void NextPage() { switch (CurrentPage) { case Pages.spectra_page: { var eCancel = new CancelEventArgs(); if (!BuildPepSearchLibControl.BuildPeptideSearchLibrary(eCancel)) { // Page shows error if (eCancel.Cancel) { return; } CloseWizard(DialogResult.Cancel); } // The user had the option to finish right after // building the peptide search library, but they // did not, so hide the "early finish" button for // the rest of the wizard pages. ShowEarlyFinish(false); if (FastaOptional) { lblFasta.Text = Resources.ImportPeptideSearchDlg_NextPage_Import_FASTA__optional_; } // The next page is going to be the chromatograms page. var oldImportResultsControl = (ImportResultsControl)ImportResultsControl; if (WorkflowType != Workflow.dia) { oldImportResultsControl.InitializeChromatogramsPage(SkylineWindow.DocumentUI); if (WorkflowType == Workflow.dda) { _pagesToSkip.Add(Pages.transition_settings_page); } } else { // DIA workflow, replace old ImportResultsControl ImportResultsControl = new ImportResultsDIAControl(SkylineWindow) { Anchor = oldImportResultsControl.Anchor, Location = oldImportResultsControl.Location }; getChromatogramsPage.Controls.Remove(oldImportResultsControl); getChromatogramsPage.Controls.Add((Control)ImportResultsControl); } ImportResultsControl.ResultsFilesChanged += ImportResultsControl_OnResultsFilesChanged; // Set up full scan settings page TransitionSettingsControl.Initialize(WorkflowType); FullScanSettingsControl.ModifyOptionsForImportPeptideSearchWizard(WorkflowType); if (!MatchModificationsControl.Initialize(SkylineWindow.Document)) { _pagesToSkip.Add(Pages.match_modifications_page); } if (BuildPepSearchLibControl.FilterForDocumentPeptides) { _pagesToSkip.Add(Pages.import_fasta_page); } } break; case Pages.chromatograms_page: { if (!ImportPeptideSearch.VerifyRetentionTimes(ImportResultsControl.FoundResultsFiles.Select(f => f.Path))) { MessageDlg.Show(this, TextUtil.LineSeparate(Resources.ImportPeptideSearchDlg_NextPage_The_document_specific_spectral_library_does_not_have_valid_retention_times_, Resources.ImportPeptideSearchDlg_NextPage_Please_check_your_peptide_search_pipeline_or_contact_Skyline_support_to_ensure_retention_times_appear_in_your_spectral_libraries_)); CloseWizard(DialogResult.Cancel); } if (ImportResultsControl.ResultsFilesMissing) { if (MessageBox.Show(this, Resources.ImportPeptideSearchDlg_NextPage_Some_results_files_are_still_missing__Are_you_sure_you_want_to_continue_, Program.Name, MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } } if (ImportResultsControl.FoundResultsFiles.Count > 1) { string prefix = ImportResultsDlg.GetCommonPrefix(ImportResultsControl.FoundResultsFiles.Select(f => f.Name)); if (prefix.Length >= ImportResultsDlg.MIN_COMMON_PREFIX_LENGTH) { using (var dlgName = new ImportResultsNameDlg(prefix)) { var result = dlgName.ShowDialog(this); if (result == DialogResult.Cancel) { return; } else if (result == DialogResult.Yes) { // Rename all the replicates to remove the specified prefix. ImportResultsControl.FoundResultsFiles = ImportResultsControl.FoundResultsFiles.Select(f => new ImportPeptideSearch.FoundResultsFile(f.Name.Substring(dlgName.Prefix.Length), f.Path)).ToList(); } } } } } break; case Pages.match_modifications_page: { var newSettings = MatchModificationsControl.AddCheckedModifications(SkylineWindow.Document); if (!ReferenceEquals(SkylineWindow.Document.Settings, newSettings)) { SkylineWindow.ChangeSettings(newSettings, true, Resources.MatchModificationsControl_AddCheckedModifications_Add_checked_modifications); SkylineWindow.Document.Settings.UpdateDefaultModifications(false); } // The next page is going to be the MS1 Full-Scan Settings // page, so initialize it. // FullScanSettingsControl.InitializeMs1FullScanSettingsPage(); } break; case Pages.transition_settings_page: // Try to accept changes to transition settings if (!UpdateTransitionSettings()) { return; } break; case Pages.full_scan_settings_page: // Try to accept changes to MS1 full-scan settings if (!UpdateFullScanSettings()) { // We can't allow the user to progress any further until // we can verify that the MS1 full scan settings are valid. return; } break; case Pages.import_fasta_page: // This is the last page if ((FastaOptional && !ImportFastaControl.ContainsFastaContent) || ImportFastaControl.ImportFasta()) { WizardFinish(); } return; } Pages newPage = CurrentPage + 1; while (_pagesToSkip.Contains(newPage)) { ++newPage; } // Skip import FASTA if user filters for document peptides if (newPage > Pages.import_fasta_page) { WizardFinish(); return; } CurrentPage = newPage; if (CurrentPage == LastPage) { btnNext.Text = Resources.ImportPeptideSearchDlg_NextPage_Finish; } }