134 lines
4.9 KiB
VB.net

Imports DevExpress.XtraEditors
Public Class frmProfileMatch
Private Sub frmProfileMatch_Load(sender As Object, e As EventArgs) Handles Me.Load
If ConfigManager.Config.MatchWindowX > 0 And ConfigManager.Config.MatchWindowY > 0 Then
Dim oLocation As New Point(ConfigManager.Config.MatchWindowX, ConfigManager.Config.MatchWindowY)
Location = oLocation
End If
Dim oSize As New Size(ConfigManager.Config.MatchWindowWidth, ConfigManager.Config.MatchWindowHeight)
Size = oSize
If USER_LANGUAGE = "de-DE" Then
Me.Label1.Text = $"Clipboard Watcher hat mehr als einen Match für Ihre Suche [{CURR_MATCH_RESULT}] gefunden:"
Else
Me.Label1.Text = $"Clipboard Watcher found more than on match for Your search [{CURR_MATCH_RESULT}]:"
End If
CreateTiles()
CurrDocSearch2Load = Nothing
End Sub
Sub CreateTiles()
Try
Dim oPrimaryFont As New Font("Segoe UI", 12, FontStyle.Bold)
Dim oSecondaryFont As New Font("Segoe UI", 10)
Dim oGroup = TileControl1.Groups.Item("TileGroupProfiles")
oGroup.Items.Clear()
For Each oRow As DataRow In CurrDT_PROFILE_MATCH.Rows
Dim oItem As New TileItem() With {.Tag = oRow.Item("GUID")}
oItem.Elements.Clear()
Dim oNameElement = New TileItemElement()
oNameElement.Text = oRow.Item("NAME")
oNameElement.TextAlignment = TileItemContentAlignment.TopLeft
oNameElement.Appearance.Normal.Font = oPrimaryFont
oItem.Elements.Add(oNameElement)
Dim oCommentElement = New TileItemElement()
oCommentElement.Text = oRow.Item("COMMENT")
oCommentElement.TextAlignment = TileItemContentAlignment.BottomLeft
oCommentElement.Appearance.Normal.Font = oSecondaryFont
oItem.Elements.Add(oCommentElement)
Dim oCountElement = New TileItemElement()
oCountElement.TextAlignment = TileItemContentAlignment.BottomRight
oCountElement.Appearance.Normal.Font = oSecondaryFont
Dim oText As String
If oRow.Item("COUNT") = 99999 Then
oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
ElseIf oRow.Item("COUNT") = 99998 Then
oText = "DocCount (MatchCountConfig has not been configured)"
Else
oText = $"{oRow.Item("COUNT")} files!"
End If
oCountElement.Text = oText
oItem.Elements.Add(oCountElement)
oGroup.Items.Add(oItem)
Next
Catch ex As Exception
End Try
End Sub
Sub OpenResults_Doc()
Dim ofrmresult As Form = New frmResultDoc
ofrmresult.Show()
End Sub
Sub OpenResults_Data()
Dim ofrmresult As Form = New frmResultSQL
ofrmresult.Show()
End Sub
Private Sub frmProfileMatch_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
ConfigManager.Config.MatchWindowHeight = Size.Height
ConfigManager.Config.MatchWindowWidth = Size.Width
ConfigManager.Config.MatchWindowX = Location.X
ConfigManager.Config.MatchWindowY = Location.Y
ConfigManager.Save()
Catch ex As Exception
Logger.Error(ex)
Logger.Info("Error in Save FormLayout: " & ex.Message)
End Try
CURR_MATCH_RESULT = Nothing
CLIPBOARD_TEXT = ""
End Sub
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
CURR_MATCH_RESULT = Nothing
CLIPBOARD_TEXT = ""
Close()
End Sub
Private Sub TileControl1_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControl1.ItemClick
Dim oItem As TileItem = e.Item
Dim oProfileId = oItem.Tag
If oProfileId Is Nothing Then
Dim oResult As String = ""
For Each oRow As DataRow In CurrDT_PROFILE_MATCH.Rows
If oResult = "" Then
oResult = oRow.Item("GUID")
Else
oResult &= "," & oRow.Item("GUID")
End If
Next
CurrDocSearch2Load = oResult
CurrDataSearch2Load = oResult
Else
CurrDocSearch2Load = oProfileId
CurrDataSearch2Load = oProfileId
End If
OpenResults_Doc()
OpenResults_Data()
Me.Hide()
End Sub
Private Sub frmProfileMatch_VisibleChanged(sender As Object, e As EventArgs) Handles Me.VisibleChanged
If Me.Visible = True Then
If CurrSearchOpen = True Then
End If
Else
If CurrSearchOpen = True Then
End If
End If
End Sub
End Class