Ejemplo n.º 1
0
            public override void LoadNextLevel(TreeNodeObject parentNode)
            {
                TreeNodeProperty tf = (TreeNodeProperty)parentNode;
                Type             t  = tf._property.PropertyType;

                TreeNodeObject.LoadNextLevel(parentNode, t);
            }
Ejemplo n.º 2
0
        public static void LoadNextLevel(TreeNodeObject parentNode, Type type)
        {
            SortedList <string, TreeNodeObject> sl = new SortedList <string, TreeNodeObject>();

            FieldInfo[] fifs = type.GetFields();
            if (fifs != null && fifs.Length > 0)
            {
                for (int i = 0; i < fifs.Length; i++)
                {
                    if (!fifs[i].IsSpecialName && !fifs[i].IsStatic)
                    {
                        TreeNodeField tf = new TreeNodeField(fifs[i]);
                        sl.Add(tf.Text, tf);
                    }
                }
            }
            PropertyInfo[] pifs = type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
            if (pifs != null && pifs.Length > 0)
            {
                for (int i = 0; i < pifs.Length; i++)
                {
                    if (!pifs[i].IsSpecialName)
                    {
                        TreeNodeProperty tp = new TreeNodeProperty(pifs[i]);
                        sl.Add(tp.Text, tp);
                    }
                }
            }
            IEnumerator <KeyValuePair <string, TreeNodeObject> > en = sl.GetEnumerator();

            while (en.MoveNext())
            {
                parentNode.Nodes.Add(en.Current.Value);
            }
        }