/// <summary> /// Converts an element into its path location relative to the solution. /// </summary> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { // Ensure only projects are converted and only to string. if (destinationType != typeof(string) || !(value is ProjectItem) || !DteHelper.IsWebReference((ProjectItem)value)) { throw new ArgumentException(Properties.Resources.WebReferenceConverter_InvalidConversion); } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary> /// Validates that the received value is a path expression that identifies a /// web reference in a project based on the logical treeview of the solution explorer, /// starting at the solution. /// </summary> public override bool IsValid(ITypeDescriptorContext context, object value) { if (!(value is string)) { return(base.IsValid(context, value)); } object element = base.ConvertFromInternal(context, CultureInfo.CurrentCulture, value, false); return(element != null && element is ProjectItem && DteHelper.IsWebReference((ProjectItem)element)); }