private IEnumerable <PropertyDescription> GetPropertyDescriptions(PropModelType pm)
        {
            List <PropertyDescription> result = new List <PropertyDescription>();

            foreach (IPropItemModel pi in pm.GetPropItems())
            {
                result.Add(new PropertyDescription(pi.PropertyName, pi.PropertyType, canWrite: true));
            }
            return(result);
        }
        public PropertyDescriptor[] BuildPropDescriptors(PropModelType pm /*, IPropFactory pf*/)
        {
            PropertyDescriptor[] descriptors = new PropertyDescriptor[pm.Count];

            List <IPropItemModel> propItems = pm.GetPropItems().ToList();

            for (int pdPtr = 0; pdPtr < propItems.Count; pdPtr++)
            {
                IPropItemModel pItem = propItems[pdPtr];

                PropItemPropertyDescriptor <IPropBag> propItemTypeDesc =
                    new PropItemPropertyDescriptor <IPropBag>(pItem.PropertyName, pItem.PropertyType, new Attribute[] { });

                descriptors[pdPtr] = propItemTypeDesc;
            }

            return(descriptors);
        }
Esempio n. 3
0
        public IEnumerable <MemberInfo> GetExtraMembers(PropModelType pm)
        {
            List <MemberInfo> result = new List <MemberInfo>();

            foreach (IPropItemModel propItem in pm.GetPropItems())
            {
                string propertyName = propItem.PropertyName;
                Type   propertyType = propItem.PropertyType;

                Func <ITypeSafePropBag, string, Type, object> getter =
                    new Func <ITypeSafePropBag, string, Type, object>((host, pn, pt) => PBDispatcher.GetValue(host, pn, pt));

                Action <ITypeSafePropBag, string, Type, object> setter =
                    new Action <ITypeSafePropBag, string, Type, object>((host, pn, pt, value) => PBDispatcher.SetValue(host, pn, pt, value));

                PropertyInfoWT pi = new PropertyInfoWT(propertyName, propertyType, typeof(PBDispatcher),
                                                       getter, setter);

                result.Add(pi);
            }

            return(result);
        }