private void ScriptBtn_Click(object sender, EventArgs e) { var name = _manager.NewScript(); _manager.SetItemData(name, $"SELECT * FROM {_tableName.DoubleQuote()} LIMIT 1000"); _manager.OpenItem(new NotebookItem(NotebookItemType.Script, name)); }
private void List_ItemActivate(object sender, EventArgs e) { if (_list.SelectedItems.Count != 1) { return; } var lvi = _list.SelectedItems[0]; var type = (NotebookItemType)Enum.Parse(typeof(NotebookItemType), lvi.Group.Name); // can't open tables or views if an operation is in progress bool isTableOrView = type == NotebookItemType.Table || type == NotebookItemType.View; if (isTableOrView && _operationInProgress) { MessageForm.ShowError(_mainForm, "Open Item", "Cannot open tables or views while an operation is in progress.", "Please wait until the current operation finishes, and then try again."); return; } _manager.OpenItem(new NotebookItem(type, lvi.Text)); }