Пример #1
0
        public IS3Tree(UserControl parent, TreeView treeView,
            Tree tree)
        {
            App app = App.Current as App;
            _mainFrame = app.MainFrame;

            _parent = parent;
            _treeView = treeView;
            _treeRoot = tree;
            _treeView.ItemsSource = _treeRoot.Children;

            _isBusy = false;
        }
Пример #2
0
        public Domain(string domainName, DomainType domainType)
        {
            name = domainName;
            type = domainType;

            root = new Tree();
            root.Name = name;

            objsDefinitions = new Dictionary<string, DGObjectsDefinition>();
            objsContainer = new Dictionary<string, DGObjects>();
        }
Пример #3
0
        // Find the parent of the leaf in the root
        //
        public static Tree FindParent(Tree root, Tree leaf)
        {
            if (root.Children.Contains(leaf))
                return root;

            foreach (Tree tree in root.Children)
            {
                Tree result = FindParent(tree, leaf);
                if (result != null)
                    return result;
            }
            return null;
        }
Пример #4
0
        public static XElement Tree2Element(Tree tree)
        {
            List<XAttribute> atts = new List<XAttribute>();
            if (tree.DisplayName != null)
                atts.Add(new XAttribute("DisplayName", tree.DisplayName));
            if (tree.Description != null)
                atts.Add(new XAttribute("Desc", tree.Description));
            if (tree.RefDomainName != null)
                atts.Add(new XAttribute("RefDomainName", tree.RefDomainName));
            if (tree.RefObjsName != null)
                atts.Add(new XAttribute("RefObjsName", tree.RefObjsName));
            if (tree.Filter != null)
                atts.Add(new XAttribute("Filter", tree.Filter));
            if (tree.Sort != null)
                atts.Add(new XAttribute("Sort", tree.Sort));

            XElement xe = new XElement(tree.Name, atts.ToArray());

            foreach (Tree childTree in tree.Children)
            {
                XElement childXe = Tree2Element(childTree);
                xe.Add(childXe);
            }

            return xe;
        }
Пример #5
0
        public static Tree Element2Tree(XElement el)
        {
            Tree tree = new Tree();
            tree.Name = el.Name.ToString();
            if (el.HasAttributes)
            {
                XAttribute attr = el.Attribute("DisplayName");
                if (attr != null)
                    tree.DisplayName = attr.Value;

                attr = el.Attribute("Desc");
                if (attr != null)
                    tree.Description = attr.Value;

                attr = el.Attribute("RefDomainName");
                if (attr != null)
                    tree.RefDomainName = attr.Value;

                attr = el.Attribute("RefObjsName");
                if (attr != null)
                    tree.RefObjsName = attr.Value;

                attr = el.Attribute("Filter");
                if (attr != null)
                    tree.Filter = attr.Value;

                attr = el.Attribute("Sort");
                if (attr != null)
                    tree.Sort = attr.Value;
            }

            foreach (XElement childEl in el.Elements())
            {
                Tree childTree = Element2Tree(childEl);
                tree.Children.Add(childTree);
            }

            return tree;
        }
Пример #6
0
 public TreePanel(Tree rootTree)
 {
     InitializeComponent();
     _is3Tree = new IS3Tree(this, DomainTreeView, rootTree);
 }
Пример #7
0
 void treePanel_OnTreeSelected(object sender, Tree tree)
 {
     if (tree == null)
         MyDataGrid.DGObjectDataGrid.ItemsSource = null;
     MyDataGrid.DGObjectDataGrid.ItemsSource = tree.ObjectsView;
     _lastSelectedTree = tree;
 }