Exemple #1
0
        private void InitAttrs()
        {
            if (Field != null)
            {
                VisibleAttribute visibleAttribute = Field.GetCustomAttribute <VisibleAttribute>();
                if (visibleAttribute != null)
                {
                    visibleAttrDrawer            = (VisibleAttrDrawer)DrawerUtility.GetAttrDrawerInstance(visibleAttribute);
                    visibleAttrDrawer.Attr       = visibleAttribute;
                    visibleAttrDrawer.ItemDrawer = this;
                }

                decoratorAttrDrawers.Clear();
                DecoratorAttribute[] decoratorAttributes = (DecoratorAttribute[])Field.GetCustomAttributes(typeof(DecoratorAttribute), false);
                if (decoratorAttributes != null && decoratorAttributes.Length > 0)
                {
                    foreach (var attr in decoratorAttributes)
                    {
                        DecoratorAttrDrawer drawer = (DecoratorAttrDrawer)DrawerUtility.GetAttrDrawerInstance(attr);
                        drawer.ItemDrawer = this;
                        decoratorAttrDrawers.Add(drawer);
                    }
                }

                layoutAttrDrawers.Clear();
                LayoutAttribute[] layoutAttributes = (LayoutAttribute[])Field.GetCustomAttributes(typeof(LayoutAttribute), false);
                if (layoutAttributes != null && layoutAttributes.Length > 0)
                {
                    foreach (var attr in layoutAttributes)
                    {
                        LayoutAttrDrawer drawer = (LayoutAttrDrawer)DrawerUtility.GetAttrDrawerInstance(attr);
                        drawer.Occasion = attr.Occasion;
                        layoutAttrDrawers.Add(drawer);
                    }
                }

                ContentAttribute contentAttribute = Field.GetCustomAttribute <ContentAttribute>();
                if (contentAttribute != null)
                {
                    ContentAttrDrawer contentAttrDrawer = (ContentAttrDrawer)DrawerUtility.GetAttrDrawerInstance(contentAttribute);
                    contentAttrDrawer.ItemDrawer = this;
                    innerDrawer = contentAttrDrawer;
                }
            }
        }
Exemple #2
0
        private void RefreshDrawer()
        {
            if (innerDrawer != null)
            {
                return;
            }
            if (Target != null && Value != null)
            {
                TypeDrawer typeDrawer = DrawerUtility.GetTypeDrawerInstance(ValueType);
                if (typeDrawer != null)
                {
                    typeDrawer.Label      = Label;
                    typeDrawer.ItemDrawer = this;
                    innerDrawer           = typeDrawer;
                }
                else
                {
                    InstanceDrawer instanceDrawer = null;
                    if (TypeUtility.IsArrayOrListType(ValueType))
                    {
                        instanceDrawer = new ArrayDrawer(Value);
                    }
                    else if (TypeUtility.IsStructOrClassType(ValueType))
                    {
                        instanceDrawer = new ObjectDrawer(Value);
                    }

                    if (instanceDrawer != null)
                    {
                        instanceDrawer.Header     = Label;
                        instanceDrawer.ItemDrawer = this;

                        instanceDrawer.IsShowInherit = ParentDrawer.IsShowInherit;
                        instanceDrawer.IsShowBox     = ParentDrawer.IsShowBox;

                        innerDrawer = instanceDrawer;
                    }
                }
            }
        }
Exemple #3
0
 public HorizontalLayoutDrawer Remove(ILayoutDrawable item)
 {
     items.Remove(item);
     return(this);
 }
Exemple #4
0
 public HorizontalLayoutDrawer Add(ILayoutDrawable item)
 {
     items.Add(item);
     return(this);
 }
 public VerticalLayoutDrawer Remove(ILayoutDrawable item)
 {
     items.Remove(item);
     return(this);
 }
 public VerticalLayoutDrawer Add(ILayoutDrawable item)
 {
     items.Add(item);
     return(this);
 }