public Window1(Control.ResultViewControl resultControl) { resultControlInit = resultControl; InitializeComponent(); CenterWindowOnScreen(); connectionString = ConfigurationManager.AppSettings["DefaultDBConn"]; //System.Configuration.ConfigurationSettings.AppSettings["FastDBConn"]; CurrentDatabaseName = ConfigurationManager.AppSettings["DefaultDatabase"]; connectionString = connectionString + "Database=" + CurrentDatabaseName + ";"; MainWindow m = new MainWindow(); try { List<Schema> schemas = MySQLData.DataAccess.ADODataBridge.getSchemaTree(connectionString, CurrentDatabaseName, ConfigurationManager.AppSettings["DerivedTablesPath"]);//DataAccess.GetDatabases(); MainViewModel viewModel = new MainViewModel(schemas); m.MainTreeView.DataContext = viewModel; listOfTable = new List<MySQLData.Table>(); foreach (Schema schema in schemas) { listOfTable.AddRange(schema.tables); } if (listOfTable != null) { } } catch (MySql.Data.MySqlClient.MySqlException ex) { if (isErrorLoggingOn) { LogError.Log_Err("MainWindow Constructor", ex); DisplayErrorMessage(); } } catch (Exception ex) { if (isErrorLoggingOn) { LogError.Log_Err("MainWindow Constructor", ex); DisplayErrorMessage(); } } var collView = CollectionViewSource.GetDefaultView(m.tabControlCustomQuery.Items); collView.CurrentChanging += this.OnTabItemSelecting; }
private void DoSimpleCommand(Object obj) { var columnPopup = new GridHeaderColumn(); MainWindow mainWindow = new MainWindow(); if (mainWindow.queryBuilder == null) { mainWindow.queryBuilder = MainWindow.LatestQueryBuilder; } string dbColumn = obj.ToString(); dbColumn = dbColumn.Trim(); dbColumn = dbColumn.Replace(" ", "_"); connectionString = ConfigurationManager.AppSettings["DefaultDBConn"]; DataTable dataTable = new DataTable(); DataSet columnds = new DataSet(); SQLBuilder.Clauses.Column column = new SQLBuilder.Clauses.Column(); column.Name = dbColumn; column.Format = ""; column.AliasName = ""; dataTable = MySQLData.DataAccess.ADODataBridge.getColumnStats(connectionString, mainWindow.queryBuilder, column); columnPopup.ColumnDataGrid.DataContext = dataTable; columnPopup.Show(); }