コード例 #1
0
        public TreeNode createDirectoryNode(ModelDirectory dir)
        {
            var dirNode = new TreeNode(dir.name);

            dirNode.Name = dir.id;
            if (dir.isParent())
            {
                foreach (var child in dir.children)
                {
                    dirNode.Nodes.Add(createDirectoryNode(child));
                }
            }
            return(dirNode);
        }
コード例 #2
0
        private void getDirectories(DBReader reader)
        {
            ModelDirectory  directory;
            string          query         = SqlQueries.getDirectories;
            List <string[]> directoryData = reader.readFromDB(query).getQueryDataAsStrings();

            foreach (string[] row in directoryData)
            {
                directory          = new ModelDirectory();
                directory.parentId = row[SqlQueries.getDirectories_parentIdIndex];
                directory.id       = row[SqlQueries.getDirectories_directoryIdIndex];
                directory.name     = row[SqlQueries.getDirectories_directoryNameIndex];

                if (directory.parentId == null || directory.parentId == "")
                {
                    baseTreeDirectories.Add(directory);
                }

                directoryDict.Add(directory.id, directory);
            }

            assignChildren();
        }
コード例 #3
0
 public void addChild(ModelDirectory dir)
 {
     children.Add(dir);
 }