public void ShowRenameProteinsDlg() { using (RenameProteinsDlg dlg = new RenameProteinsDlg(DocumentUI)) { if (dlg.ShowDialog(SkylineWindow) == DialogResult.OK) { ModifyDocument(Resources.SkylineWindow_ShowRenameProteinsDlg_Rename_proteins, doc => RenameProtein(doc, dlg), dlg.FormSettings.EntryCreator.Create); } } }
private SrmDocument RenameProtein(SrmDocument doc, RenameProteinsDlg dlg) { foreach (var name in dlg.DictNameToName.Keys) { PeptideGroupDocNode node = Document.MoleculeGroups.FirstOrDefault(peptideGroup => Equals(name, peptideGroup.Name)); if (node != null) { var renameProtein = new RenameProteinsDlg.RenameProteins { CurrentName = name, NewName = dlg.DictNameToName[name] }; if (renameProtein.CurrentName != renameProtein.NewName) { doc = (SrmDocument)doc.ReplaceChild(node.ChangeName(renameProtein.NewName)); } } } return(doc); }