public static PropertyDescriptorCollection GetObjectProperties(EnumReflectionMemberInfoSelectScope scope, object obj, bool browsableOnly) { bool includeClient = MethodInfoWebClient.IsWebClientObject(obj); bool includeServer = MethodInfoWebClient.IsWebServerObject(obj); PropertyDescriptorCollection ps = VPLUtil.GetProperties(obj, scope, false, browsableOnly, true); // TypeDescriptor.GetProperties(obj, attrs, false); List <PropertyDescriptor> l = new List <PropertyDescriptor>(); foreach (PropertyDescriptor p in ps) { bool include = false; if (includeClient) { if (WebClientMemberAttribute.IsClientProperty(p)) { include = true; } } if (!include) { if (includeServer) { if (WebServerMemberAttribute.IsServerProperty(p)) { include = true; } } } if (!include) { if (includeClient) { if (!(obj is Form) && (obj is IWebClientControl)) { if (string.CompareOrdinal(p.Name, "Location") != 0) { include = true; } } } } if (!include) { if (includeServer) { if (obj is IWebServerProgrammingSupport) { include = true; } } } if (include) { l.Add(p); } } return(new PropertyDescriptorCollection(l.ToArray())); }
public List <InterfaceElementProperty> GetProperties() { ClassPointer cp = this.ClassTypePointer; if (cp != null) { if (!cp.IsInterface) { throw new DesignerException("Invalid interface pointer. Class Id:{0}", cp.ClassId); } if (cp.ObjectInstance == null) { throw new DesignerException("Interface object not loaded. Class Id:{0}", cp.ClassId); } InterfaceClass ifc = VPLUtil.GetObject(cp.ObjectInstance) as InterfaceClass; if (ifc == null) { throw new DesignerException("Invalid interface pointer. object:{0}", cp.ObjectInstance); } return(ifc.Properties); } else { Type t = this.VariableLibType; if (t == null) { throw new DesignerException("Invalid interface pointer. VariableLibType is null."); } if (t.IsInterface) { List <InterfaceElementProperty> ls = new List <InterfaceElementProperty>(); PropertyInfo[] mifs = VPLUtil.GetProperties(t); if (mifs != null && mifs.Length > 0) { for (int i = 0; i < mifs.Length; i++) { if (!mifs[i].IsSpecialName) { InterfaceElementProperty em = new InterfaceElementProperty(this, mifs[i]); ls.Add(em); } } } return(ls); } else { throw new DesignerException("Invalid interface pointer. Type is not an interface:{0}.", t); } } }