Exemplo n.º 1
0
 public void LoadEditor(Assembly editorAssembly)
 {
     foreach (Type t in editorAssembly.GetTypes())
     {
         foreach (Attribute currentAttribute in Attribute.GetCustomAttributes(t))
         {
             if (currentAttribute.GetType() == typeof(PropertyEditorTypeAttribute))
             {
                 PropertyEditorTypeAttribute peta = (PropertyEditorTypeAttribute)currentAttribute;
                 Type editsType = peta.Type;
                 if (t.IsSubclassOf(typeof(PropertyEditorCell)))
                 {
                     if (peta.Inherits)
                     {
                         inheritingEditors.Add(editsType, t);
                     }
                     else
                     {
                         editors.Add(editsType, t);
                     }
                 }
             }
             else if (currentAttribute.GetType() == typeof(SurrogateUITypeEditorAttribute))
             {
                 Type editsType = (currentAttribute as SurrogateUITypeEditorAttribute).Type;
                 surrogates.Add(editsType, t);
             }
         }
     }
 }
Exemplo n.º 2
0
        public void LoadEditor(Assembly editorAssembly)
        {
            foreach (Type t in editorAssembly.GetTypes())
            {
                foreach (Attribute currentAttribute in Attribute.GetCustomAttributes(t))
                {
                    if (currentAttribute.GetType() == typeof(PropertyEditorTypeAttribute))
                    {
                        PropertyEditorTypeAttribute peta = (PropertyEditorTypeAttribute)currentAttribute;
                        Type editsType = peta.Type;
                        if (t.IsSubclassOf(typeof(PropertyEditorCell)))
                        {
                            if (peta.Inherits)
                            {
                                inheritingEditors.Add(editsType, t);
                            }
                            else
                            {
                                editors.Add(editsType, t);
                            }
                        }
                    }
                    else if (currentAttribute.GetType() == typeof(SurrogateUITypeEditorAttribute))
                    {
                        Type editsType = (currentAttribute as SurrogateUITypeEditorAttribute).Type;
                        surrogates.Add(editsType, t);
                    }
                }
            }

            // OLLE: Added some editors
            editors[typeof(byte)]   = typeof(IntRange);
            editors[typeof(sbyte)]  = typeof(IntRange);
            editors[typeof(short)]  = typeof(IntRange);
            editors[typeof(ushort)] = typeof(IntRange);
            editors[typeof(int)]    = typeof(IntRange);
            editors[typeof(uint)]   = typeof(IntRange);
            editors[typeof(long)]   = typeof(IntRange);
            editors[typeof(ulong)]  = typeof(IntRange);
            editors[typeof(float)]  = typeof(FloatRange);
            editors[typeof(double)] = typeof(FloatRange);
        }