public void Fill(Database db) { trv.Nodes.Clear(); nodeDb = new NodeDatabase(db.DatabaseName); nodeDb.Fill(db); trv.Nodes.Add(nodeDb); trv.HandleMultiSelection = true; trv.ExpandAllForce(db); nodeDb.Expand(); // Grid NodeTables nodeTables = GetNode <NodeTables>(); List <GenTable> tables = new List <GenTable>(); foreach (NodeTable node in nodeTables.Nodes) { var gtb = node.Item; var tb = db.GetTableInfo(gtb.SchemaName, gtb.TableName); gtb.Tag = tb; tables.Add(gtb); } grdTables.DataSource = tables; int count = 0; foreach (DataGridViewRow row in grdTables.Rows) { DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)row.Cells[this.ColEnumColumnName.Index]; //for (int i = count; i < count+5; i++) //cell.Items.Add("Cell " + i); cell.DataSource = new BindingSource(new string[] { "A " + count, "B " + count }, null); count++; } }
public void Fill(Database db, ConnectionInfo ci, bool selectFirst) { isLoading = true; //trv.Nodes.Clear(); string time; var tc = new TimerCount(); using (progress = new FormProgress()) { //f.StartProgress(1, count); progress.SetMessage("Loading objects"); progress.Show(this); progress.Update(); try { tc.Next("NodeDatabase"); if (nodeDb == null) { nodeDb = new NodeDatabase(ci.Text); nodeDb.Fill(db); trv.Nodes.Add(nodeDb); trv.HandleMultiSelection = true; tc.Next("ExpandAllForce"); trv.ExpandAllForce(db); } tc.Next("DataToView"); DataToView(); tc.Next("LoadGrid"); LoadGrid(db); tc.Next("nodeDb.Expand()"); nodeDb.Expand(); if (selectFirst) { bool isSelected = false; int count = 0; var nodeTables = GetNode <NodeTables>(); foreach (NodeBase node in nodeTables.Nodes) { count++; if (node.Checked) { isSelected = true; trv.SelectedNode = node; node.EnsureVisible(); break; } } if (!isSelected) { var nodeViews = GetNode <NodeViews>(); foreach (NodeBase node in nodeViews.Nodes) { count++; if (node.Checked) { trv.SelectedNode = node; node.EnsureVisible(); break; } } } if (count <= 15) { trv.TopNode = nodeDb; } } //nodeDb.Checked = false; //nodeDb.UncheckChildren(); //nodeDb.Checked = false; time = tc.ToString(); } catch (Exception ex) { time = tc.ToString(); Program.ShowError(ex); } } //ControlUtil.ChangeFontOnlyParent(tabObjects, 12); isLoading = false; #if DEBUG2 if (db.ProviderType == EnumDbProviderType.Oracle) { Program.ShowInformation(time); } #endif }
public void Fill(Database db, ConnectionInfo ci) { isLoading = true; trv.Nodes.Clear(); string time; var tc = new TimerCount(); file.Parameters.Tables.ForEach(p => p.IsSelected = false); file.Parameters.Views.ForEach(p => p.IsSelected = false); using (progress = new FormProgress()) { //f.StartProgress(1, count); progress.SetMessage("Loading objects"); progress.Show(this); progress.Update(); try { tc.Next("NodeDatabase"); nodeDb = new NodeDatabase(ci.Text); nodeDb.Fill(db); trv.Nodes.Add(nodeDb); trv.HandleMultiSelection = true; tc.Next("ExpandAllForce"); trv.ExpandAllForce(db); tc.Next("DataToView"); DataToView(); tc.Next("LoadGrid"); LoadGrid(db); tc.Next("nodeDb.Expand()"); nodeDb.Expand(); nodeDb.Checked = false; nodeDb.UncheckChildren(); nodeDb.Checked = false; time = tc.ToString(); } catch (Exception ex) { time = tc.ToString(); Program.ShowError(ex); } } //ControlUtil.ChangeFontOnlyParent(tabObjects, 12); isLoading = false; #if DEBUG2 if (db.ProviderType == EnumDbProviderType.Oracle) { Program.ShowInformation(time); } #endif }