private void ExecuteQueryThreaded(IPooledDbConnection connection, DataSet result, object state) { connection.Release(); TimeSpan duration = DateTime.Now.Subtract(queryStart); DispatchService.GuiDispatch(delegate() { notebook.ShowAll(); string msg = String.Concat( AddinCatalog.GetPluralString("Query executed ({0} result table)", "Query executed ({0} result tables)", result.Tables.Count), Environment.NewLine, AddinCatalog.GetString("Query duration: {0}", duration.ToString()) ); SetQueryState(false, String.Format(msg, result.Tables.Count)); }); if (stoppedQueries.Contains(state)) { stoppedQueries.Remove(state); return; } if (result != null) { foreach (DataTable table in result.Tables) { DispatchService.GuiDispatch(delegate() { MonoDevelop.Database.Components.DataGrid grid = new MonoDevelop.Database.Components.DataGrid(); grid.DataSource = table; grid.DataBind(); string msg = String.Concat(Environment.NewLine, AddinCatalog.GetString("Table"), ": ", table.TableName, Environment.NewLine, "\t", AddinCatalog.GetString("Affected Rows"), ": ", table.Rows.Count); status.Buffer.Text += msg; TabLabel label = new TabLabel(new Label(table.TableName), ImageService.GetImage("md-db-table", IconSize.Menu)); label.CloseClicked += new EventHandler(OnResultTabClose); notebook.AppendPage(grid, label); notebook.ShowAll(); this.Document.ReadOnly = false; notebook.Page = notebook.NPages - 1; }); } } if (result == null || result.Tables.Count == 0) { DispatchService.GuiDispatch(delegate() { status.Buffer.Text += AddinCatalog.GetString("No Results"); this.Document.ReadOnly = false; }); } }
public DataGridColumn (DataGrid grid, DataColumn column, int columnIndex) { this.grid = grid; this.column = column; this.columnIndex = columnIndex; contentRenderer = grid.GetDataGridContentRenderer (column.DataType); Title = column.ColumnName.Replace ("_", "__"); //underscores are normally used for underlining, so needs escape char Clickable = true; CellRendererText textRenderer = new CellRendererText (); PackStart (textRenderer, true); SetCellDataFunc (textRenderer, new CellLayoutDataFunc (ContentDataFunc)); }
private void ExecuteQueryThreaded (IPooledDbConnection connection, DataSet result, object state) { connection.Release (); TimeSpan duration = DateTime.Now.Subtract (queryStart); DispatchService.GuiDispatch (delegate () { notebook.ShowAll (); string msg = String.Concat ( AddinCatalog.GetPluralString ("Query executed ({0} result table)", "Query executed ({0} result tables)", result.Tables.Count), Environment.NewLine, AddinCatalog.GetString ("Query duration: {0}", duration.ToString ()) ); SetQueryState (false, String.Format (msg, result.Tables.Count)); }); if (stoppedQueries.Contains (state)) { stoppedQueries.Remove (state); return; } if (result != null) { foreach (DataTable table in result.Tables) { DispatchService.GuiDispatch (delegate () { MonoDevelop.Database.Components.DataGrid grid = new MonoDevelop.Database.Components.DataGrid (); grid.DataSource = table; grid.DataBind (); string msg = String.Concat (Environment.NewLine, AddinCatalog.GetString ("Table"), ": ",table.TableName, Environment.NewLine, "\t", AddinCatalog.GetString ("Affected Rows"), ": ", table.Rows.Count); status.Buffer.Text += msg; TabLabel label = new TabLabel (new Label (table.TableName), ImageService.GetImage ("md-db-table", IconSize.Menu)); label.CloseClicked += new EventHandler (OnResultTabClose); notebook.AppendPage (grid, label); notebook.ShowAll (); this.Document.ReadOnly = false; notebook.Page = notebook.NPages -1; }); } } if (result == null || result.Tables.Count == 0) { DispatchService.GuiDispatch (delegate () { status.Buffer.Text += AddinCatalog.GetString ("No Results"); this.Document.ReadOnly = false; }); } }
public QueryResultView () : base () { grid = new DataGrid (); grid.ShowAll (); }