Exemplo n.º 1
0
        void loadDatabase(TreeNode parentNode, DB db)
        {
            var server = db.getMongoServer();
            string dbName = db.dbname;
            List<string> dbNames = string.IsNullOrEmpty(dbName) ? server.GetDatabaseNames().ToList() : db.dbList;
            if (dbNames != null && dbNames.Any())
            {
                foreach (string d in dbNames)
                {
                    TreeNode dbNode = new TreeNode(d);
                    dbNode.Name = d;
                    dbNode.ImageIndex = 1;
                    dbNode.SelectedImageIndex = 1;
                    parentNode.Nodes.Add(dbNode);

                    loadCollection(dbNode, server, d);
                }
            }
        }
Exemplo n.º 2
0
        void loadDB(DB db)
        {
            TreeNode rootNode = new TreeNode(db.name);
            //rootNode.ImageIndex = 0;
            //rootNode.SelectedImageIndex = 0;
            rootNode.Name = db.name;
            this.treeViewDB.Nodes.Add(rootNode);
            var server = db.getMongoServer();
            List<string> dbNames = string.IsNullOrEmpty(db.dbname) ? server.GetDatabaseNames().ToList() : new List<string> { db.dbname };
            if (dbNames != null && dbNames.Any())
            {
                foreach (string d in dbNames)
                {
                    TreeNode dbNode = new TreeNode(d);
                    //dbNode.ImageIndex = 0;
                    //dbNode.SelectedImageIndex = 0;
                    dbNode.Name = d;
                    rootNode.Nodes.Add(dbNode);

                    loadCollection(dbNode, server, d);
                }
            }
        }