using System; using System.ComponentModel; namespace Netron.Diagramming.Core { /// /// Type descriptor provider for all descendants of the classes. /// class ConnectionProvider : TypeDescriptionProvider { #region Fields /// /// connection descriptor /// private static ConnectionDescriptor connectionDescriptor; #endregion #region Properties #endregion #region Constructor /// /// Initializes a new instance of the class. /// public ConnectionProvider() { connectionDescriptor = new ConnectionDescriptor(this, typeof(ConnectionBase)); } #endregion #region Methods /// /// Gets a custom type descriptor for the given type and object. /// /// The type of object for which to retrieve the type descriptor. /// An instance of the type. Can be null if no instance was passed to the . /// /// An that can provide metadata for the type. /// public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { if (typeof(ConnectionBase).IsInstanceOfType(instance)) { return connectionDescriptor; } else //if nothing found use the base descriptor return base.GetTypeDescriptor(objectType, instance); } #endregion } }