Beispiel #1
0
        public override FrameworkElement GetControl()
        {
            DockPanel dp = new DockPanel();

            dp.Margin = new Thickness(6);
            Label lbl = new Label();

            lbl.VerticalAlignment = VerticalAlignment.Center;
            lbl.Content           = _Attr.FriendlyName + ":";
            DockPanel.SetDock(lbl, Dock.Left);
            dp.Children.Add(lbl);
            StackPanel sp = new StackPanel();

            dp.Children.Add(sp);

            SubPropAttribute[] attrs = (SubPropAttribute[])_PI.GetCustomAttributes(typeof(SubPropAttribute), true);
            _Values   = (object[])_Ctrl.GetProp(_PI);
            _SubItems = new APropItem[_Values.Length];
            foreach (var x in attrs)
            {
                PropDiscribeAttribute a   = new PropDiscribeAttribute(x.ShowType, x.FriendlyName, x.Describe, x.Param);
                APropItem             itm = PropItemFactory.GetPropItem(a, _Ctrl, _PI);
                sp.Children.Add(itm.GetControl());
                itm.SetPropShowValue(_Values[(int)itm.AttrParam]);
                itm.TimeToShowHelpString += itm_TimeToShowHelpString;
                itm.AutoSet                   = false;
                itm.OnPropValueChanged       += itm_OnPropValueChanged;
                _SubItems[(int)itm.AttrParam] = itm;
            }
            return(dp);
        }
Beispiel #2
0
 public TextPropItem(IPropGWAble jc, PropertyInfo pi, PropDiscribeAttribute attr)
 {
     _Ctrl   = jc;
     _PI     = pi;
     _Attr   = attr;
     AutoSet = true;
 }
Beispiel #3
0
        public static APropItem GetPropItem(PropDiscribeAttribute attr, IPropGWAble jc, PropertyInfo pi)
        {
            var type = attr.ShowType;

            switch (type)
            {
            case CreatorPropType.Text: return(new TextPropItem(jc, pi, attr));

            case CreatorPropType.Boolean: return(new BoolPropItem(jc, pi, attr));

            case CreatorPropType.Multi: return(new MultiPropItem(jc, pi, attr));

            case CreatorPropType.DialogWithText: return(new DialogWithTextPropItem(jc, pi, attr));

            case CreatorPropType.EnumDropDown: return(new EnumDropdownPropItem(jc, pi, attr));

            default:
                throw new NotImplementedException("你没有实现这种CreatorPropType:" + type.ToString());
                return(null);
            }
        }
Beispiel #4
0
 public MultiPropItem(IPropGWAble jc, PropertyInfo pi, PropDiscribeAttribute attr)
 {
     _Ctrl = jc;
     _PI   = pi;
     _Attr = attr;
 }