Beispiel #1
0
        /// <summary>
        /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
        /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
        /// </summary>
        private void OnGetDynamicAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing vsObj)
            {
                int hr = NativeMethods.S_OK;

                // we want to avoid allowing clients to force a bad property to be browsable,
                // so we don't allow things that are marked as non browsable to become browsable,
                // only the other way around.
                //
                if (sender.CanShow)
                {
                    // should we hide this?
                    bool pfHide = sender.Attributes[typeof(BrowsableAttribute)].Equals(BrowsableAttribute.No);

                    hr = vsObj.HideProperty(sender.DISPID, ref pfHide);
                    if (hr == NativeMethods.S_OK)
                    {
                        attrEvent.Add(pfHide ? BrowsableAttribute.No : BrowsableAttribute.Yes);
                    }
                }

                // should we show this
                if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType) && sender.CanShow)
                {
                    bool pfDisplay = false;
                    hr = vsObj.DisplayChildProperties(sender.DISPID, ref pfDisplay);
                    if (hr == NativeMethods.S_OK && pfDisplay)
                    {
                        attrEvent.Add(BrowsableAttribute.Yes);
                    }
                }
            }
            Debug.Assert(sender.TargetObject == null || sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!");
        }
Beispiel #2
0
        /// <summary>
        ///  Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
        ///  such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
        /// </summary>
        private unsafe void OnGetDynamicAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            if (sender.TargetObject is VSSDK.IVsPerPropertyBrowsing vsObj)
            {
                HRESULT hr = HRESULT.S_OK;

                // we want to avoid allowing clients to force a bad property to be browsable,
                // so we don't allow things that are marked as non browsable to become browsable,
                // only the other way around.
                if (sender.CanShow)
                {
                    // should we hide this?
                    BOOL pfHide = sender.Attributes[typeof(BrowsableAttribute)] is Attribute browsableAttribute &&
                                  browsableAttribute.Equals(BrowsableAttribute.No) ? BOOL.TRUE : BOOL.FALSE;
                    hr = vsObj.HideProperty(sender.DISPID, &pfHide);
                    if (hr == HRESULT.S_OK)
                    {
                        attrEvent.Add(pfHide.IsTrue() ? BrowsableAttribute.No : BrowsableAttribute.Yes);
                    }
                }

                // should we show this
                if (typeof(Oleaut32.IDispatch).IsAssignableFrom(sender.PropertyType) && sender.CanShow)
                {
                    BOOL pfDisplay = BOOL.FALSE;
                    hr = vsObj.DisplayChildProperties(sender.DISPID, &pfDisplay);
                    if (hr == HRESULT.S_OK && pfDisplay.IsTrue())
                    {
                        attrEvent.Add(BrowsableAttribute.Yes);
                    }
                }
            }

            Debug.Assert(sender.TargetObject is null || sender.TargetObject is VSSDK.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!");
        }
 private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     string categoryFromObject = this.GetCategoryFromObject(sender.TargetObject, sender.DISPID);
     if ((categoryFromObject != null) && (categoryFromObject.Length > 0))
     {
         attrEvent.Add(new CategoryAttribute(categoryFromObject));
     }
 }
