Beispiel #1
0
        public void Populate()
        {
            Config cfg = Config.Instance;

            Tree.Nodes.Clear();

            if (!cfg.ReviewDataActive)
            {
                return;
            }

            LocationCollection locs = AccessDatalayer.Instance.GetLocations();

            LocNode root = null;

            foreach (Location loc in locs)
            {
                if (loc.Code.Equals(cfg.RootCode))
                {
                    root = new LocNode(loc);
                    root.ContextMenuStrip = ContextMenuStrip;
                }
            }

            if (root != null)
            {
                GetChildren(root, locs);

                root.Expand();

                Tree.Nodes.Add(root);
            }
        }
Beispiel #2
0
        public void GetChildren(LocNode locNode, LocationCollection locs)
        {
            foreach (Location loc in locs)
            {
                if (loc.Parent.NewValue.Equals(locNode.Code))
                {
                    LocNode child = new LocNode(loc);
                    child.ContextMenuStrip = ContextMenuStrip;

                    locNode.Nodes.Add(child);
                    GetChildren(child, locs);
                }
            }
        }