public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType) { if (smartPartInfoType.IsAssignableFrom(spi.GetType())) { return(spi); } return(null); }
private TSmartPartInfo GetSupportedSPI(ISmartPartInfo smartPartInfo) { if (typeof(TSmartPartInfo).IsAssignableFrom(smartPartInfo.GetType()) == false) { return(ConvertFrom(smartPartInfo)); } else { return((TSmartPartInfo)smartPartInfo); } }
/// <summary> /// Registers a <see cref="ISmartPartInfo"/> view data for a given control. /// </summary> /// <param name="smartPart">The smartPart to which provide additional presentation information.</param> /// <param name="info">The additional presentation information for the control.</param> public void RegisterSmartPartInfo(object smartPart, ISmartPartInfo info) { Guard.ArgumentNotNull(smartPart, "smartPart"); Guard.ArgumentNotNull(info, "info"); Predicate <ISmartPartInfo> findSPI = delegate(ISmartPartInfo match) { return(match.GetType() == info.GetType()); }; if (this != RootWorkItem) { RegisterSmartPartInfoInWorkItem(smartPart, info, findSPI, RootWorkItem); } RegisterSmartPartInfoInWorkItem(smartPart, info, findSPI, this); }