Ejemplo n.º 1
0
 public static Description GetTabName(DescriptorAttribute attribute, object instance, object value)
 {
     if (instance is AIExample24_Tabs)
     {
         return(new Description("Tabs!"));
     }
     else
     {
         return(new Description("Not Tabs!"));
     }
 }
        private string[] GetNames(Type type)
        {
            Array         values = Enum.GetValues(type);
            List <string> names  = Enum.GetNames(type).ToList();

            for (int i = 0; i < names.Count; i++)
            {
                DescriptorAttribute descriptor = ((Enum)values.GetValue(i)).GetAttribute <DescriptorAttribute>();
                if (descriptor != null && !string.IsNullOrEmpty(descriptor.Name))
                {
                    names[i] = descriptor.Name;
                }
                else
                {
                    names[i] = ObjectNames.NicifyVariableName(names[i]);
                }
            }

            return(names.ToArray());
        }