コード例 #1
0
ファイル: IS3Tree.cs プロジェクト: iS3-Project/iS3
        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
ファイル: Domain.cs プロジェクト: iS3-Project/iS3
        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
ファイル: Tree.cs プロジェクト: iS3-Project/iS3
        // 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
ファイル: Tree.cs プロジェクト: iS3-Project/iS3
        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
ファイル: Tree.cs プロジェクト: iS3-Project/iS3
        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
ファイル: TreePanel.xaml.cs プロジェクト: iS3-Project/iS3
 public TreePanel(Tree rootTree)
 {
     InitializeComponent();
     _is3Tree = new IS3Tree(this, DomainTreeView, rootTree);
 }
コード例 #7
0
ファイル: MainFrame.xaml.cs プロジェクト: iS3-Project/iS3
 void treePanel_OnTreeSelected(object sender, Tree tree)
 {
     if (tree == null)
         MyDataGrid.DGObjectDataGrid.ItemsSource = null;
     MyDataGrid.DGObjectDataGrid.ItemsSource = tree.ObjectsView;
     _lastSelectedTree = tree;
 }