Пример #1
0
 public Com2PropertyDescriptor(int dispid, string name, Attribute[] attrs, bool readOnly, System.Type propType, object typeData, bool hrHidden) : base(name, attrs)
 {
     this.baseReadOnly = readOnly;
     this.readOnly     = readOnly;
     this.baseAttrs    = attrs;
     this.SetNeedsRefresh(0x8000, true);
     this.hrHidden = hrHidden;
     this.SetNeedsRefresh(4, readOnly);
     this.propertyType = propType;
     this.dispid       = dispid;
     if (typeData != null)
     {
         this.typeData = typeData;
         if (typeData is Com2Enum)
         {
             this.converter = new Com2EnumConverter((Com2Enum)typeData);
         }
         else if (typeData is Guid)
         {
             this.valueConverter = this.CreateOleTypeConverter((System.Type)oleConverters[(Guid)typeData]);
         }
     }
     this.canShow = true;
     if (attrs != null)
     {
         for (int i = 0; i < attrs.Length; i++)
         {
             if (attrs[i].Equals(BrowsableAttribute.No) && !hrHidden)
             {
                 this.canShow = false;
                 break;
             }
         }
     }
     if (this.canShow && ((propType == typeof(object)) || ((this.valueConverter == null) && (propType == typeof(UnsafeNativeMethods.IDispatch)))))
     {
         this.typeHide = true;
     }
 }
Пример #2
0
        /// <include file='doc\COM2PropertyDescriptor.uex' path='docs/doc[@for="Com2PropertyDescriptor.Com2PropertyDescriptor"]/*' />
        /// <devdoc>
        /// Ctor.
        /// </devdoc>
        public Com2PropertyDescriptor(int dispid, string name, Attribute[] attrs, bool readOnly, Type propType, Object typeData, bool hrHidden)
        : base(name, attrs) {
            this.baseReadOnly = readOnly;
            this.readOnly = readOnly;

            this.baseAttrs = attrs;
            SetNeedsRefresh(Com2PropertyDescriptorRefresh.BaseAttributes, true);

            this.hrHidden = hrHidden;

            // readonly to begin with are always read only
            SetNeedsRefresh(Com2PropertyDescriptorRefresh.ReadOnly, readOnly);

            this.propertyType = propType;
            
            this.dispid = dispid;

            if (typeData != null) {
                this.typeData = typeData;
                if (typeData is Com2Enum) {
                     converter = new Com2EnumConverter((Com2Enum)typeData);
                }
                else if (typeData is Guid) {
                    valueConverter =  CreateOleTypeConverter((Type)oleConverters[(Guid)typeData]);
                }
            }

            // check if this thing is hidden from metadata
            this.canShow = true;

            if (attrs != null) {
                for (int i = 0; i < attrs.Length; i++) {
                    if (attrs[i].Equals(BrowsableAttribute.No) && !hrHidden) {
                        this.canShow = false;
                        break;
                    }
                }
            }
            
            if (this.canShow && (propType == typeof(Object) || (valueConverter == null && propType == typeof(UnsafeNativeMethods.IDispatch)))) {
                this.typeHide = true;
            }
        }
 public Com2PropertyDescriptor(int dispid, string name, Attribute[] attrs, bool readOnly, System.Type propType, object typeData, bool hrHidden) : base(name, attrs)
 {
     this.baseReadOnly = readOnly;
     this.readOnly = readOnly;
     this.baseAttrs = attrs;
     this.SetNeedsRefresh(0x8000, true);
     this.hrHidden = hrHidden;
     this.SetNeedsRefresh(4, readOnly);
     this.propertyType = propType;
     this.dispid = dispid;
     if (typeData != null)
     {
         this.typeData = typeData;
         if (typeData is Com2Enum)
         {
             this.converter = new Com2EnumConverter((Com2Enum) typeData);
         }
         else if (typeData is Guid)
         {
             this.valueConverter = this.CreateOleTypeConverter((System.Type) oleConverters[(Guid) typeData]);
         }
     }
     this.canShow = true;
     if (attrs != null)
     {
         for (int i = 0; i < attrs.Length; i++)
         {
             if (attrs[i].Equals(BrowsableAttribute.No) && !hrHidden)
             {
                 this.canShow = false;
                 break;
             }
         }
     }
     if (this.canShow && ((propType == typeof(object)) || ((this.valueConverter == null) && (propType == typeof(UnsafeNativeMethods.IDispatch)))))
     {
         this.typeHide = true;
     }
 }