Files
ClipboardWatcher/app/DD_Clipboard_Searcher/frmProfileMatch.vb
2019-07-18 16:04:03 +02:00

116 lines
4.4 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
Me.Label1.Text = $"Clipboard Watcher hat mehr als einen Match für Ihre Suche nach ""{CURR_MATCH_RESULT}"" gefunden:"
Else
Me.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 oGroup = TileControl1.Groups.Item("TileGroupDocuments")
oGroup.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.Count = 99999 Then
oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
ElseIf oProfile.Count = 99998 Then
oText = "DocCount (MatchCountConfig has not been configured)"
Else
oText = $"{oProfile.Count} files!"
End If
oCountElement.Text = oText
oItem.Elements.Add(oCountElement)
oGroup.Items.Add(oItem)
Next
Catch ex As Exception
Logger.Error(ex)
MsgBox("Error while creating profile tiles!" & vbNewLine & ex.Message)
End Try
End Sub
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
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 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