Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2817-BinPackingSpeedup/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Providers/ConnectionProvider.cs

Last change on this file was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 1.7 KB
Line 
1using System;
2using System.ComponentModel;
3namespace Netron.Diagramming.Core {
4  /// <summary>
5  /// Type descriptor provider for all descendants of the <see cref="ConnectionBase"/> classes.
6  /// </summary>
7  class ConnectionProvider : TypeDescriptionProvider {
8    #region Fields
9
10    /// <summary>
11    /// connection descriptor
12    /// </summary>
13    private static ConnectionDescriptor connectionDescriptor;
14
15
16    #endregion
17
18    #region Properties
19
20
21    #endregion
22
23    #region Constructor
24    /// <summary>
25    /// Initializes a new instance of the <see cref="T:ConnectionProvider"/> class.
26    /// </summary>
27    public ConnectionProvider() {
28      connectionDescriptor = new ConnectionDescriptor(this, typeof(ConnectionBase));
29    }
30    #endregion
31
32    #region Methods
33    /// <summary>
34    /// Gets a custom type descriptor for the given type and object.
35    /// </summary>
36    /// <param name="objectType">The type of object for which to retrieve the type descriptor.</param>
37    /// <param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor"></see>.</param>
38    /// <returns>
39    /// An <see cref="T:System.ComponentModel.ICustomTypeDescriptor"></see> that can provide metadata for the type.
40    /// </returns>
41    public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) {
42      if (typeof(ConnectionBase).IsInstanceOfType(instance)) {
43        return connectionDescriptor;
44      } else //if nothing found use the base descriptor
45        return base.GetTypeDescriptor(objectType, instance);
46
47    }
48    #endregion
49
50  }
51
52}
Note: See TracBrowser for help on using the repository browser.