Ejemplo n.º 1
0
        private AutoControl CreateCustomAutoControlInstance(PropertyInfo _info)
        {
            object valueObject = _info.GetValue(_component, null);

            if (_info.PropertyType == typeof(float))
            {
                return(new AutoControlFloat());
            }
            else if (_info.PropertyType == typeof(bool))
            {
                return(new AutoControlBool());
            }
            else if (_info.PropertyType == typeof(int))
            {
                return(new AutoControlInt());
            }
            else if (_info.PropertyType == typeof(byte))
            {
                return(new AutoControlByte());
            }
            else if (_info.PropertyType == typeof(Vector2))
            {
                return(new AutoControlVector2());
            }
            else if (_info.PropertyType == typeof(Point))
            {
                return(new AutoControlPoint());
            }
            else if (_info.PropertyType == typeof(Rectangle))
            {
                return(new AutoControlRectangle());
            }
            else if (_info.PropertyType == typeof(String))
            {
                return(new AutoControlString());
            }
            else if (valueObject is Enum)
            {
                String[] names = Enum.GetNames(_info.PropertyType);
                if (names.Length < 1)
                {
                    return(null);
                }
                else
                {
                    AutoControlEnum enumControl = new AutoControlEnum();
                    enumControl.SetComboBoxValues(names);
                    return(enumControl);
                }
            }
            return(null);
        }
 private AutoControl CreateCustomAutoControlInstance(PropertyInfo _info)
 {        
     object valueObject = _info.GetValue(_component, null);
     if (_info.PropertyType == typeof(float))
     {
         return new AutoControlFloat();               
     }
     else if (_info.PropertyType == typeof(bool))
     {
         return new AutoControlBool();
     }
     else if (_info.PropertyType == typeof(int))
     {
         return new AutoControlInt();
     }
     else if (_info.PropertyType == typeof(byte))
     {
         return new AutoControlByte();
     }
     else if (_info.PropertyType == typeof(Vector2))
     {
         return new AutoControlVector2();
     }
     else if (_info.PropertyType == typeof(Point))
     {
         return new AutoControlPoint();
     }
     else if (_info.PropertyType == typeof(Rectangle))
     {
         return new AutoControlRectangle();
     }
     else if (_info.PropertyType == typeof(String))
     {
         return new AutoControlString();
     }
     else if (valueObject is Enum)
     {
         String[] names = Enum.GetNames(_info.PropertyType);
         if (names.Length < 1)
         {
             return null;
         }
         else
         {
             AutoControlEnum enumControl = new AutoControlEnum();
             enumControl.SetComboBoxValues(names);
             return enumControl;
         }
     }
     return null;
 }