Пример #1
0
        void UpdateNode(TreeControl.Node node)
        {
            Translators.HierarchyTranslator trans = Translators.HierarchyTranslator.GetTranslator(node.Tag.GetType());
            if (trans != null)
            {
                node.Clear();
                FontStyle fs = node.FontStyle;
                node.Label      = trans.GetLabel(node.Tag, out fs);
                node.FontStyle  = fs;
                node.ImageIndex = trans.GetImage(node.Tag);
                object statusTag = trans.GetStatusTag(node.Tag);
                node.Expanded = expansionStatus.ContainsKey(statusTag) && expansionStatus[statusTag];

                List <object> children = trans.GetChildren(node.Tag);
                if (children != null && children.Count > 0)
                {
                    node.IsLeaf = false;
                    foreach (object o in children)
                    {
                        Fill(node, o);
                    }
                }
                else
                {
                    node.IsLeaf = true;
                }
            }
        }