public Component CreateNewComponentInstance(Type componentType) { Collections.Enumerator <ComponentConstructor> enumerator = Collections.GetEnumerator <ComponentConstructor>(this.engineService.ComponentConstructors); while (enumerator.MoveNext()) { ComponentConstructor current = enumerator.Current; if (current.IsAcceptable(componentType, this)) { return(current.GetComponentInstance(componentType, this)); } } return((Component)componentType.GetConstructor(EmptyTypes).Invoke(Collections.EmptyArray)); }
public void RegisterComponentConstructor(ComponentConstructor componentConstructor) { this.ComponentConstructors.Add(componentConstructor); }