Monorepo/Controls.SQLEditor/Placeholders.vb
2022-05-09 15:27:29 +02:00

102 lines
4.2 KiB
VB.net

Imports DevExpress.Utils.Svg
Imports DevExpress.XtraBars.Ribbon
Public Class Placeholders
Public Function GetInternalGroup() As GalleryItemGroup
Dim oModule = "INT"
Dim oImage = My.Resources.electronics_desktopmac
Dim oItems As New List(Of GalleryItem)() From {
GetGalleryItem(New Placeholder("USERNAME", "Benutzername", oModule, "USERNAME"), oImage),
GetGalleryItem(New Placeholder("MACHINE", "Aktuelles Datum", oModule, "MACHINE"), oImage),
GetGalleryItem(New Placeholder("DOMAIN", "Email-Adresse", oModule, "DOMAIN"), oImage),
GetGalleryItem(New Placeholder("DATE", "Vorname", oModule, "DATE"), oImage)
}
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Intern"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetManualPlaceholders() As GalleryItemGroup
Return GetManualPlaceholders(New List(Of String))
End Function
Public Function GetManualPlaceholders(pPlaceholders As List(Of String)) As GalleryItemGroup
Dim oImage = My.Resources.handtool
Dim oItems As New List(Of GalleryItem)()
If pPlaceholders.Count > 0 Then
For Each oManualPlaceholder In pPlaceholders
oItems.Add(GetGalleryItem(New Placeholder(oManualPlaceholder, "Manuelles Attribut", "ATTR_M", oManualPlaceholder), oImage))
Next
Else
oItems.Add(GetGalleryItem(New Placeholder("Attribut", "Manuelles Attribut", "ATTR_M", "ATTRIBUTE"), oImage))
End If
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Manuelle Attribute"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetAutomaticPlaceholders() As GalleryItemGroup
Return GetAutomaticPlaceholders(New List(Of String))
End Function
Public Function GetAutomaticPlaceholders(pPlaceholders As List(Of String)) As GalleryItemGroup
Dim oImage = My.Resources.autoarrange
Dim oItems As New List(Of GalleryItem)()
If pPlaceholders.Count > 0 Then
For Each oManualPlaceholder In pPlaceholders
oItems.Add(GetGalleryItem(New Placeholder(oManualPlaceholder, "Automatisches Attribut", "ATTR_A", oManualPlaceholder), oImage))
Next
Else
oItems.Add(GetGalleryItem(New Placeholder("Attribut", "Automatisches Attribut", "ATTR_A", "ATTRIBUTE"), oImage))
End If
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Automatisches Attribut"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetUserGroup() As GalleryItemGroup
Dim oModule = "USER"
Dim oImage = My.Resources.actions_user
Dim oItems As New List(Of GalleryItem)() From {
GetGalleryItem(New Placeholder("PRENAME", "Vorname", oModule, "PRENAME"), oImage),
GetGalleryItem(New Placeholder("SURNAME", "Nachname", oModule, "SURNAME"), oImage),
GetGalleryItem(New Placeholder("EMAIL", "Email-Adresse", oModule, "EMAIL"), oImage),
GetGalleryItem(New Placeholder("USER_ID", "Benutzer-ID", oModule, "USER_ID"), oImage),
GetGalleryItem(New Placeholder("PROFILE_ID", "Profil-ID", oModule, "PROFILE_ID"), oImage),
GetGalleryItem(New Placeholder("PROFILE_TITLE", "Profil-Name", oModule, "PROFILE_TITLE"), oImage),
GetGalleryItem(New Placeholder("LANGUAGE", "Sprache", oModule, "LANGUAGE"), oImage)
}
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Benutzer"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Private Function GetGalleryItem(pPlaceholder As Placeholder) As GalleryItem
Return New GalleryItem(Nothing, pPlaceholder.Title, pPlaceholder.Description) With {
.Tag = pPlaceholder
}
End Function
Private Function GetGalleryItem(pPlaceholder As Placeholder, pImage As SvgImage) As GalleryItem
Dim oItem = New GalleryItem(Nothing, pPlaceholder.Title, pPlaceholder.Description) With {
.Tag = pPlaceholder
}
oItem.ImageOptions.SvgImage = pImage
Return oItem
End Function
End Class