/// <summary> /// Here is where we handle IVsPerPropertyBrowsing.DisplayChildProperties /// </summary> private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing) { // we only do this for IDispatch types if (sender.CanShow && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)) { NativeMethods.IVsPerPropertyBrowsing vsObj = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject; // should we make this read only? bool pfResult = false; int hr = vsObj.DisplayChildProperties(sender.DISPID, ref pfResult); if (gveevent.TypeConverter is Com2IDispatchConverter) { gveevent.TypeConverter = new Com2IDispatchConverter(sender, (hr == NativeMethods.S_OK && pfResult)); } else { gveevent.TypeConverter = new Com2IDispatchConverter(sender, (hr == NativeMethods.S_OK && pfResult), gveevent.TypeConverter); } } } Debug.Assert(sender.TargetObject == null || sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!"); }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { object target = sender.TargetObject; if (target is NativeMethods.IProvidePropertyBuilder) { NativeMethods.IProvidePropertyBuilder propBuilder = (NativeMethods.IProvidePropertyBuilder)target; int[] pctlBldType = new int[1]; string guidString = null; if (GetBuilderGuidString(propBuilder, sender.DISPID, ref guidString, pctlBldType)) { gveevent.TypeEditor = new Com2PropertyBuilderUITypeEditor(sender, guidString, pctlBldType[0], (UITypeEditor)gveevent.TypeEditor); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { object targetObject = sender.TargetObject; if (targetObject is NativeMethods.IProvidePropertyBuilder) { NativeMethods.IProvidePropertyBuilder target = (NativeMethods.IProvidePropertyBuilder) targetObject; int[] bldrType = new int[1]; string strGuidBldr = null; if (this.GetBuilderGuidString(target, sender.DISPID, ref strGuidBldr, bldrType)) { gveevent.TypeEditor = new Com2PropertyBuilderUITypeEditor(sender, strGuidBldr, bldrType[0], (UITypeEditor) gveevent.TypeEditor); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { object targetObject = sender.TargetObject; if (targetObject is NativeMethods.IProvidePropertyBuilder) { NativeMethods.IProvidePropertyBuilder target = (NativeMethods.IProvidePropertyBuilder)targetObject; int[] bldrType = new int[1]; string strGuidBldr = null; if (this.GetBuilderGuidString(target, sender.DISPID, ref strGuidBldr, bldrType)) { gveevent.TypeEditor = new Com2PropertyBuilderUITypeEditor(sender, strGuidBldr, bldrType[0], (UITypeEditor)gveevent.TypeEditor); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { object target = sender.TargetObject; if (target is NativeMethods.IProvidePropertyBuilder propBuilder) { int[] pctlBldType = new int[1]; string guidString = null; if (GetBuilderGuidString(propBuilder, sender.DISPID, ref guidString, pctlBldType)) { gveevent.TypeEditor = new Com2PropertyBuilderUITypeEditor(sender, guidString, pctlBldType[0], (UITypeEditor)gveevent.TypeEditor); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is System.Windows.Forms.NativeMethods.IPerPropertyBrowsing) { System.Windows.Forms.NativeMethods.IPerPropertyBrowsing targetObject = (System.Windows.Forms.NativeMethods.IPerPropertyBrowsing)sender.TargetObject; bool flag = false; System.Windows.Forms.NativeMethods.CA_STRUCT pCaStringsOut = new System.Windows.Forms.NativeMethods.CA_STRUCT(); System.Windows.Forms.NativeMethods.CA_STRUCT pCaCookiesOut = new System.Windows.Forms.NativeMethods.CA_STRUCT(); int errorCode = 0; try { errorCode = targetObject.GetPredefinedStrings(sender.DISPID, pCaStringsOut, pCaCookiesOut); } catch (ExternalException exception) { errorCode = exception.ErrorCode; } if (gveevent.TypeConverter is Com2IPerPropertyEnumConverter) { gveevent.TypeConverter = null; } if (errorCode != 0) { flag = false; } else { flag = true; } if (flag) { OleStrCAMarshaler names = new OleStrCAMarshaler(pCaStringsOut); Int32CAMarshaler values = new Int32CAMarshaler(pCaCookiesOut); if ((names.Count > 0) && (values.Count > 0)) { gveevent.TypeConverter = new Com2IPerPropertyEnumConverter(new Com2IPerPropertyBrowsingEnum(sender, this, names, values, true)); } } if (!flag && !sender.ConvertingNativeType) { Guid propertyPageGuid = this.GetPropertyPageGuid(targetObject, sender.DISPID); if (!Guid.Empty.Equals(propertyPageGuid)) { gveevent.TypeEditor = new Com2PropertyPageUITypeEditor(sender, propertyPageGuid, (UITypeEditor)gveevent.TypeEditor); } } } }
public void GetTypeConverterAndTypeEditor(ref TypeConverter typeConverter, System.Type editorBaseType, ref object typeEditor) { TypeConverter currentConverter = typeConverter; object currentEditor = typeEditor; if (currentConverter == null) { currentConverter = this.GetBaseTypeConverter(); } if (currentEditor == null) { currentEditor = this.GetBaseTypeEditor(editorBaseType); } if (((this.refreshState & 0x2000) == 0) && (this.PropertyType == typeof(Com2Variant))) { System.Type propertyType = this.PropertyType; object propertyValue = this.GetValue(this.TargetObject); if (propertyValue != null) { propertyValue.GetType(); } ComNativeDescriptor.ResolveVariantTypeConverterAndTypeEditor(propertyValue, ref currentConverter, editorBaseType, ref currentEditor); } if (currentConverter is Com2PropDescMainConverter) { currentConverter = ((Com2PropDescMainConverter)currentConverter).InnerConverter; } GetTypeConverterAndTypeEditorEvent e = new GetTypeConverterAndTypeEditorEvent(currentConverter, currentEditor); this.OnGetTypeConverterAndTypeEditor(e); currentConverter = e.TypeConverter; currentEditor = e.TypeEditor; if (currentConverter == null) { currentConverter = this.GetBaseTypeConverter(); } if (currentEditor == null) { currentEditor = this.GetBaseTypeEditor(editorBaseType); } System.Type type = currentConverter.GetType(); if ((type != typeof(TypeConverter)) && (type != typeof(Com2PropDescMainConverter))) { currentConverter = new Com2PropDescMainConverter(this, currentConverter); } typeConverter = currentConverter; typeEditor = currentEditor; }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is System.Windows.Forms.NativeMethods.IPerPropertyBrowsing) { System.Windows.Forms.NativeMethods.IPerPropertyBrowsing targetObject = (System.Windows.Forms.NativeMethods.IPerPropertyBrowsing) sender.TargetObject; bool flag = false; System.Windows.Forms.NativeMethods.CA_STRUCT pCaStringsOut = new System.Windows.Forms.NativeMethods.CA_STRUCT(); System.Windows.Forms.NativeMethods.CA_STRUCT pCaCookiesOut = new System.Windows.Forms.NativeMethods.CA_STRUCT(); int errorCode = 0; try { errorCode = targetObject.GetPredefinedStrings(sender.DISPID, pCaStringsOut, pCaCookiesOut); } catch (ExternalException exception) { errorCode = exception.ErrorCode; } if (gveevent.TypeConverter is Com2IPerPropertyEnumConverter) { gveevent.TypeConverter = null; } if (errorCode != 0) { flag = false; } else { flag = true; } if (flag) { OleStrCAMarshaler names = new OleStrCAMarshaler(pCaStringsOut); Int32CAMarshaler values = new Int32CAMarshaler(pCaCookiesOut); if ((names.Count > 0) && (values.Count > 0)) { gveevent.TypeConverter = new Com2IPerPropertyEnumConverter(new Com2IPerPropertyBrowsingEnum(sender, this, names, values, true)); } } if (!flag && !sender.ConvertingNativeType) { Guid propertyPageGuid = this.GetPropertyPageGuid(targetObject, sender.DISPID); if (!Guid.Empty.Equals(propertyPageGuid)) { gveevent.TypeEditor = new Com2PropertyPageUITypeEditor(sender, propertyPageGuid, (UITypeEditor) gveevent.TypeEditor); } } } }
protected void OnGetTypeConverterAndTypeEditor(GetTypeConverterAndTypeEditorEvent e) { try { this.com2props.AlwaysValid = this.com2props.CheckValid(); GetTypeConverterAndTypeEditorEventHandler handler = (GetTypeConverterAndTypeEditorEventHandler)this.Events[EventGetTypeConverterAndTypeEditor]; if (handler != null) { handler(this, e); } } finally { this.com2props.AlwaysValid = false; } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (((sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing) && sender.CanShow) && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)) { NativeMethods.IVsPerPropertyBrowsing targetObject = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject; bool pfDisplay = false; int num = targetObject.DisplayChildProperties(sender.DISPID, ref pfDisplay); if (gveevent.TypeConverter is Com2IDispatchConverter) { gveevent.TypeConverter = new Com2IDispatchConverter(sender, (num == 0) && pfDisplay); } else { gveevent.TypeConverter = new Com2IDispatchConverter(sender, (num == 0) && pfDisplay, gveevent.TypeConverter); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (((sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing) && sender.CanShow) && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)) { NativeMethods.IVsPerPropertyBrowsing targetObject = (NativeMethods.IVsPerPropertyBrowsing) sender.TargetObject; bool pfDisplay = false; int num = targetObject.DisplayChildProperties(sender.DISPID, ref pfDisplay); if (gveevent.TypeConverter is Com2IDispatchConverter) { gveevent.TypeConverter = new Com2IDispatchConverter(sender, (num == 0) && pfDisplay); } else { gveevent.TypeConverter = new Com2IDispatchConverter(sender, (num == 0) && pfDisplay, gveevent.TypeConverter); } } }
private unsafe void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is not Oleaut32.IPerPropertyBrowsing ppb) { return; } // check for enums Ole32.CALPOLESTR caStrings = default; Ole32.CADWORD caCookies = default; HRESULT hr; try { hr = ppb.GetPredefinedStrings(sender.DISPID, &caStrings, &caCookies); } catch (ExternalException ex) { hr = (HRESULT)ex.ErrorCode; Debug.Fail($"An exception occurred inside IPerPropertyBrowsing::GetPredefinedStrings(dispid={sender.DISPID}), object type={new ComNativeDescriptor().GetClassName(ppb)}"); } // Terminate the existing editor if we created the current one so if the items have disappeared, // we don't hold onto the old items. if (gveevent.TypeConverter is Com2IPerPropertyEnumConverter) { gveevent.TypeConverter = null; } if (hr == HRESULT.S_OK) { string[] names = caStrings.ConvertAndFree(); uint[] cookies = caCookies.ConvertAndFree(); if (names.Length > 0 && cookies.Length > 0) { gveevent.TypeConverter = new Com2IPerPropertyEnumConverter(new Com2IPerPropertyBrowsingEnum(sender, names, cookies)); } } else { // If we didn't get any strings, try the proppage editor // // This is a bit of a backwards-compat work around. Many older ActiveX controls will show a // property page for all properties since the old grid would only put up the [...] button for // "(Custom)". If we have a conversion editor, don't allow this to override it. if (sender.ConvertingNativeType) { return; } Guid guid = GetPropertyPageGuid(ppb, sender.DISPID); if (!Guid.Empty.Equals(guid)) { gveevent.TypeEditor = new Com2PropertyPageUITypeEditor(sender, guid, (UITypeEditor)gveevent.TypeEditor); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is NativeMethods.IPerPropertyBrowsing) { NativeMethods.IPerPropertyBrowsing ppb = (NativeMethods.IPerPropertyBrowsing)sender.TargetObject; bool hasStrings = false; // check for enums NativeMethods.CA_STRUCT caStrings = new NativeMethods.CA_STRUCT(); NativeMethods.CA_STRUCT caCookies = new NativeMethods.CA_STRUCT(); int hr = NativeMethods.S_OK; try { hr = ppb.GetPredefinedStrings(sender.DISPID, caStrings, caCookies); } catch (ExternalException ex) { hr = ex.ErrorCode; Debug.Fail("An exception occurred inside IPerPropertyBrowsing::GetPredefinedStrings(dispid=" + sender.DISPID + "), object type=" + new ComNativeDescriptor().GetClassName(ppb) + ". This is caused by an exception (usually an AV) inside the object being browsed, and is not a problem in the properties window."); } // Terminate the existing editor if we created the current one // so if the items have disappeared, we don't hold onto the old // items. if (gveevent.TypeConverter is Com2IPerPropertyEnumConverter) { gveevent.TypeConverter = null; } if (hr != NativeMethods.S_OK) { hasStrings = false; } else { hasStrings = true; } if (hasStrings) { OleStrCAMarshaler stringMarshaler = new OleStrCAMarshaler(caStrings); Int32CAMarshaler intMarshaler = new Int32CAMarshaler(caCookies); if (stringMarshaler.Count > 0 && intMarshaler.Count > 0) { gveevent.TypeConverter = new Com2IPerPropertyEnumConverter(new Com2IPerPropertyBrowsingEnum(sender, this, stringMarshaler, intMarshaler, true)); } else { //hasStrings = false; } } // if we didn't get any strings, try the proppage edtior // if (!hasStrings) { // this is a _bit_ of a backwards-compat work around... // many older ActiveX controls will show a property page // for all properties since the old grid would only put up the // [...] button for "(Custom)". If we have a conversion editor, // don't allow this to override it... // if (sender.ConvertingNativeType) { return; } Guid g = GetPropertyPageGuid(ppb, sender.DISPID); if (!Guid.Empty.Equals(g)) { gveevent.TypeEditor = new Com2PropertyPageUITypeEditor(sender, g, (UITypeEditor)gveevent.TypeEditor); } } } }
/// <include file='doc\COM2IVsPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IVsPerPropertyBrowsingHandler.OnGetTypeConverterAndTypeEditor"]/*' /> /// <devdoc> /// Here is where we handle IVsPerPropertyBrowsing.DisplayChildProperties /// </devdoc> private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing){ // we only do this for IDispatch types if (sender.CanShow && typeof(UnsafeNativeMethods.IDispatch).IsAssignableFrom(sender.PropertyType)){ NativeMethods.IVsPerPropertyBrowsing vsObj = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject; // should we make this read only? bool pfResult = false; int hr = vsObj.DisplayChildProperties(sender.DISPID, ref pfResult); if (gveevent.TypeConverter is Com2IDispatchConverter){ gveevent.TypeConverter = new Com2IDispatchConverter(sender, (hr == NativeMethods.S_OK && pfResult)); } else{ gveevent.TypeConverter = new Com2IDispatchConverter(sender, (hr == NativeMethods.S_OK && pfResult), gveevent.TypeConverter); } } } Debug.Assert(sender.TargetObject == null || sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!"); }
private unsafe void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { object target = sender.TargetObject; if (target is VSSDK.IProvidePropertyBuilder propBuilder) { string guidString = null; VSSDK.CTLBLDTYPE pctlBldType = 0; if (GetBuilderGuidString(propBuilder, sender.DISPID, ref guidString, &pctlBldType)) { gveevent.TypeEditor = new Com2PropertyBuilderUITypeEditor(sender, guidString, pctlBldType, (UITypeEditor)gveevent.TypeEditor); } } }
private void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is NativeMethods.IPerPropertyBrowsing) { NativeMethods.IPerPropertyBrowsing ppb = (NativeMethods.IPerPropertyBrowsing)sender.TargetObject; bool hasStrings = false; // check for enums NativeMethods.CA_STRUCT caStrings = new NativeMethods.CA_STRUCT(); NativeMethods.CA_STRUCT caCookies = new NativeMethods.CA_STRUCT(); int hr = NativeMethods.S_OK; try { hr = ppb.GetPredefinedStrings(sender.DISPID, caStrings, caCookies); } catch(ExternalException ex){ hr = ex.ErrorCode; Debug.Fail("An exception occurred inside IPerPropertyBrowsing::GetPredefinedStrings(dispid=" + sender.DISPID + "), object type=" + new ComNativeDescriptor().GetClassName(ppb) + ". This is caused by an exception (usually an AV) inside the object being browsed, and is not a problem in the properties window."); } // Terminate the existing editor if we created the current one // so if the items have disappeared, we don't hold onto the old // items. if (gveevent.TypeConverter is Com2IPerPropertyEnumConverter) { gveevent.TypeConverter = null; } if (hr != NativeMethods.S_OK) { hasStrings = false; } else { hasStrings = true; } if (hasStrings) { OleStrCAMarshaler stringMarshaler = new OleStrCAMarshaler(caStrings); Int32CAMarshaler intMarshaler = new Int32CAMarshaler(caCookies); if (stringMarshaler.Count > 0 && intMarshaler.Count > 0) { gveevent.TypeConverter = new Com2IPerPropertyEnumConverter(new Com2IPerPropertyBrowsingEnum(sender, this, stringMarshaler, intMarshaler, true)); } else { //hasStrings = false; } } // if we didn't get any strings, try the proppage edtior // if (!hasStrings){ // this is a _bit_ of a backwards-compat work around... // many older ActiveX controls will show a property page // for all properties since the old grid would only put up the // [...] button for "(Custom)". If we have a conversion editor, // don't allow this to override it... // if (sender.ConvertingNativeType){ return; } Guid g = GetPropertyPageGuid(ppb, sender.DISPID); if (!Guid.Empty.Equals(g)){ gveevent.TypeEditor = new Com2PropertyPageUITypeEditor(sender, g, (UITypeEditor)gveevent.TypeEditor); } } } }
/// <summary> /// Here is where we handle IVsPerPropertyBrowsing.DisplayChildProperties /// </summary> private unsafe void OnGetTypeConverterAndTypeEditor(Com2PropertyDescriptor sender, GetTypeConverterAndTypeEditorEvent gveevent) { if (sender.TargetObject is VSSDK.IVsPerPropertyBrowsing) { // we only do this for IDispatch types if (sender.CanShow && typeof(Oleaut32.IDispatch).IsAssignableFrom(sender.PropertyType)) { VSSDK.IVsPerPropertyBrowsing vsObj = (VSSDK.IVsPerPropertyBrowsing)sender.TargetObject; // should we make this read only? BOOL pfResult = BOOL.FALSE; HRESULT hr = vsObj.DisplayChildProperties(sender.DISPID, &pfResult); if (gveevent.TypeConverter is Com2IDispatchConverter) { gveevent.TypeConverter = new Com2IDispatchConverter(sender, hr == HRESULT.S_OK && pfResult.IsTrue()); } else { gveevent.TypeConverter = new Com2IDispatchConverter(hr == HRESULT.S_OK && pfResult.IsTrue(), gveevent.TypeConverter); } } } Debug.Assert(sender.TargetObject is null || sender.TargetObject is VSSDK.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!"); }
protected void OnGetTypeConverterAndTypeEditor(GetTypeConverterAndTypeEditorEvent e) { try { com2props.AlwaysValid = com2props.CheckValid(); GetTypeConverterAndTypeEditorEventHandler handler = (GetTypeConverterAndTypeEditorEventHandler)Events[EventGetTypeConverterAndTypeEditor]; if (handler != null) handler(this, e); } finally { com2props.AlwaysValid = false; } }
public void GetTypeConverterAndTypeEditor(ref TypeConverter typeConverter, System.Type editorBaseType, ref object typeEditor) { TypeConverter currentConverter = typeConverter; object currentEditor = typeEditor; if (currentConverter == null) { currentConverter = this.GetBaseTypeConverter(); } if (currentEditor == null) { currentEditor = this.GetBaseTypeEditor(editorBaseType); } if (((this.refreshState & 0x2000) == 0) && (this.PropertyType == typeof(Com2Variant))) { System.Type propertyType = this.PropertyType; object propertyValue = this.GetValue(this.TargetObject); if (propertyValue != null) { propertyValue.GetType(); } ComNativeDescriptor.ResolveVariantTypeConverterAndTypeEditor(propertyValue, ref currentConverter, editorBaseType, ref currentEditor); } if (currentConverter is Com2PropDescMainConverter) { currentConverter = ((Com2PropDescMainConverter) currentConverter).InnerConverter; } GetTypeConverterAndTypeEditorEvent e = new GetTypeConverterAndTypeEditorEvent(currentConverter, currentEditor); this.OnGetTypeConverterAndTypeEditor(e); currentConverter = e.TypeConverter; currentEditor = e.TypeEditor; if (currentConverter == null) { currentConverter = this.GetBaseTypeConverter(); } if (currentEditor == null) { currentEditor = this.GetBaseTypeEditor(editorBaseType); } System.Type type = currentConverter.GetType(); if ((type != typeof(TypeConverter)) && (type != typeof(Com2PropDescMainConverter))) { currentConverter = new Com2PropDescMainConverter(this, currentConverter); } typeConverter = currentConverter; typeEditor = currentEditor; }
/// <include file='doc\COM2PropertyDescriptor.uex' path='docs/doc[@for="Com2PropertyDescriptor.GetTypeConverterAndTypeEditor"]/*' /> /// <devdoc> /// Retrieves the value editor for the property. If a value editor is passed /// in as a TypeConverterAttribute, that value editor will be instantiated. /// If no such attribute was found, a system value editor will be looked for. /// See TypeConverter for a description of how system value editors are found. /// If there is no system value editor, null is returned. If the value editor found /// takes an IEditorSite in its constructor, the parameter will be passed in. /// </devdoc> public void GetTypeConverterAndTypeEditor(ref TypeConverter typeConverter, Type editorBaseType, ref Object typeEditor) { // get the base editor and converter, attributes first TypeConverter localConverter = typeConverter; Object localEditor = typeEditor; if (localConverter == null) { localConverter = GetBaseTypeConverter(); } if (localEditor == null) { localEditor = GetBaseTypeEditor(editorBaseType); } // if this is a object, get the value and attempt to create the correct value editor based on that value. // we don't do this if the state came from an attribute // if (0 == (refreshState & Com2PropertyDescriptorRefresh.TypeConverterAttr) && this.PropertyType == typeof(Com2Variant)) { Type editorType = PropertyType; Object value = GetValue(TargetObject); if (value != null) { editorType = value.GetType(); } ComNativeDescriptor.ResolveVariantTypeConverterAndTypeEditor(value, ref localConverter, editorBaseType, ref localEditor); } // now see if someone else would like to serve up a value editor // // unwrap the editor if it's one of ours. if (localConverter is Com2PropDescMainConverter) { localConverter = ((Com2PropDescMainConverter)localConverter).InnerConverter; } GetTypeConverterAndTypeEditorEvent e = new GetTypeConverterAndTypeEditorEvent(localConverter, localEditor); OnGetTypeConverterAndTypeEditor(e); localConverter = e.TypeConverter; localEditor = e.TypeEditor; // just in case one of the handlers removed our editor... // if (localConverter == null) { localConverter = GetBaseTypeConverter(); } if (localEditor == null) { localEditor = GetBaseTypeEditor(editorBaseType); } // wrap the value editor in our main value editor, but only if it isn't "TypeConverter" or already a Com2PropDescMainTypeConverter // Type localConverterType = localConverter.GetType(); if (localConverterType != typeof(TypeConverter) && localConverterType != (typeof(Com2PropDescMainConverter))) { localConverter = new Com2PropDescMainConverter(this, localConverter); } // save the values back to the variables. // typeConverter = localConverter; typeEditor = localEditor; }