private void DisplaySelectedTable(string tableName, int upperLimit) { QueryView query = new QueryView(); query._editor.Text = "SELECT * FROM " + tableName; if (upperLimit > 0) query._editor.Text = query._editor.Text + " LIMIT 0, " + upperLimit.ToString(); CloseableTabItem tab = new CloseableTabItem(); tab.Content = query; tab.Header = "Query"; tab.CloseTab += delegate { SqlQueryTabControl.Items.Remove(tab); }; DataTable data = ((Application.Current as IPluginContainer).GetPlugin<DataAccessPlugin>() as DataAccessPlugin).GetDataTable(query._editor.Text); query._dataGrid.DataContext = data.DefaultView; SqlQueryTabControl.Items.Add(tab); tab.Focus(); }
private void doNewQuery(object sender, RoutedEventArgs e) { QueryView query = new QueryView(); CloseableTabItem tab = new CloseableTabItem(); tab.Content = query; tab.Header = "Query"; tab.CloseTab += doCloseTab; _tabControl.Items.Add(tab); tab.Focus(); }