Esempio n. 1
0
        void AddTree(Session session)
        {
            var parent = new TableWithHierarchy(session);

            parent.Val = "Root";
            parent.Save();

            for (var i = 1; i <= MaxRecordCount; ++i)
            {
                var child = new TableWithHierarchy(session);

                child.Parent           = parent;
                child.Val              = $"{i}";
                child.MaterializedPath = $"/{i}";
                child.Save();

                for (var j = 1; j <= MaxRecordCount; ++j)
                {
                    var childChild = new TableWithHierarchy(session);

                    childChild.Parent           = child;
                    childChild.Val              = $"{i}.{j}";
                    childChild.MaterializedPath = $"/{i}/{j}";
                    childChild.Save();
                }
            }
        }
Esempio n. 2
0
        private void TreeListFocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("TreeListFocusedNodeChanged");

            TableWithHierarchy
                oldRecord = treeList.GetDataRecordByNode(e.OldNode) as TableWithHierarchy,
                record    = treeList.GetDataRecordByNode(e.Node) as TableWithHierarchy;

            System.Diagnostics.Debug.WriteLine($"oldId = {oldRecord?.Id.ToString() ?? "NULL"} -> Id = {record?.Id.ToString() ?? "NULL"}");
        }
Esempio n. 3
0
        private bool IsAllSelected(TreeList tree)
        {
            /* return tree.Selection.Count > 0 && tree.Selection.Count == tree.AllNodesCount; */

            var result = /*return*/ tree.Nodes /*.Where(node => node.Visible)*/.Aggregate(true, (selected, next) =>
            {
                TableWithHierarchy record = tree.GetDataRecordByNode(next) as TableWithHierarchy;
                System.Diagnostics.Debug.WriteLine(string.Format("Id = {0} node.Focused = {1}", record != null ? record.Id.ToString() : "null", next.Focused));
                return(selected && record != null && record.Selected);
            });

            return(result);
        }
Esempio n. 4
0
        private void BtnGetSelectedClick(object sender, System.EventArgs e)
        {
            foreach (TreeListNode node in treeList.Selection)
            {
                TableWithHierarchy record = treeList.GetDataRecordByNode(node) as TableWithHierarchy;
                Debug.WriteLine($"Id = {record?.Id.ToString() ?? "NULL"}");

                if (treeList.Selection.Contains(node))
                {
                    Debug.WriteLine($"treeList.Selection.Contains({node})");
                }

                if (treeList.Selection.Contains(node, new TreeListNodeEqualityComparer()))
                {
                    Debug.WriteLine($"treeList.Selection.Contains({node})");
                }
            }
        }