// Summary: // Get a database context, which is requried to start reading // objects from database file. // //protected DbContext _dbContext; //public DbContext getDbContext() //{ // // option: // // 0 - odbc connection (default) // // 1 - oledb connection // if (_dbContext == null) // _dbContext = new DbContext(projDef.LocalDatabaseName, 0); // return _dbContext; //} // Summary: // Synchronize objects on the tree. // Remarks: // After synchronization, each tree will have an a DataView of objects. // public int syncObjectsOnTree(Tree inputTree, bool readSubTree = true) { int nSync = 0; List <Tree> trees = null; if (readSubTree == true) { trees = inputTree.ToList(); } else { trees = new List <Tree>(); trees.Add(inputTree); } foreach (Tree tree in trees) { if (tree.RefDomainName == null || tree.RefObjsName == null) { continue; } Domain domain = null; if (domains.ContainsKey(tree.RefDomainName)) { domain = domains[tree.RefDomainName]; } if (domain == null) { continue; } DGObjects objs = null; if (domain.objsContainer.ContainsKey(tree.RefObjsName)) { objs = domain.objsContainer[tree.RefObjsName]; } if (objs == null) { continue; } if (objs.rawDataSet.Tables.Count == 0) { continue; } // Open a view on the table, and apply filter and sort rule on the table // DataTable dt = objs.rawDataSet.Tables[0]; DataView dv = new DataView(dt, tree.Filter, tree.Sort, DataViewRowState.CurrentRows); tree.ObjectsView = dv; tree.RefObjs = objs; } return(nSync); }