/// <summary> /// Method to register a legend item factory /// </summary> /// <param name="itemFactory"></param> public void Register(ILegendItemFactory itemFactory) { itemFactory.Factory = this; foreach (var forType in itemFactory.ForType) { LegendItemFactories[forType] = itemFactory; } }
private static ILegendItemFactory LookUpFactory(Type t) { if (t == null) { throw new ArgumentNullException("t"); } ILegendItemFactory res = null; while (true) { if (t == null) { break; } if (LegendItemFactories.TryGetValue(t, out res)) { break; } foreach (var i in t.GetInterfaces()) { if (LegendItemFactories.TryGetValue(i, out res)) { return(res); } } if (t == typeof(object)) { break; } var baseType = t.BaseType; t = baseType; } return(res); }
/// <summary> /// Method to register a legend item factory /// </summary> /// <param name="itemFactory"></param> public void Register(ILegendItemFactory itemFactory) { itemFactory.Factory = this; foreach (var forType in itemFactory.ForType ) { LegendItemFactories[forType] = itemFactory; } }