private void BeforeNodeSelected(TreeNode node) { if (node != null) { if (node.Tag == null) { return; } NodeData data = node.Tag as NodeData; MetaObject obj = null; if (data.Type != NodeType.ESMETADATAENGINE) { obj = data.Meta as MetaObject; } if (data != null) { switch (data.Type) { case NodeType.COLUMNS: this.EditNiceNames(data.Meta as Columns); break; case NodeType.DATABASES: this.EditNiceNames(data.Meta as Databases); break; case NodeType.TABLES: case NodeType.SUBTABLES: this.EditNiceNames(data.Meta as Tables); break; case NodeType.VIEWS: case NodeType.SUBVIEWS: this.EditNiceNames(data.Meta as Views); break; case NodeType.FOREIGNKEYS: case NodeType.INDIRECTFOREIGNKEYS: this.EditNiceNames(data.Meta as ForeignKeys); break; case NodeType.PARAMETERS: this.EditNiceNames(data.Meta as Parameters); break; case NodeType.RESULTCOLUMNS: this.EditNiceNames(data.Meta as ResultColumns); break; case NodeType.INDEXES: this.EditNiceNames(data.Meta as Indexes); break; case NodeType.PROCEDURES: this.EditNiceNames(data.Meta as Procedures); break; case NodeType.DOMAINS: this.EditNiceNames(data.Meta as Domains); break; default: this.Grid.DataSource = null; break; } switch (data.Type) { case NodeType.DATABASE: { Database o = obj as Database; metadataProperties.DisplayDatabaseProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.COLUMN: { Column o = obj as Column; metadataProperties.DisplayColumnProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.TABLE: { Table o = obj as Table; metadataProperties.DisplayTableProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.VIEW: { EntitySpaces.MetadataEngine.View o = obj as EntitySpaces.MetadataEngine.View; metadataProperties.DisplayViewProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.PARAMETER: { Parameter o = obj as Parameter; metadataProperties.DisplayParameterProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.RESULTCOLUMN: { ResultColumn o = obj as ResultColumn; metadataProperties.DisplayResultColumnProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.FOREIGNKEY: { ForeignKey o = obj as ForeignKey; metadataProperties.DisplayForeignKeyProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.INDEX: { Index o = obj as Index; metadataProperties.DisplayIndexProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.PROCEDURE: { Procedure o = obj as Procedure; metadataProperties.DisplayProcedureProperties(o, node); this.EditSingle(o, o.Alias); } break; case NodeType.DOMAIN: { Domain o = obj as Domain; metadataProperties.DisplayDomainProperties(o, node); this.EditSingle(o, o.Alias); } break; default: metadataProperties.Clear(); break; } } } }
private void tree_BeforeExpand(object sender, TreeViewCancelEventArgs e) { Cursor cursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; NodeData data = (NodeData)e.Node.Tag; if (null != data) { switch (data.Type) { case NodeType.DATABASE: ExpandDatabase(data.Meta as IDatabase, e.Node); break; case NodeType.TABLES: case NodeType.SUBTABLES: ExpandTables(data.Meta as ITables, e.Node); break; case NodeType.TABLE: ExpandTable(data.Meta as ITable, e.Node); break; case NodeType.VIEWS: case NodeType.SUBVIEWS: ExpandViews(data.Meta as IViews, e.Node); break; case NodeType.VIEW: ExpandView(data.Meta as IView, e.Node); break; case NodeType.PROCEDURES: ExpandProcedures(data.Meta as IProcedures, e.Node); break; case NodeType.PROCEDURE: ExpandProcedure(data.Meta as IProcedure, e.Node); break; case NodeType.COLUMNS: case NodeType.PRIMARYKEYS: ExpandColumns(data.Meta as IColumns, e.Node); break; case NodeType.PARAMETERS: ExpandParameters(data.Meta as IParameters, e.Node); break; case NodeType.RESULTCOLUMNS: ExpandResultColumns(data.Meta as IResultColumns, e.Node); break; case NodeType.INDEXES: ExpandIndexes(data.Meta as IIndexes, e.Node); break; case NodeType.FOREIGNKEYS: this.ExpandForeignKeys(data.Meta as IForeignKeys, e.Node); break; case NodeType.DOMAINS: this.ExpandDomains(data.Meta as IDomains, e.Node); break; case NodeType.PROVIDERTYPES: //this.ExpandProviderTypes(data.Meta as IProviderTypes, e.Node); break; } } } catch (Exception ex) { this.MainWindow.ShowError(ex); } finally { Cursor.Current = cursor; } }