예제 #1
0
            }                                                                                                   // Used when working on an entire form or menu (can be set in ctor for test purposes)

            public static string Translate(string text, bool forceSmallMolecule)
            {
                if (!forceSmallMolecule)
                {
                    return(text);
                }

                return(SMALL_MOLECULE_MAPPER.TranslateString(text));
            }
            // For all controls in a form, attempt to take a string like "{0} peptides" and return one like "{0} molecules" if doctype is not purely proteomic
            public static void TranslateForm(Form form, SrmDocument.DOCUMENT_TYPE modeUI, ModeUIExtender extender = null)
            {
                if (form != null)
                {
                    var mapper = new PeptideToMoleculeTextMapper(modeUI, extender);
                    form.Text = mapper.TranslateString(form.Text); // Update the title

                    // Find tooltip components in the form, if any
                    mapper.ToolTips = (from field in form.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                       where typeof(Component).IsAssignableFrom(field.FieldType)
                                       let component = (Component)field.GetValue(form)
                                                       where component is ToolTip
                                                       select component as ToolTip).ToList();

                    mapper.FindInUseKeyboardAccelerators(form.Controls);

                    mapper.Translate(form.Controls); // Update the controls
                }
            }