private void btnReflesh_Click(object sender, EventArgs e) { if (null == cbbProviders.SelectedItem) { MessageBox.Show( "Select Data Provider first!", frmMain._Name, MessageBoxButtons.OK, MessageBoxIcon.Warning ); return; } this.BackColor = SystemColors.ControlDark; lbxTables.Items.Clear(); clbColumns.Items.Clear(); DataSettings.Add( frmMain._Name, txtConnectionString.Text, cbbProviders.SelectedItem.ToString() ); DoneSchema = false; Task.Factory.StartNew(() => ReadSchema()); }
RefreshTask(object provider, string connectionString) { if (null == provider) { MessageBox.Show( "Select Data Provider first!", frmMain._Name, MessageBoxButtons.OK, MessageBoxIcon.Warning ); new Tuple < ISqlFormater, IQueryable <TableSchema>, IQueryable <ViewSchema>, IQueryable <PackageSchema> >(null, null, null, null); } DataSettings.Add( frmMain._Name, connectionString, provider.ToString() ); try { ISqlFormater formater; IQueryable <TableSchema> tableSchemas; IQueryable <ViewSchema> viewSchemas; IQueryable <PackageSchema> packageSchemas; using (var api = new EntityApi(_Name)) { formater = api.Formater; tableSchemas = api.Builder.TableSchemas; viewSchemas = api.Builder.ViewSchemas; packageSchemas = api.Builder.PackageSchemas; } return(new Tuple < ISqlFormater, IQueryable <TableSchema>, IQueryable <ViewSchema>, IQueryable <PackageSchema> >( formater, tableSchemas, viewSchemas, packageSchemas )); } catch (Exception ex) { MessageBox.Show( ex.Message, frmMain._Name, MessageBoxButtons.OK, MessageBoxIcon.Error ); return(new Tuple < ISqlFormater, IQueryable <TableSchema>, IQueryable <ViewSchema>, IQueryable <PackageSchema> >(null, null, null, null)); } }