Change 'alpha' to 'transparency' in feature detector

Allow renaming of enum values in public property editor
This commit is contained in:
Lars Brubaker 2018-09-21 16:11:05 -07:00
parent 6af27029ff
commit 4fd69ef58a
3 changed files with 60 additions and 2 deletions

View file

@ -52,11 +52,21 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// Enum keyed on name to friendly name
var enumItems = Enum.GetNames(property.PropertyType).Select(enumName =>
{
var renamedName = enumName;
var renameAttribute = property.PropertyInfo.GetCustomAttributes(true).OfType<EnumRenameAttribute>().FirstOrDefault();
if (renameAttribute != null)
{
if(renameAttribute.NameMaping.TryGetValue(renamedName, out string value))
{
renamedName = value;
}
}
return new
{
Key = enumName,
Value = enumName.Replace('_', ' ')
};
Value = renamedName.Replace('_', ' ')
};
});
dropDownList = new DropDownList("Name".Localize(), theme.Colors.PrimaryTextColor, Direction.Down, pointSize: theme.DefaultFontSize)