private static UIComponent ProcessProperty <T>(this UIHelperBase group, IOptionsWrapper <T> options, string propertyName, string description, Func <string, string> translator = null) { if (translator != null) { description = translator.Invoke(description); } UIComponent component = null; var checkboxAttribute = options.GetOptions().GetAttribute <T, CheckboxAttribute>(propertyName); if (checkboxAttribute != null) { component = group.AddCheckbox <T>(options, description, propertyName, checkboxAttribute); } var textfieldAttribute = options.GetOptions().GetAttribute <T, TextfieldAttribute>(propertyName); if (textfieldAttribute != null) { component = group.AddTextfield <T>(options, description, propertyName, textfieldAttribute); } var enumDropDownAttribute = options.GetOptions().GetAttribute <T, EnumDropDownAttribute>(propertyName); if (enumDropDownAttribute != null) { component = group.AddEnumDropdown <T>(options, description, propertyName, enumDropDownAttribute, translator); } var dynamicDropDownAttribute = options.GetOptions().GetAttribute <T, DynamicDropDownAttribute>(propertyName); if (dynamicDropDownAttribute != null) { component = group.AddDynamicDropdown <T>(options, description, propertyName, dynamicDropDownAttribute, translator); } var sliderAttribute = options.GetOptions().GetAttribute <T, SliderAttribute>(propertyName); if (sliderAttribute != null) { component = group.AddSlider <T>(options, description, propertyName, sliderAttribute); } var buttonAttribute = options.GetOptions().GetAttribute <T, ButtonAttribute>(propertyName); if (buttonAttribute != null) { component = group.AddButton <T>(description, buttonAttribute); } var labelAttribute = options.GetOptions().GetAttribute <T, LabelAttribute>(propertyName); if (labelAttribute != null) { component = group.AddLabel <T>(description); } //TODO: more control types var descriptionAttribute = options.GetOptions().GetAttribute <T, DescriptionAttribute>(propertyName); if (component != null && descriptionAttribute != null) { component.tooltip = (translator == null || descriptionAttribute is DontTranslateDescriptionAttribute) ? descriptionAttribute.Description : translator.Invoke(descriptionAttribute.Description); } return(component); }