void objTree_MouseDoubleClick(object sender, EventArgs e) { if (objTree.treeViewObjects.ActiveNode != null && Convert.ToString(objTree.treeViewObjects.ActiveNode.Tag) == "proc") { try { //tabControlQueryEditors. var objectName = objTree.treeViewObjects.ActiveNode.Key; if (!tabControlQueryEditors.TabPages.ContainsKey("obj_" + objectName)) { var sql = "sp_helptext 'dbo." + objectName + "'"; var oDT = new Framework.Components.DataAccess.DBDataTable("Get List", sql, Database); var procText = new StringBuilder(); if (oDT.DBTable != null) { foreach (DataRow dr in oDT.DBTable.Rows) { procText.Append(Convert.ToString(dr["Text"])); } } var tabTitle = "dbo." + objectName; TabPageEx myTabPage = new TabPageEx(tabTitle); myTabPage.Name = "obj_" + objectName; myTabPage.UseVisualStyleBackColor = true; myTabPage.Menu = null; var txtProcText = new ScintillaNET.Scintilla(); txtProcText.ConfigurationManager.Language = "mssql"; txtProcText.ConfigurationManager.Configure(); if (ShowLineNumbers) { txtProcText.Margins[0].Width = 35; } else { txtProcText.Margins[0].Width = 0; } txtProcText.Text = procText.ToString(); txtProcText.Dock = DockStyle.Fill; txtProcText.AllowDrop = true; txtProcText.DragEnter += txtQueryEditor_DragEnter; txtProcText.BackColor = Color.FromName(LoadSettingsByKeyName("TextEditorBackgroundColor")); myTabPage.Controls.Add(txtProcText); tabControlQueryEditors.TabPages.Add(myTabPage); tabControlQueryEditors.SelectedTab = myTabPage; } else { tabControlQueryEditors.SelectedTab = tabControlQueryEditors.TabPages["obj_" + objectName]; } CheckAndCreateResult(); } catch { } } }
void objTree_ClassGenerated(object sender, EventArgs e) { try { var objectName = "GeneratedHelperClass"; if (!tabControlQueryEditors.TabPages.ContainsKey("obj_" + objectName)) { var procText = objTree.GeneratedHelperClass; var tabTitle = objectName; TabPageEx myTabPage = new TabPageEx(tabTitle); myTabPage.Name = "obj_" + objectName; myTabPage.Menu = null; myTabPage.UseVisualStyleBackColor = true; var txtProcText = new ScintillaNET.Scintilla(); txtProcText.ConfigurationManager.Language = "cs"; txtProcText.ConfigurationManager.Configure(); if (ShowLineNumbers) { txtProcText.Margins[0].Width = 35; } else { txtProcText.Margins[0].Width = 0; } txtProcText.Text = procText.ToString(); txtProcText.Dock = DockStyle.Fill; txtProcText.AllowDrop = true; txtProcText.DragEnter += txtQueryEditor_DragEnter; try { txtProcText.BackColor = Color.FromName(LoadSettingsByKeyName("TextEditorBackgroundColor")); } catch { txtProcText.BackColor = Color.FromName("White"); } myTabPage.Controls.Add(txtProcText); tabControlQueryEditors.TabPages.Add(myTabPage); tabControlQueryEditors.SelectedTab = myTabPage; } else { tabControlQueryEditors.SelectedTab = tabControlQueryEditors.TabPages["obj_" + objectName]; } objectName = "GeneratedClass"; if (!tabControlQueryEditors.TabPages.ContainsKey("obj_" + objectName)) { var procText = objTree.GeneratedClass; var tabTitle = objectName; TabPageEx myTabPage = new TabPageEx(tabTitle); myTabPage.Name = "obj_" + objectName; myTabPage.Menu = null; myTabPage.UseVisualStyleBackColor = true; var txtProcText = new ScintillaNET.Scintilla(); txtProcText.ConfigurationManager.Language = "cs"; txtProcText.ConfigurationManager.Configure(); if (ShowLineNumbers) { txtProcText.Margins[0].Width = 35; } else { txtProcText.Margins[0].Width = 0; } txtProcText.Text = procText.ToString(); txtProcText.Dock = DockStyle.Fill; txtProcText.AllowDrop = true; txtProcText.DragEnter += txtQueryEditor_DragEnter; try { txtProcText.BackColor = Color.FromName(LoadSettingsByKeyName("TextEditorBackgroundColor")); } catch { txtProcText.BackColor = Color.FromName("White"); } myTabPage.Controls.Add(txtProcText); tabControlQueryEditors.TabPages.Add(myTabPage); tabControlQueryEditors.SelectedTab = myTabPage; } else { tabControlQueryEditors.SelectedTab = tabControlQueryEditors.TabPages["obj_" + objectName]; } CheckAndCreateResult(); } catch { } }