147 lines
5.5 KiB
VB.net
147 lines
5.5 KiB
VB.net
Imports DevExpress.XtraEditors
|
|
|
|
Public Class frmProfileMatch
|
|
Private PrimaryFont As New Font("Segoe UI", 12, FontStyle.Bold)
|
|
Private SecondaryFont As New Font("Segoe UI", 10)
|
|
|
|
Private Sub frmProfileMatch_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not ConfigManager.Config.MatchWindowLocation.IsEmpty Then
|
|
Location = ConfigManager.Config.MatchWindowLocation
|
|
End If
|
|
|
|
If Not ConfigManager.Config.MatchWindowSize.IsEmpty Then
|
|
Size = ConfigManager.Config.MatchWindowSize
|
|
End If
|
|
|
|
If USER_LANGUAGE = "de-DE" Then
|
|
Label1.Text = $"Clipboard Watcher hat mehr als einen Match für Ihre Suche nach ""{CURR_MATCH_RESULT}"" gefunden:"
|
|
Else
|
|
Label1.Text = $"Clipboard Watcher found more than on match for your search for ""{CURR_MATCH_RESULT}"":"
|
|
End If
|
|
|
|
CreateTiles()
|
|
CurrDocSearch2Load = Nothing
|
|
End Sub
|
|
|
|
Sub CreateTiles()
|
|
Try
|
|
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
|
|
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
|
|
|
|
If oProfile.CountDocs > 0 Then
|
|
Dim oItem = CreateTile(oProfile, $"{oProfile.CountDocs} Dokumente")
|
|
oDocumentGroup.Items.Add(oItem)
|
|
End If
|
|
|
|
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)
|
|
MsgBox("Error while creating profile tiles!" & vbNewLine & ex.Message)
|
|
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 = "Invalid SQL!"
|
|
ElseIf Profile.CountData = ClassConstants.NO_COUNT_SQL Then
|
|
oText = "No SQL!"
|
|
Else
|
|
oText = CountText
|
|
End If
|
|
|
|
If Profile.CountDocs = ClassConstants.INVALID_COUNT_SQL Then
|
|
oText = "Invalid SQL!"
|
|
ElseIf Profile.CountDocs = ClassConstants.NO_COUNT_SQL Then
|
|
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
|
|
ConfigManager.Config.MatchWindowLocation = Location
|
|
ConfigManager.Save()
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Logger.Info("Error in Save FormLayout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
|
|
Close()
|
|
End Sub
|
|
|
|
Private Sub TileControl1_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControlMatch.ItemClick
|
|
Dim oItem As TileItem = e.Item
|
|
Dim oProfileId = oItem.Tag
|
|
|
|
If oProfileId Is Nothing Then
|
|
Dim oResult As String = ""
|
|
For Each oProfile As ClassProfileFilter.ProfileData In CURRENT_MATCHING_PROFILES
|
|
If oResult = "" Then
|
|
oResult = oProfile.Guid
|
|
Else
|
|
oResult &= "," & oProfile.Guid
|
|
End If
|
|
Next
|
|
CurrDocSearch2Load = oResult
|
|
CurrDataSearch2Load = oResult
|
|
Else
|
|
CurrDocSearch2Load = oProfileId
|
|
CurrDataSearch2Load = oProfileId
|
|
End If
|
|
|
|
' Show Result Document Form
|
|
Dim oFrmResultDoc As Form = New frmResultDoc(Me)
|
|
oFrmResultDoc.Show()
|
|
|
|
' ..and hide myself
|
|
Hide()
|
|
End Sub
|
|
End Class |