Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Providers/ConnectionProvider.cs @ 2768

Last change on this file since 2768 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

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