diff --git a/Controls.SQLEditor/My Project/Resources.Designer.vb b/Controls.SQLEditor/My Project/Resources.Designer.vb index 7c8f1584..780b95e9 100644 --- a/Controls.SQLEditor/My Project/Resources.Designer.vb +++ b/Controls.SQLEditor/My Project/Resources.Designer.vb @@ -170,6 +170,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property editdatasource2() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("editdatasource2", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. ''' @@ -200,6 +210,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property togglefieldcodes() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("togglefieldcodes", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. ''' diff --git a/Controls.SQLEditor/My Project/Resources.resx b/Controls.SQLEditor/My Project/Resources.resx index f30ca6ae..1bd97810 100644 --- a/Controls.SQLEditor/My Project/Resources.resx +++ b/Controls.SQLEditor/My Project/Resources.resx @@ -139,18 +139,24 @@ ..\Resources\highimportance.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_database.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\cleartablestyle.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\electronics_desktopmac.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\editdatasource2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\clearall.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\actions_database2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\actions_database.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\updatedataextract1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -169,7 +175,7 @@ ..\Resources\actions_database1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\cleartablestyle.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\togglefieldcodes.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a \ No newline at end of file diff --git a/Controls.SQLEditor/Resources/editdatasource2.svg b/Controls.SQLEditor/Resources/editdatasource2.svg new file mode 100644 index 00000000..6e46621c --- /dev/null +++ b/Controls.SQLEditor/Resources/editdatasource2.svg @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/Controls.SQLEditor/Resources/togglefieldcodes.svg b/Controls.SQLEditor/Resources/togglefieldcodes.svg new file mode 100644 index 00000000..31917a1e --- /dev/null +++ b/Controls.SQLEditor/Resources/togglefieldcodes.svg @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/Controls.SQLEditor/SQLEditor.vbproj b/Controls.SQLEditor/SQLEditor.vbproj index a66ced1a..3551da63 100644 --- a/Controls.SQLEditor/SQLEditor.vbproj +++ b/Controls.SQLEditor/SQLEditor.vbproj @@ -249,5 +249,11 @@ + + + + + + \ No newline at end of file diff --git a/Controls.SQLEditor/frmSQLEditor.Designer.vb b/Controls.SQLEditor/frmSQLEditor.Designer.vb index 428abeb2..20e84532 100644 --- a/Controls.SQLEditor/frmSQLEditor.Designer.vb +++ b/Controls.SQLEditor/frmSQLEditor.Designer.vb @@ -24,21 +24,22 @@ Partial Class frmSQLEditor Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() - Me.RibbonGalleryBarItem1 = New DevExpress.XtraBars.RibbonGalleryBarItem() + Me.GalleryPlaceholders = New DevExpress.XtraBars.RibbonGalleryBarItem() Me.SvgImageCollection1 = New DevExpress.Utils.SvgImageCollection(Me.components) Me.btnEditConnections = New DevExpress.XtraBars.BarButtonItem() Me.btnSave = New DevExpress.XtraBars.BarButtonItem() Me.btnExecuteSQL = New DevExpress.XtraBars.BarButtonItem() - Me.RibbonGalleryBarItem2 = New DevExpress.XtraBars.RibbonGalleryBarItem() + Me.GalleryConnection = New DevExpress.XtraBars.RibbonGalleryBarItem() Me.chkClearPlaceholders = New DevExpress.XtraBars.BarCheckItem() Me.btnClearPlaceholders = New DevExpress.XtraBars.BarButtonItem() + Me.chkShowPlaceholders = New DevExpress.XtraBars.BarCheckItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage() - Me.RichEditControl1 = New DevExpress.XtraRichEdit.RichEditControl() + Me.txtSQLCommand = New DevExpress.XtraRichEdit.RichEditControl() Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.GridPlaceholders = New DevExpress.XtraGrid.GridControl() Me.ViewPlaceholders = New DevExpress.XtraGrid.Views.Grid.GridView() @@ -59,25 +60,26 @@ Partial Class frmSQLEditor 'RibbonControl1 ' Me.RibbonControl1.ExpandCollapseItem.Id = 0 - Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.RibbonGalleryBarItem1, Me.btnEditConnections, Me.btnSave, Me.btnExecuteSQL, Me.RibbonGalleryBarItem2, Me.chkClearPlaceholders, Me.btnClearPlaceholders}) + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.GalleryPlaceholders, Me.btnEditConnections, Me.btnSave, Me.btnExecuteSQL, Me.GalleryConnection, Me.chkClearPlaceholders, Me.btnClearPlaceholders, Me.chkShowPlaceholders}) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl1.MaxItemId = 11 + Me.RibbonControl1.MaxItemId = 13 Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) + Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False] Me.RibbonControl1.Size = New System.Drawing.Size(1056, 158) Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1 ' - 'RibbonGalleryBarItem1 + 'GalleryPlaceholders ' - Me.RibbonGalleryBarItem1.Caption = "RibbonGalleryBarItem1" + Me.GalleryPlaceholders.Caption = "RibbonGalleryBarItem1" ' ' ' - Me.RibbonGalleryBarItem1.Gallery.Images = Me.SvgImageCollection1 - Me.RibbonGalleryBarItem1.Gallery.ShowGroupCaption = True - Me.RibbonGalleryBarItem1.Gallery.ShowItemText = True - Me.RibbonGalleryBarItem1.Id = 1 - Me.RibbonGalleryBarItem1.Name = "RibbonGalleryBarItem1" + Me.GalleryPlaceholders.Gallery.Images = Me.SvgImageCollection1 + Me.GalleryPlaceholders.Gallery.ShowGroupCaption = True + Me.GalleryPlaceholders.Gallery.ShowItemText = True + Me.GalleryPlaceholders.Id = 1 + Me.GalleryPlaceholders.Name = "GalleryPlaceholders" ' 'SvgImageCollection1 ' @@ -104,17 +106,17 @@ Partial Class frmSQLEditor Me.btnExecuteSQL.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.updatedataextract3 Me.btnExecuteSQL.Name = "btnExecuteSQL" ' - 'RibbonGalleryBarItem2 + 'GalleryConnection ' - Me.RibbonGalleryBarItem2.Caption = "RibbonGalleryBarItem2" + Me.GalleryConnection.Caption = "RibbonGalleryBarItem2" ' ' ' - Me.RibbonGalleryBarItem2.Gallery.CheckDrawMode = DevExpress.XtraBars.Ribbon.Gallery.CheckDrawMode.ImageAndText - Me.RibbonGalleryBarItem2.Gallery.ItemCheckMode = DevExpress.XtraBars.Ribbon.Gallery.ItemCheckMode.SingleRadio - Me.RibbonGalleryBarItem2.Gallery.ShowItemText = True - Me.RibbonGalleryBarItem2.Id = 5 - Me.RibbonGalleryBarItem2.Name = "RibbonGalleryBarItem2" + Me.GalleryConnection.Gallery.CheckDrawMode = DevExpress.XtraBars.Ribbon.Gallery.CheckDrawMode.ImageAndText + Me.GalleryConnection.Gallery.ItemCheckMode = DevExpress.XtraBars.Ribbon.Gallery.ItemCheckMode.SingleRadio + Me.GalleryConnection.Gallery.ShowItemText = True + Me.GalleryConnection.Id = 5 + Me.GalleryConnection.Name = "GalleryConnection" ' 'chkClearPlaceholders ' @@ -130,6 +132,15 @@ Partial Class frmSQLEditor Me.btnClearPlaceholders.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.clearall Me.btnClearPlaceholders.Name = "btnClearPlaceholders" ' + 'chkShowPlaceholders + ' + Me.chkShowPlaceholders.BindableChecked = True + Me.chkShowPlaceholders.Caption = "Platzhalter anzeigen" + Me.chkShowPlaceholders.Checked = True + Me.chkShowPlaceholders.Id = 12 + Me.chkShowPlaceholders.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.togglefieldcodes + Me.chkShowPlaceholders.Name = "chkShowPlaceholders" + ' 'RibbonPage1 ' Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup3, Me.RibbonPageGroup4, Me.RibbonPageGroup1}) @@ -147,13 +158,14 @@ Partial Class frmSQLEditor ' Me.RibbonPageGroup4.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far Me.RibbonPageGroup4.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.actions_database2 - Me.RibbonPageGroup4.ItemLinks.Add(Me.RibbonGalleryBarItem2) + Me.RibbonPageGroup4.ItemLinks.Add(Me.GalleryConnection) Me.RibbonPageGroup4.Name = "RibbonPageGroup4" Me.RibbonPageGroup4.Text = "Verbindungen" ' 'RibbonPageGroup1 ' - Me.RibbonPageGroup1.ItemLinks.Add(Me.RibbonGalleryBarItem1) + Me.RibbonPageGroup1.ItemLinks.Add(Me.GalleryPlaceholders) + Me.RibbonPageGroup1.ItemLinks.Add(Me.chkShowPlaceholders) Me.RibbonPageGroup1.ItemLinks.Add(Me.chkClearPlaceholders) Me.RibbonPageGroup1.ItemLinks.Add(Me.btnClearPlaceholders) Me.RibbonPageGroup1.Name = "RibbonPageGroup1" @@ -171,24 +183,25 @@ Partial Class frmSQLEditor Me.RibbonPage2.Name = "RibbonPage2" Me.RibbonPage2.Text = "RibbonPage2" ' - 'RichEditControl1 + 'txtSQLCommand ' - Me.RichEditControl1.Dock = System.Windows.Forms.DockStyle.Fill - Me.RichEditControl1.Location = New System.Drawing.Point(0, 0) - Me.RichEditControl1.MenuManager = Me.RibbonControl1 - Me.RichEditControl1.Name = "RichEditControl1" - Me.RichEditControl1.Size = New System.Drawing.Size(737, 508) - Me.RichEditControl1.TabIndex = 2 + Me.txtSQLCommand.Dock = System.Windows.Forms.DockStyle.Fill + Me.txtSQLCommand.Location = New System.Drawing.Point(0, 0) + Me.txtSQLCommand.MenuManager = Me.RibbonControl1 + Me.txtSQLCommand.Name = "txtSQLCommand" + Me.txtSQLCommand.Size = New System.Drawing.Size(802, 508) + Me.txtSQLCommand.TabIndex = 2 ' 'SplitContainerControl1 ' + Me.SplitContainerControl1.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2 Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 158) Me.SplitContainerControl1.Name = "SplitContainerControl1" ' 'SplitContainerControl1.Panel1 ' - Me.SplitContainerControl1.Panel1.Controls.Add(Me.RichEditControl1) + Me.SplitContainerControl1.Panel1.Controls.Add(Me.txtSQLCommand) Me.SplitContainerControl1.Panel1.Text = "Panel1" ' 'SplitContainerControl1.Panel2 @@ -196,7 +209,7 @@ Partial Class frmSQLEditor Me.SplitContainerControl1.Panel2.Controls.Add(Me.GridPlaceholders) Me.SplitContainerControl1.Panel2.Text = "Panel2" Me.SplitContainerControl1.Size = New System.Drawing.Size(1056, 508) - Me.SplitContainerControl1.SplitterPosition = 737 + Me.SplitContainerControl1.SplitterPosition = 802 Me.SplitContainerControl1.TabIndex = 4 ' 'GridPlaceholders @@ -206,7 +219,7 @@ Partial Class frmSQLEditor Me.GridPlaceholders.MainView = Me.ViewPlaceholders Me.GridPlaceholders.MenuManager = Me.RibbonControl1 Me.GridPlaceholders.Name = "GridPlaceholders" - Me.GridPlaceholders.Size = New System.Drawing.Size(309, 508) + Me.GridPlaceholders.Size = New System.Drawing.Size(244, 508) Me.GridPlaceholders.TabIndex = 0 Me.GridPlaceholders.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ViewPlaceholders}) ' @@ -242,10 +255,11 @@ Partial Class frmSQLEditor Me.Controls.Add(Me.SplitContainerControl1) Me.Controls.Add(Me.RibbonStatusBar1) Me.Controls.Add(Me.RibbonControl1) + Me.IconOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.editdatasource2 Me.Name = "frmSQLEditor" Me.Ribbon = Me.RibbonControl1 Me.StatusBar = Me.RibbonStatusBar1 - Me.Text = "SQL Connector" + Me.Text = "SQL Designer" CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SvgImageCollection1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SplitContainerControl1.Panel1, System.ComponentModel.ISupportInitialize).EndInit() @@ -266,9 +280,9 @@ Partial Class frmSQLEditor Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar Friend WithEvents RibbonPage2 As DevExpress.XtraBars.Ribbon.RibbonPage - Friend WithEvents RibbonGalleryBarItem1 As DevExpress.XtraBars.RibbonGalleryBarItem + Friend WithEvents GalleryPlaceholders As DevExpress.XtraBars.RibbonGalleryBarItem Friend WithEvents SvgImageCollection1 As DevExpress.Utils.SvgImageCollection - Friend WithEvents RichEditControl1 As DevExpress.XtraRichEdit.RichEditControl + Friend WithEvents txtSQLCommand As DevExpress.XtraRichEdit.RichEditControl Friend WithEvents SplitContainerControl1 As DevExpress.XtraEditors.SplitContainerControl Friend WithEvents GridPlaceholders As DevExpress.XtraGrid.GridControl Friend WithEvents ViewPlaceholders As DevExpress.XtraGrid.Views.Grid.GridView @@ -278,8 +292,9 @@ Partial Class frmSQLEditor Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents colPattern As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents colValue As DevExpress.XtraGrid.Columns.GridColumn - Friend WithEvents RibbonGalleryBarItem2 As DevExpress.XtraBars.RibbonGalleryBarItem + Friend WithEvents GalleryConnection As DevExpress.XtraBars.RibbonGalleryBarItem Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents chkClearPlaceholders As DevExpress.XtraBars.BarCheckItem Friend WithEvents btnClearPlaceholders As DevExpress.XtraBars.BarButtonItem + Friend WithEvents chkShowPlaceholders As DevExpress.XtraBars.BarCheckItem End Class diff --git a/Controls.SQLEditor/frmSQLEditor.vb b/Controls.SQLEditor/frmSQLEditor.vb index a23ed4d2..57f4c008 100644 --- a/Controls.SQLEditor/frmSQLEditor.vb +++ b/Controls.SQLEditor/frmSQLEditor.vb @@ -15,6 +15,9 @@ Public Class frmSQLEditor Private ClearPlaceholdersAfterSuccessfulExecute As Boolean = False Private FormLoading As Boolean = False + Public Property SQLCommand As String = "" + Public Property SQLConnection As Integer = 0 + Public Enum PlaceholderCollection Globix Zooflow @@ -38,11 +41,29 @@ Public Class frmSQLEditor Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load FormLoading = True Try - Dim oConnectionGroups = LoadConnections() - RibbonGalleryBarItem2.Gallery.Groups.AddRange(oConnectionGroups.ToArray) + If SQLCommand <> String.Empty Then + txtSQLCommand.Document.Text = SQLCommand + End If + + Dim oConnectionGroup = LoadConnections() + Dim oSelectedItem = Nothing + + If SQLConnection > 0 Then + For Each oItem As GalleryItem In oConnectionGroup.Items + Dim oConnection = oItem.Tag + If SQLConnection = oConnection.id Then + oSelectedItem = oItem + End If + Next + End If + + GalleryConnection.Gallery.Groups.Add(oConnectionGroup) + GalleryConnection.Gallery.SetItemCheck(oSelectedItem, True) Dim oPlaceholderGroups = LoadPlaceholders() - RibbonGalleryBarItem1.Gallery.Groups.AddRange(oPlaceholderGroups.ToArray) + GalleryPlaceholders.Gallery.Groups.AddRange(oPlaceholderGroups.ToArray) + + ConfigureRichEditControl() @@ -54,12 +75,19 @@ Public Class frmSQLEditor End Sub - Private Sub RibbonGalleryBarItem1_GalleryItemClick(sender As Object, e As GalleryItemClickEventArgs) Handles RibbonGalleryBarItem1.GalleryItemClick + Private Sub RibbonGalleryBarItem1_GalleryItemClick(sender As Object, e As GalleryItemClickEventArgs) Handles GalleryPlaceholders.GalleryItemClick Dim oPlaceholder As Placeholder = e.Item.Tag - Dim pPosition = RichEditControl1.Document.CaretPosition - RichEditControl1.Document.InsertSingleLineText(pPosition, Patterns.WrapPatternValue(oPlaceholder.Module, oPlaceholder.Name)) + Dim pPosition = txtSQLCommand.Document.CaretPosition + txtSQLCommand.Document.InsertSingleLineText(pPosition, Patterns.WrapPatternValue(oPlaceholder.Module, oPlaceholder.Name)) End Sub + Private Sub RibbonGalleryBarItem2_GalleryItemClick(sender As Object, e As GalleryItemClickEventArgs) Handles GalleryConnection.GalleryItemClick + Dim oConnection As Connection = e.Item.Tag + SQLConnection = oConnection.Id + End Sub + + + Private Function LoadPlaceholders() As List(Of GalleryItemGroup) Dim oInternalPlaceholders = Placeholders.GetInternalGroup() Dim oUserPlaceholder = Placeholders.GetUserGroup() @@ -70,7 +98,7 @@ Public Class frmSQLEditor } End Function - Private Function LoadConnections() As List(Of GalleryItemGroup) + Private Function LoadConnections() As GalleryItemGroup Try Dim oSql = "SELECT GUID, Bezeichnung FROM [DD_ECM].[dbo].[TBDD_CONNECTION] WHERE AKTIV = 1" Dim oTable = Database.GetDatatable(oSql) @@ -82,28 +110,27 @@ Public Class frmSQLEditor .Name = oRow.Item("Bezeichnung")}) Next - Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Verbindungen"} + Dim oConnectionGroup = New GalleryItemGroup() With {.Caption = "Verbindungen"} Dim oItems As New List(Of GalleryItem) For Each oConnection In oConnections oItems.Add(GetGalleryItem(oConnection)) Next - oGroup1.Items.AddRange(oItems.ToArray) - Dim oConnectionGroups = New List(Of GalleryItemGroup)() From {oGroup1} + oConnectionGroup.Items.AddRange(oItems.ToArray) - Return oConnectionGroups + Return oConnectionGroup Catch ex As Exception Return Nothing End Try End Function Private Sub ConfigureRichEditControl() - RichEditControl1.Options.Search.RegExResultMaxGuaranteedLength = 500 - RichEditControl1.ReplaceService(Of ISyntaxHighlightService)(New SQLSyntaxHighlightService(RichEditControl1.Document)) - RichEditControl1.ActiveViewType = DevExpress.XtraRichEdit.RichEditViewType.Simple - RichEditControl1.Document.Sections(0).Page.Width = DevExpress.Office.Utils.Units.InchesToDocumentsF(80.0F) + txtSQLCommand.Options.Search.RegExResultMaxGuaranteedLength = 500 + txtSQLCommand.ReplaceService(Of ISyntaxHighlightService)(New SQLSyntaxHighlightService(txtSQLCommand.Document)) + txtSQLCommand.ActiveViewType = DevExpress.XtraRichEdit.RichEditViewType.Simple + txtSQLCommand.Document.Sections(0).Page.Width = DevExpress.Office.Utils.Units.InchesToDocumentsF(80.0F) - RichEditControl1.Document.DefaultCharacterProperties.FontName = "Courier New" - RichEditControl1.Document.DefaultCharacterProperties.FontSize = 12 + txtSQLCommand.Document.DefaultCharacterProperties.FontName = "Courier New" + txtSQLCommand.Document.DefaultCharacterProperties.FontSize = 12 End Sub @@ -123,30 +150,27 @@ Public Class frmSQLEditor Private Property LastPatterns As New List(Of Pattern) - Private Sub RichEditControl1_ContentChanged(sender As Object, e As EventArgs) Handles RichEditControl1.ContentChanged - Dim oSqlText = RichEditControl1.Document.Text + Private Sub RichEditControl1_ContentChanged(sender As Object, e As EventArgs) Handles txtSQLCommand.ContentChanged + Dim oSqlText = txtSQLCommand.Document.Text Dim oPatterns = Patterns.GetAllPatterns(oSqlText) If oPatterns.Count = 0 Then - Exit Sub + GridPlaceholders.DataSource = New List(Of Placeholder) + ElseIf oPatterns.Count.Equals(LastPatterns.Count) Then + ' noop + Else + Dim oPlaceholders = oPatterns. + Select(Function(pattern) New Placeholder(pattern.Value, pattern.Value, pattern.Type, pattern.Value) With {.Pattern = pattern}). + ToList() + GridPlaceholders.DataSource = oPlaceholders End If - If oPatterns.SequenceEqual(LastPatterns) Then - Exit Sub - End If - - GridPlaceholders.DataSource = oPatterns.Select(Function(pattern) - Return New Placeholder(pattern.Value, pattern.Value, pattern.Type, pattern.Value) With {.Pattern = pattern} - End Function).ToList() - - LastPatterns = oPatterns - End Sub - Private Async Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnExecuteSQL.ItemClick + Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnExecuteSQL.ItemClick Try - Dim oSql = RichEditControl1.Document.Text + Dim oSql = txtSQLCommand.Document.Text Dim oPlaceholders As List(Of Placeholder) = GridPlaceholders.DataSource @@ -163,7 +187,16 @@ Public Class frmSQLEditor Next End If - Dim oDatatable = Await Database.GetDatatableAsync(oSql) + Dim oDatatable As DataTable + + If SQLConnection > 0 Then + Dim oConnectionString = Database.GetConnectionStringForId(SQLConnection) + oDatatable = Database.GetDatatableWithConnection(oSql, oConnectionString) + Else + oDatatable = Database.GetDatatable(oSql) + End If + + Dim oForm As New frmSQLResult(oDatatable) oForm.Show() @@ -189,4 +222,8 @@ Public Class frmSQLEditor Private Sub btnClearPlaceholders_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnClearPlaceholders.ItemClick ClearPlaceholders() End Sub + + Private Sub chkShowPlaceholders_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles chkShowPlaceholders.CheckedChanged + SplitContainerControl1.Collapsed = Not chkShowPlaceholders.Checked + End Sub End Class diff --git a/GUIs.Test.TestGUI/frmStart.vb b/GUIs.Test.TestGUI/frmStart.vb index 6dd134be..7af85fd6 100644 --- a/GUIs.Test.TestGUI/frmStart.vb +++ b/GUIs.Test.TestGUI/frmStart.vb @@ -47,7 +47,10 @@ Public Class frmStart End Sub Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click - Dim oForm As New frmSQLEditor(LogConfig, Database) + Dim oForm As New frmSQLEditor(LogConfig, Database) With { + .SQLCommand = "SELECT * FROM TBDD_USER WHERE EMAIL = '{#USER#EMAIL}'", + .SQLConnection = 1 + } oForm.Show() End Sub