Beispiel #4
0
        private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            string cat = GetCategoryFromObject(sender.TargetObject, sender.DISPID);

            if (cat != null && cat.Length > 0)
            {
                attrEvent.Add(new CategoryAttribute(cat));
            }
        }
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     System.Windows.Forms.NativeMethods.IPerPropertyBrowsing targetObject = sender.TargetObject as System.Windows.Forms.NativeMethods.IPerPropertyBrowsing;
     if (targetObject != null)
     {
         bool flag = !Guid.Empty.Equals(this.GetPropertyPageGuid(targetObject, sender.DISPID));
         if ((sender.CanShow && flag) && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType))
         {
             attrEvent.Add(BrowsableAttribute.Yes);
         }
     }
 }
        /// <include file='doc\COM2IManagedPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IManagedPerPropertyBrowsingHandler.OnGetAttributes"]/*' />
        /// <devdoc>
        /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
        /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
        /// </devdoc>
        private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent) {
            Object target = sender.TargetObject;

            if (target is NativeMethods.IManagedPerPropertyBrowsing) {
                Attribute[] attrs = GetComponentAttributes((NativeMethods.IManagedPerPropertyBrowsing)target,sender.DISPID);
                if (attrs != null) {
                    for (int i = 0; i < attrs.Length; i++) {
                        attrEvent.Add(attrs[i]);
                    }
                }
            }
        }
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     NativeMethods.IVsPerPropertyBrowsing targetObject = sender.TargetObject as NativeMethods.IVsPerPropertyBrowsing;
     if (targetObject != null)
     {
         string[] pbstrLocalizeDescription = new string[1];
         if ((targetObject.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, null, pbstrLocalizeDescription) == 0) && (pbstrLocalizeDescription[0] != null))
         {
             attrEvent.Add(new DescriptionAttribute(pbstrLocalizeDescription[0]));
         }
     }
 }
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     System.Windows.Forms.NativeMethods.IPerPropertyBrowsing targetObject = sender.TargetObject as System.Windows.Forms.NativeMethods.IPerPropertyBrowsing;
     if (targetObject != null)
     {
         bool flag = !Guid.Empty.Equals(this.GetPropertyPageGuid(targetObject, sender.DISPID));
         if ((sender.CanShow && flag) && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType))
         {
             attrEvent.Add(BrowsableAttribute.Yes);
         }
     }
 }
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     NativeMethods.IVsPerPropertyBrowsing targetObject = sender.TargetObject as NativeMethods.IVsPerPropertyBrowsing;
     if (targetObject != null)
     {
         string[] pbstrLocalizeDescription = new string[1];
         if ((targetObject.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, null, pbstrLocalizeDescription) == 0) && (pbstrLocalizeDescription[0] != null))
         {
             attrEvent.Add(new DescriptionAttribute(pbstrLocalizeDescription[0]));
         }
     }
 }
Beispiel #10
0
        /// <summary>
        ///  Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
        ///  such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
        /// </summary>
        private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            object target = sender.TargetObject;

            if (target is VSSDK.IVSMDPerPropertyBrowsing browsing)
            {
                Attribute[] attrs = GetComponentAttributes(browsing, sender.DISPID);
                for (int i = 0; i < attrs.Length; i++)
                {
                    attrEvent.Add(attrs[i]);
                }
            }
        }
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     NativeMethods.IProvidePropertyBuilder targetObject = sender.TargetObject as NativeMethods.IProvidePropertyBuilder;
     if (targetObject != null)
     {
         string strGuidBldr = null;
         bool flag = this.GetBuilderGuidString(targetObject, sender.DISPID, ref strGuidBldr, new int[1]);
         if ((sender.CanShow && flag) && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType))
         {
             attrEvent.Add(BrowsableAttribute.Yes);
         }
     }
 }
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     NativeMethods.IProvidePropertyBuilder targetObject = sender.TargetObject as NativeMethods.IProvidePropertyBuilder;
     if (targetObject != null)
     {
         string strGuidBldr = null;
         bool   flag        = this.GetBuilderGuidString(targetObject, sender.DISPID, ref strGuidBldr, new int[1]);
         if ((sender.CanShow && flag) && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType))
         {
             attrEvent.Add(BrowsableAttribute.Yes);
         }
     }
 }
 private void OnGetDynamicAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing)
     {
         NativeMethods.IVsPerPropertyBrowsing targetObject = (NativeMethods.IVsPerPropertyBrowsing) sender.TargetObject;
         if (sender.CanShow)
         {
             bool pfHide = sender.Attributes[typeof(BrowsableAttribute)].Equals(BrowsableAttribute.No);
             if (targetObject.HideProperty(sender.DISPID, ref pfHide) == 0)
             {
                 attrEvent.Add(pfHide ? BrowsableAttribute.No : BrowsableAttribute.Yes);
             }
         }
         if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType) && sender.CanShow)
         {
             bool pfDisplay = false;
             if ((targetObject.DisplayChildProperties(sender.DISPID, ref pfDisplay) == 0) && pfDisplay)
             {
                 attrEvent.Add(BrowsableAttribute.Yes);
             }
         }
     }
 }
 /// <include file='doc\COM2IPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IPerPropertyBrowsingHandler.OnGetAttributes"]/*' />
 /// <devdoc>
 /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
 /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
 /// </devdoc>
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent) {
     NativeMethods.IPerPropertyBrowsing target = sender.TargetObject as NativeMethods.IPerPropertyBrowsing;
     if (target != null) {
         // we hide IDispatch props by default, we we need to force showing them here
                                                           
         bool validPropPage = !Guid.Empty.Equals(GetPropertyPageGuid(target, sender.DISPID));
         
         if (sender.CanShow && validPropPage) {
             if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)) {
                 attrEvent.Add(BrowsableAttribute.Yes);
             }
         }
     }
 }
        /// <include file='doc\COM2IProvidePropertyBuilderHandler.uex' path='docs/doc[@for="Com2IProvidePropertyBuilderHandler.OnGetAttributes"]/*' />
        /// <devdoc>
        /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
        /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
        /// </devdoc>
        private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent) {
            NativeMethods.IProvidePropertyBuilder target = sender.TargetObject as NativeMethods.IProvidePropertyBuilder;

            if (target != null ) {
                string s = null;
                bool builderValid = GetBuilderGuidString(target, sender.DISPID, ref s, new int[1]);
                // we hide IDispatch props by default, we we need to force showing them here
                if (sender.CanShow && builderValid) {
                    if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)) {
                        attrEvent.Add(BrowsableAttribute.Yes);
                    }
                }
            }
        }
         private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent){
             NativeMethods.IVsPerPropertyBrowsing vsObj = sender.TargetObject as NativeMethods.IVsPerPropertyBrowsing;

             if (vsObj == null) {
                 return;
             }

             // should we localize this?
             string[] pHelpString = new string[1];
             int hr = vsObj.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, null, pHelpString);
             if (hr == NativeMethods.S_OK && pHelpString[0] != null){
                attrEvent.Add(new DescriptionAttribute(pHelpString[0]));
             }
         }
 private void OnGetDynamicAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing)
     {
         NativeMethods.IVsPerPropertyBrowsing targetObject = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject;
         if (sender.CanShow)
         {
             bool pfHide = sender.Attributes[typeof(BrowsableAttribute)].Equals(BrowsableAttribute.No);
             if (targetObject.HideProperty(sender.DISPID, ref pfHide) == 0)
             {
                 attrEvent.Add(pfHide ? BrowsableAttribute.No : BrowsableAttribute.Yes);
             }
         }
         if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType) && sender.CanShow)
         {
             bool pfDisplay = false;
             if ((targetObject.DisplayChildProperties(sender.DISPID, ref pfDisplay) == 0) && pfDisplay)
             {
                 attrEvent.Add(BrowsableAttribute.Yes);
             }
         }
     }
 }
        /// <include file='doc\COM2IManagedPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IManagedPerPropertyBrowsingHandler.OnGetAttributes"]/*' />
        /// <devdoc>
        /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
        /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
        /// </devdoc>
        private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            object target = sender.TargetObject;

            if (target is NativeMethods.IManagedPerPropertyBrowsing)
            {
                Attribute[] attrs = GetComponentAttributes((NativeMethods.IManagedPerPropertyBrowsing)target, sender.DISPID);
                if (attrs != null)
                {
                    for (int i = 0; i < attrs.Length; i++)
                    {
                        attrEvent.Add(attrs[i]);
                    }
                }
            }
        }
