ClipboardWatcher: more accurate result text
This commit is contained in:
parent
eae9abb3be
commit
934bbfb063
4
GUIs.ClipboardWatcher/frmMatch.Designer.vb
generated
4
GUIs.ClipboardWatcher/frmMatch.Designer.vb
generated
@ -75,9 +75,9 @@ Partial Class frmMatch
|
||||
Me.Label1.ForeColor = System.Drawing.Color.White
|
||||
Me.Label1.Location = New System.Drawing.Point(12, 9)
|
||||
Me.Label1.Name = "Label1"
|
||||
Me.Label1.Size = New System.Drawing.Size(368, 21)
|
||||
Me.Label1.Size = New System.Drawing.Size(408, 21)
|
||||
Me.Label1.TabIndex = 1
|
||||
Me.Label1.Text = "Es wurde(n) {0} für Ihre Suche nach '{1}' gefunden:"
|
||||
Me.Label1.Text = "Es wurde(n) {0} in {1} für Ihre Suche nach '{2}' gefunden:"
|
||||
'
|
||||
'Label2
|
||||
'
|
||||
|
||||
@ -56,8 +56,18 @@ Public Class frmMatch
|
||||
_Params = Params
|
||||
End Sub
|
||||
|
||||
Private Function GetResultString(CreatedTiles, MatchedProfiles, ClipboardContents) As String
|
||||
Dim oResultString = IIf(CreatedTiles = 1, "wurde ein Ergebnis", $"wurden {CreatedTiles} Ergebnisse")
|
||||
Dim oProfileString = IIf(MatchedProfiles = 1, "einem Profil", $"{MatchedProfiles} Profilen")
|
||||
Dim oBase = "Es {0} in {1} für Ihre Suche nach '{2}' gefunden:"
|
||||
|
||||
Return String.Format(oBase, oResultString, oProfileString, _Params.ClipboardContents)
|
||||
End Function
|
||||
|
||||
Private Async Sub frmMatch_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Dim oCreatedTiles = CreateTiles()
|
||||
Dim oResult As Tuple(Of Integer, Integer) = CreateTiles()
|
||||
Dim oCreatedTiles As Integer = oResult.Item1
|
||||
Dim oMatchedProfiles As Integer = oResult.Item2
|
||||
|
||||
If oCreatedTiles = -1 Then
|
||||
Exit Sub
|
||||
@ -68,11 +78,11 @@ Public Class frmMatch
|
||||
Close()
|
||||
End If
|
||||
|
||||
Dim oMatchString = IIf(oCreatedTiles = 1, "1 Profil", $"{oCreatedTiles} Profile")
|
||||
Label1.Text = String.Format(Label1.Text, oMatchString, _Params.ClipboardContents)
|
||||
Label1.Text = GetResultString(oCreatedTiles, oMatchedProfiles, _Params.ClipboardContents)
|
||||
_Logger.Debug($"Created Tiles: {oCreatedTiles} ")
|
||||
If oCreatedTiles = 1 Then
|
||||
_Logger.Debug($"Matched Profiles: {oMatchedProfiles}")
|
||||
|
||||
If oCreatedTiles = 1 Then
|
||||
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
||||
|
||||
@ -97,9 +107,11 @@ Public Class frmMatch
|
||||
TopMost = True
|
||||
End Sub
|
||||
|
||||
Function CreateTiles() As Integer
|
||||
Function CreateTiles() As Tuple(Of Integer, Integer)
|
||||
Try
|
||||
Dim oCreatedTiles As Integer = 0
|
||||
Dim oMatchedProfiles As Integer = 0
|
||||
|
||||
Dim oDocumentGroup = TileControlMatch.Groups.Item("TileGroupDocuments")
|
||||
Dim oDataGroup = TileControlMatch.Groups.Item("TileGroupData")
|
||||
Dim oDataDocumentsGroup = TileControlMatch.Groups.Item("TileGroupDocumentsData")
|
||||
@ -118,12 +130,15 @@ Public Class frmMatch
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Dim oProfileMatch As Boolean = False
|
||||
|
||||
If oProfile.ProfileType = ProfileType.ANY Or oProfile.ProfileType = ProfileType.DOCS_ONLY Then
|
||||
_Logger.Debug("Docs only or ProfileTypeAny")
|
||||
If oProfile.CountDocs > 0 Then
|
||||
Dim oItem = CreateTile(oProfile, $"{oProfile.CountDocs} Dateien")
|
||||
oDocumentGroup.Items.Add(oItem)
|
||||
oCreatedTiles += 1
|
||||
oProfileMatch = True
|
||||
Else
|
||||
_Logger.Debug("NO Doc-Results!")
|
||||
End If
|
||||
@ -134,17 +149,22 @@ Public Class frmMatch
|
||||
Dim oItem = CreateTile(oProfile, $"{oProfile.CountData} Datensätze")
|
||||
oDataGroup.Items.Add(oItem)
|
||||
oCreatedTiles += 1
|
||||
oProfileMatch = True
|
||||
Else
|
||||
_Logger.Debug("NO Data-Results!")
|
||||
End If
|
||||
End If
|
||||
|
||||
If oProfileMatch Then
|
||||
oMatchedProfiles += 1
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oCreatedTiles
|
||||
Return New Tuple(Of Integer, Integer)(oCreatedTiles, oMatchedProfiles)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
MsgBox("Error while creating profile tiles!" & vbNewLine & ex.Message)
|
||||
Return -1
|
||||
Return New Tuple(Of Integer, Integer)(-1, -1)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@ -200,7 +220,9 @@ Public Class frmMatch
|
||||
|
||||
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
|
||||
Dim oForm As New frmTreeView(_Params.MatchTreeView.Nodes) With {
|
||||
.StartPosition = FormStartPosition.CenterScreen
|
||||
.StartPosition = FormStartPosition.Manual,
|
||||
.Left = Left + Width,
|
||||
.Top = Top
|
||||
}
|
||||
oForm.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user