private void OnGetDisplayValue(Com2PropertyDescriptor sender, GetNameItemEvent gnievent) { try { if (sender.TargetObject is NativeMethods.IPerPropertyBrowsing) { // if we are using the dropdown, don't convert the value // or the values will change when we select them and call back // for the display value. if (sender.Converter is Com2IPerPropertyEnumConverter || sender.ConvertingNativeType) { return; } bool success = true; string displayString = GetDisplayString((NativeMethods.IPerPropertyBrowsing)sender.TargetObject, sender.DISPID, ref success); if (success) { gnievent.Name = displayString; } } } catch { } }
public virtual string GetDisplayValue(string defaultValue) { GetNameItemEvent gnie = new GetNameItemEvent(defaultValue); this.OnGetDisplayValue(gnie); return((gnie.Name == null) ? null : gnie.Name.ToString()); }
private void OnGetDisplayName(Com2PropertyDescriptor sender, GetNameItemEvent nameItem) { if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing) { NativeMethods.IVsPerPropertyBrowsing targetObject = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject; string[] pbstrLocalizedName = new string[1]; if ((targetObject.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, pbstrLocalizedName, null) == 0) && (pbstrLocalizedName[0] != null)) { nameItem.Name = pbstrLocalizedName[0]; } } }
private void OnGetDisplayName(Com2PropertyDescriptor sender, GetNameItemEvent nameItem) { if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing) { NativeMethods.IVsPerPropertyBrowsing targetObject = (NativeMethods.IVsPerPropertyBrowsing) sender.TargetObject; string[] pbstrLocalizedName = new string[1]; if ((targetObject.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, pbstrLocalizedName, null) == 0) && (pbstrLocalizedName[0] != null)) { nameItem.Name = pbstrLocalizedName[0]; } } }
/// <summary> /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo (part 2) /// </summary> private void OnGetDisplayName(Com2PropertyDescriptor sender, GetNameItemEvent nameItem) { if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing vsObj) { // get the localized name, if applicable string[] pNameString = new string[1]; int hr = vsObj.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, pNameString, null); if (hr == NativeMethods.S_OK && pNameString[0] != null) { nameItem.Name = pNameString[0]; } } Debug.Assert(sender.TargetObject == null || sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!"); }
/// <summary> /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo (part 2) /// </summary> private void OnGetDisplayName(Com2PropertyDescriptor sender, GetNameItemEvent nameItem) { if (sender.TargetObject is VSSDK.IVsPerPropertyBrowsing vsObj) { // get the localized name, if applicable string[] pNameString = new string[1]; HRESULT hr = vsObj.GetLocalizedPropertyInfo(sender.DISPID, Kernel32.GetThreadLocale(), pNameString, null); if (hr == HRESULT.S_OK && pNameString[0] is not null) { nameItem.Name = pNameString[0]; } } Debug.Assert(sender.TargetObject is null || sender.TargetObject is VSSDK.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!"); }
private void RaiseGetNameItemEvent(object key, GetNameItemEvent e) { try { this.com2props.AlwaysValid = this.com2props.CheckValid(); GetNameItemEventHandler handler = (GetNameItemEventHandler)this.Events[key]; if (handler != null) { handler(this, e); } } finally { this.com2props.AlwaysValid = false; } }
private void OnGetDisplayValue(Com2PropertyDescriptor sender, GetNameItemEvent gnievent) { try { if ((sender.TargetObject is System.Windows.Forms.NativeMethods.IPerPropertyBrowsing) && (!(sender.Converter is Com2IPerPropertyEnumConverter) && !sender.ConvertingNativeType)) { bool success = true; string str = GetDisplayString((System.Windows.Forms.NativeMethods.IPerPropertyBrowsing) sender.TargetObject, sender.DISPID, ref success); if (success) { gnievent.Name = str; } } } catch { } }
private void OnGetDisplayValue(Com2PropertyDescriptor sender, GetNameItemEvent gnievent) { try { if ((sender.TargetObject is System.Windows.Forms.NativeMethods.IPerPropertyBrowsing) && (!(sender.Converter is Com2IPerPropertyEnumConverter) && !sender.ConvertingNativeType)) { bool success = true; string str = GetDisplayString((System.Windows.Forms.NativeMethods.IPerPropertyBrowsing)sender.TargetObject, sender.DISPID, ref success); if (success) { gnievent.Name = str; } } } catch { } }
/// <include file='doc\COM2IVsPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IVsPerPropertyBrowsingHandler.OnGetDisplayName"]/*' /> /// <devdoc> /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo (part 2) /// </devdoc> private void OnGetDisplayName(Com2PropertyDescriptor sender, GetNameItemEvent nameItem) { if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing) { NativeMethods.IVsPerPropertyBrowsing vsObj = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject; // get the localized name, if applicable string[] pNameString = new string[1]; int hr = vsObj.GetLocalizedPropertyInfo(sender.DISPID, SafeNativeMethods.GetUserDefaultLCID(), pNameString, null); if (hr == NativeMethods.S_OK && pNameString[0] != null) { nameItem.Name = pNameString[0]; } } else { Debug.Fail("Object is not " + Interface.Name + "!"); } }
/// <include file='doc\COM2PropertyDescriptor.uex' path='docs/doc[@for="Com2PropertyDescriptor.RaiseGetNameItemEvent"]/*' /> /// <devdoc> /// Raises the appropriate event /// </devdoc> private void RaiseGetNameItemEvent(Object key, GetNameItemEvent e) { try { com2props.AlwaysValid = com2props.CheckValid(); GetNameItemEventHandler handler = (GetNameItemEventHandler)Events[key]; if (handler != null) handler(this, e); } finally { com2props.AlwaysValid = false; } }
protected void OnGetDisplayValue(GetNameItemEvent gnie) { this.RaiseGetNameItemEvent(EventGetDisplayValue, gnie); }
protected void OnGetDisplayName(GetNameItemEvent gnie) { this.RaiseGetNameItemEvent(EventGetDisplayName, gnie); }
/// <include file='doc\COM2IVsPerPropertyBrowsingHandler.uex' path='docs/doc[@for="Com2IVsPerPropertyBrowsingHandler.OnGetDisplayName"]/*' /> /// <devdoc> /// Here is where we handle IVsPerPropertyBrowsing.GetLocalizedPropertyInfo (part 2) /// </devdoc> private void OnGetDisplayName(Com2PropertyDescriptor sender, GetNameItemEvent nameItem){ if (sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing){ NativeMethods.IVsPerPropertyBrowsing vsObj = (NativeMethods.IVsPerPropertyBrowsing)sender.TargetObject; // get the localized name, if applicable string[] pNameString = new string[1]; int hr = vsObj.GetLocalizedPropertyInfo(sender.DISPID, CultureInfo.CurrentCulture.LCID, pNameString, null); if (hr == NativeMethods.S_OK && pNameString[0] != null){ nameItem.Name = pNameString[0]; } } Debug.Assert(sender.TargetObject == null || sender.TargetObject is NativeMethods.IVsPerPropertyBrowsing, "Object is not " + Interface.Name + "!"); }
/// <include file='doc\COM2PropertyDescriptor.uex' path='docs/doc[@for="Com2PropertyDescriptor.GetDisplayValue"]/*' /> /// <devdoc> /// Gets the value that should be displayed to the user, such as in /// the Property Browser. /// </devdoc> public virtual string GetDisplayValue(string defaultValue) { GetNameItemEvent nie = new GetNameItemEvent(defaultValue); OnGetDisplayValue(nie); string str = (nie.Name == null ? null : nie.Name.ToString()); return str; }
public virtual string GetDisplayValue(string defaultValue) { GetNameItemEvent gnie = new GetNameItemEvent(defaultValue); this.OnGetDisplayValue(gnie); return ((gnie.Name == null) ? null : gnie.Name.ToString()); }
/// <include file='doc\COM2PropertyDescriptor.uex' path='docs/doc[@for="Com2PropertyDescriptor.OnGetDisplayValue"]/*' /> /// <devdoc> /// Raises the appropriate event /// </devdoc> protected void OnGetDisplayValue(GetNameItemEvent gnie) { RaiseGetNameItemEvent(EventGetDisplayValue, gnie); }