Beispiel #19
0
        private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            if (!(sender.TargetObject is VSSDK.IVsPerPropertyBrowsing vsObj))
            {
                return;
            }

            // should we localize this?
            string[] pHelpString = new string[1];
            HRESULT  hr          = vsObj.GetLocalizedPropertyInfo(sender.DISPID, Kernel32.GetThreadLocale(), null, pHelpString);

            if (hr == HRESULT.S_OK && pHelpString[0] is not null)
            {
                attrEvent.Add(new DescriptionAttribute(pHelpString[0]));
            }
        }
Beispiel #20
0
        private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            if (!(sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing vsObj))
            {
                return;
            }

            // should we localize this?
            string[] pHelpString = new string[1];
            int      hr          = vsObj.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, null, pHelpString);

            if (hr == NativeMethods.S_OK && pHelpString[0] != null)
            {
                attrEvent.Add(new DescriptionAttribute(pHelpString[0]));
            }
        }
        private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            object targetObject = sender.TargetObject;

            if (targetObject is System.Windows.Forms.NativeMethods.IManagedPerPropertyBrowsing)
            {
                Attribute[] componentAttributes = GetComponentAttributes((System.Windows.Forms.NativeMethods.IManagedPerPropertyBrowsing)targetObject, sender.DISPID);
                if (componentAttributes != null)
                {
                    for (int i = 0; i < componentAttributes.Length; i++)
                    {
                        attrEvent.Add(componentAttributes[i]);
                    }
                }
            }
        }
 /// <summary>
 ///  Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
 ///  such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
 /// </summary>
 private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     if (sender.TargetObject is NativeMethods.IProvidePropertyBuilder target)
     {
         string s            = null;
         bool   builderValid = GetBuilderGuidString(target, sender.DISPID, ref s, new int[1]);
         // we hide IDispatch props by default, we we need to force showing them here
         if (sender.CanShow && builderValid)
         {
             if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType))
             {
                 attrEvent.Add(BrowsableAttribute.Yes);
             }
         }
     }
 }
 private unsafe void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     if (sender.TargetObject is VSSDK.IProvidePropertyBuilder target)
     {
         string           s            = null;
         VSSDK.CTLBLDTYPE bldrType     = 0;
         bool             builderValid = GetBuilderGuidString(target, sender.DISPID, ref s, &bldrType);
         // we hide IDispatch props by default, we we need to force showing them here
         if (sender.CanShow && builderValid)
         {
             if (typeof(Oleaut32.IDispatch).IsAssignableFrom(sender.PropertyType))
             {
                 attrEvent.Add(BrowsableAttribute.Yes);
             }
         }
     }
 }
