private async void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { TabPage tabPage = this.tabControl1.SelectedTab; if (tabPage == null) { return; } Table table = new Table() { Owner = this.cboOwner.Text, Name = this.txtTableName.Text.Trim() }; DbInterpreter dbInterpreter = this.GetDbInterpreter(); if (tabPage.Name == this.tabIndexes.Name) { tabPage.Tag = 1; this.ucIndexes.Table = table; if (!this.ucIndexes.Inited) { this.ucIndexes.InitControls(dbInterpreter); } if (!this.displayInfo.IsNew) { if (!this.ucIndexes.LoadedData) { SchemaInfoFilter filter = new SchemaInfoFilter(); filter.TableNames = new string[] { this.displayInfo.Name }; List <TableIndex> tableIndexes = await dbInterpreter.GetTableIndexesAsync(filter, true); this.ucIndexes.LoadIndexes(IndexManager.GetIndexDesignerInfos(this.displayInfo.DatabaseType, tableIndexes)); } } IEnumerable <TableColumnDesingerInfo> columns = this.ucColumns.GetColumns().Where(item => !string.IsNullOrEmpty(item.Name) && item.IsPrimary); this.ucIndexes.LoadPrimaryKeys(columns); } else if (tabPage.Name == this.tabForeignKeys.Name) { tabPage.Tag = 1; this.ucForeignKeys.Table = table; if (!this.ucForeignKeys.Inited) { dbInterpreter.Option.ObjectFetchMode = DatabaseObjectFetchMode.Simple; List <Table> tables = await dbInterpreter.GetTablesAsync(); if (this.displayInfo.IsNew) { tables.Add(new Table() { Name = "<self>" }); } this.ucForeignKeys.InitControls(tables); } if (!this.displayInfo.IsNew) { if (!this.ucForeignKeys.LoadedData) { SchemaInfoFilter filter = new SchemaInfoFilter(); filter.TableNames = new string[] { this.displayInfo.Name }; dbInterpreter.Option.ObjectFetchMode = DatabaseObjectFetchMode.Details; List <TableForeignKey> foreignKeys = await dbInterpreter.GetTableForeignKeysAsync(filter); this.ucForeignKeys.LoadForeignKeys(IndexManager.GetForeignKeyDesignerInfos(foreignKeys)); } } } else if (tabPage.Name == this.tabConstraints.Name) { tabPage.Tag = 1; if (!this.ucConstraints.Inited) { this.ucConstraints.InitControls(); } if (!this.displayInfo.IsNew) { if (!this.ucConstraints.LoadedData) { SchemaInfoFilter filter = new SchemaInfoFilter(); filter.TableNames = new string[] { this.displayInfo.Name }; List <TableConstraint> constraints = await dbInterpreter.GetTableConstraintsAsync(filter); this.ucConstraints.LoadConstraints(IndexManager.GetConstraintDesignerInfos(constraints)); } } } }