Imports DevExpress.XtraBars.Ribbon Imports DevExpress.XtraRichEdit.API.Native Imports DevExpress.XtraRichEdit.Services Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Patterns Public Class frmSQLEditor Private Patterns As ClassPatterns Private LogConfig As LogConfig Private Database As MSSQLServer Public Enum PlaceholderCollection Globix Zooflow End Enum Public Sub SetPlaceholders() End Sub Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. LogConfig = pLogConfig End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Patterns = New ClassPatterns(LogConfig) Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Gruppe 1"} Dim oGroup2 = New GalleryItemGroup() With {.Caption = "Gruppe 2"} Dim oGroup3 = New GalleryItemGroup() With {.Caption = "Gruppe 3"} Dim oItems As New List(Of GalleryItem)() From { GetGalleryItem(New Placeholder("StringValue1", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue1")), GetGalleryItem(New Placeholder("StringValue2", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue2")), GetGalleryItem(New Placeholder("StringValue3", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue3")), GetGalleryItem(New Placeholder("StringValue4", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue4")), GetGalleryItem(New Placeholder("StringValue5", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue5")) } oGroup1.Items.AddRange(oItems.ToArray) oGroup2.Items.AddRange(oItems.ToArray) oGroup3.Items.AddRange(oItems.ToArray) RibbonGalleryBarItem1.Gallery.Groups.AddRange(New List(Of GalleryItemGroup)() From {oGroup1, oGroup2, oGroup3}.ToArray) RichEditControl1.Options.Search.RegExResultMaxGuaranteedLength = 500 RichEditControl1.ReplaceService(Of ISyntaxHighlightService)(New SQLSyntaxHighlightService(RichEditControl1.Document)) RichEditControl1.ActiveViewType = DevExpress.XtraRichEdit.RichEditViewType.Draft RichEditControl1.Document.Sections(0).Page.Width = DevExpress.Office.Utils.Units.InchesToDocumentsF(80.0F) RichEditControl1.Document.DefaultCharacterProperties.FontName = "Courier New" RichEditControl1.Document.DefaultCharacterProperties.FontSize = 12 End Sub Private Sub RibbonGalleryBarItem1_GalleryItemClick(sender As Object, e As GalleryItemClickEventArgs) Handles RibbonGalleryBarItem1.GalleryItemClick Dim oPlaceholder As Placeholder = e.Item.Tag MsgBox(oPlaceholder.Name) Dim pPosition = RichEditControl1.Document.CaretPosition RichEditControl1.Document.InsertSingleLineText(pPosition, oPlaceholder.Value) End Sub Private Class Placeholder Public Type As PlaceholderType Public Name As String Public Description As String Public Value As String Public Enum PlaceholderType FileFlow End Enum Public Sub New(pName As String, pDescription As String, pType As PlaceholderType, pValue As String) Name = pName Description = pDescription Type = pType Value = pValue End Sub End Class Private Function GetGalleryItem(pPlaceholder As Placeholder) As GalleryItem Return New GalleryItem(Nothing, pPlaceholder.Name, pPlaceholder.Description) With { .Tag = pPlaceholder } End Function Private Sub RichEditControl1_ContentChanged(sender As Object, e As EventArgs) Handles RichEditControl1.ContentChanged Dim oSqlText = RichEditControl1.Document.Text Dim oPatterns = Patterns.GetAllPatterns(oSqlText) End Sub Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click End Sub End Class