Beispiel #24
0
        private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            if (sender.TargetObject is Oleaut32.IPerPropertyBrowsing target)
            {
                // we hide IDispatch props by default, we we need to force showing them here

                bool validPropPage = !Guid.Empty.Equals(GetPropertyPageGuid(target, sender.DISPID));

                if (sender.CanShow && validPropPage)
                {
                    if (typeof(Oleaut32.IDispatch).IsAssignableFrom(sender.PropertyType))
                    {
                        attrEvent.Add(BrowsableAttribute.Yes);
                    }
                }
            }
        }
        private void OnGetBaseAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
        {
            NativeMethods.IVsPerPropertyBrowsing vsObj = sender.TargetObject as NativeMethods.IVsPerPropertyBrowsing;

            if (vsObj == null)
            {
                return;
            }

            // should we localize this?
            string[] pHelpString = new string[1];
            int      hr          = vsObj.GetLocalizedPropertyInfo(sender.DISPID, SafeNativeMethods.GetUserDefaultLCID(), null, pHelpString);

            if (hr == NativeMethods.S_OK && pHelpString[0] != null)
            {
                attrEvent.Add(new DescriptionAttribute(pHelpString[0]));
            }
        }
         /// <include file='doc\COM2IVsPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IVsPerPropertyBrowsingHandler.OnGetAttributes"]/*' />
         /// <devdoc>
         /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo and IVsPerPropertyBrowsing.   HideProperty
         /// such as IPerPropertyBrowsing, IProvidePropertyBuilder, etc.
         /// </devdoc>
         private void OnGetDynamicAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent){

               if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing){
                  NativeMethods.IVsPerPropertyBrowsing vsObj = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject;

                  int hr = NativeMethods.S_OK;
                  
                  // we want to avoid allowing clients to force a bad property to be browsable,
                  // so we don't allow things that are marked as non browsable to become browsable,
                  // only the other way around.
                  //
                  if (sender.CanShow) {
                    // should we hide this?
                    bool pfHide = sender.Attributes[typeof(BrowsableAttribute)].Equals(BrowsableAttribute.No);
                  
                    hr = vsObj.HideProperty(sender.DISPID, ref pfHide);
                    if (hr == NativeMethods.S_OK){
                         attrEvent.Add(pfHide ? BrowsableAttribute.No : BrowsableAttribute.Yes);
                    }
                  } 

                  // should we show this
                  if (typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType) && sender.CanShow){
                     bool pfDisplay = false;
                     hr = vsObj.DisplayChildProperties(sender.DISPID, ref pfDisplay);
                     if (hr == NativeMethods.S_OK && pfDisplay){
                           attrEvent.Add(BrowsableAttribute.Yes);
                     }
                  }
               }
               Debug.Assert(sender.TargetObject == null || sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!");
         }
 private void OnGetAttributes(Com2PropertyDescriptor sender, GetAttributesEvent attrEvent)
 {
     object targetObject = sender.TargetObject;
     if (targetObject is System.Windows.Forms.NativeMethods.IManagedPerPropertyBrowsing)
     {
         Attribute[] componentAttributes = GetComponentAttributes((System.Windows.Forms.NativeMethods.IManagedPerPropertyBrowsing) targetObject, sender.DISPID);
         if (componentAttributes != null)
         {
             for (int i = 0; i < componentAttributes.Length; i++)
             {
                 attrEvent.Add(componentAttributes[i]);
             }
         }
     }
 }