WIP: Config UI

This commit is contained in:
Jonathan Jenne
2019-07-22 16:02:18 +02:00
parent da579381ce
commit dfadc2b778
11 changed files with 1068 additions and 908 deletions

View File

@@ -25,41 +25,29 @@ Public Class frmProfileMatch
Sub CreateTiles()
Try
Dim oGroup = TileControl1.Groups.Item("TileGroupDocuments")
oGroup.Items.Clear()
Dim oDocumentGroup = TileControlMatch.Groups.Item("TileGroupDocuments")
Dim oDataGroup = TileControlMatch.Groups.Item("TileGroupData")
Dim oDataDocumentsGroup = TileControlMatch.Groups.Item("TileGroupDocumentsData")
oDocumentGroup.Items.Clear()
oDataGroup.Items.Clear()
For Each oProfile As ClassProfileFilter.ProfileData In CURRENT_MATCHING_PROFILES
Dim oItem As New TileItem() With {.Tag = oProfile.Guid}
oItem.Elements.Clear()
Dim oNameElement = New TileItemElement()
oNameElement.Text = oProfile.Name
oNameElement.TextAlignment = TileItemContentAlignment.TopLeft
oNameElement.Appearance.Normal.Font = PrimaryFont
oItem.Elements.Add(oNameElement)
Dim oCommentElement = New TileItemElement()
oCommentElement.Text = oProfile.Comment
oCommentElement.TextAlignment = TileItemContentAlignment.MiddleLeft
oCommentElement.Appearance.Normal.Font = SecondaryFont
oItem.Elements.Add(oCommentElement)
Dim oCountElement = New TileItemElement()
oCountElement.TextAlignment = TileItemContentAlignment.BottomRight
oCountElement.Appearance.Normal.Font = SecondaryFont
Dim oText As String
If oProfile.CountDocs = 99999 Then
oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
ElseIf oProfile.CountDocs = 99998 Then
oText = "DocCount (MatchCountConfig has not been configured)"
Else
oText = $"{oProfile.CountDocs} files!"
If oProfile.CountData > 0 And oProfile.CountDocs > 0 Then
Dim oCountText = oProfile.CountData + oProfile.CountDocs
Dim oItem = CreateTile(oProfile, $"{oCountText} Ergebnisse")
oDataDocumentsGroup.Items.Add(oItem)
End If
oCountElement.Text = oText
oItem.Elements.Add(oCountElement)
If oProfile.CountDocs > 0 Then
Dim oItem = CreateTile(oProfile, $"{oProfile.CountDocs} Dokumente")
oDocumentGroup.Items.Add(oItem)
End If
oGroup.Items.Add(oItem)
If oProfile.CountData > 0 Then
Dim oItem = CreateTile(oProfile, $"{oProfile.CountData} Datensätze")
oDataGroup.Items.Add(oItem)
End If
Next
Catch ex As Exception
Logger.Error(ex)
@@ -67,6 +55,57 @@ Public Class frmProfileMatch
End Try
End Sub
Private Function CreateTile(Profile As ClassProfileFilter.ProfileData, CountText As String) As TileItem
Dim oItem As New TileItem() With {.Tag = Profile.Guid}
oItem.Elements.Clear()
Dim oNameElement = New TileItemElement()
oNameElement.Text = Profile.Name
oNameElement.TextAlignment = TileItemContentAlignment.TopLeft
oNameElement.Appearance.Normal.Font = PrimaryFont
oItem.Elements.Add(oNameElement)
Dim oCommentElement = New TileItemElement()
oCommentElement.Text = Profile.Comment
oCommentElement.TextAlignment = TileItemContentAlignment.MiddleLeft
oCommentElement.Appearance.Normal.Font = SecondaryFont
oItem.Elements.Add(oCommentElement)
Dim oCountElement = New TileItemElement()
oCountElement.Text = GetCountText(Profile, CountText)
oCountElement.TextAlignment = TileItemContentAlignment.BottomRight
oCountElement.Appearance.Normal.Font = SecondaryFont
oItem.Elements.Add(oCountElement)
Return oItem
End Function
Private Function GetCountText(Profile As ClassProfileFilter.ProfileData, CountText As String) As String
Dim oText As String = "No implemented"
If Profile.CountData = ClassConstants.INVALID_COUNT_SQL Then
'oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
oText = "Invalid SQL!"
ElseIf Profile.CountData = ClassConstants.NO_COUNT_SQL Then
'oText = "DocCount (MatchCountConfig has not been configured)"
oText = "No SQL!"
Else
oText = CountText
End If
If Profile.CountDocs = ClassConstants.INVALID_COUNT_SQL Then
'oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
oText = "Invalid SQL!"
ElseIf Profile.CountDocs = ClassConstants.NO_COUNT_SQL Then
'oText = "DocCount (MatchCountConfig has not been configured)"
oText = "No SQL!"
Else
oText = CountText
End If
Return oText
End Function
Private Sub frmProfileMatch_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
ConfigManager.Config.MatchWindowSize = Size
@@ -82,7 +121,7 @@ Public Class frmProfileMatch
Close()
End Sub
Private Sub TileControl1_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControl1.ItemClick
Private Sub TileControl1_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControlMatch.ItemClick
Dim oItem As TileItem = e.Item
Dim oProfileId = oItem.Tag