Common: improve file watcher, fix refreshing data after update

This commit is contained in:
Jonathan Jenne
2022-02-08 16:28:24 +01:00
parent 533df59b1f
commit c6e67a967c
16 changed files with 221 additions and 65 deletions

View File

@@ -41,8 +41,11 @@ Public Class frmMatch
Private ShouldHideInitially As Boolean = False
Private Const NO_COUNT_SQL As Integer = 99998
Private Const INVALID_COUNT_SQL As Integer = 99999
'Public Event ResultsRefreshed As EventHandler
Private Enum ProfileType
ANY = 0
DOCS_ONLY = 1
@@ -133,7 +136,7 @@ Public Class frmMatch
If oCreatedTiles = 1 Then
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then
_Logger.Debug($"ONLY Docs")
@@ -308,7 +311,7 @@ Public Class frmMatch
Dim oItem As TileItem = e.Item
Dim oProfileId As Integer = oItem.Tag
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
Dim oProfile As ProfileData = _Params.MatchingProfiles.
Where(Function(p) p.Guid = oProfileId).
ToList().
@@ -345,7 +348,8 @@ Public Class frmMatch
Dim oParams = New DocumentResultList.Params() With {
.WindowGuid = oWindowGuid,
.WindowTitle = GetResultWindowString(_Params.ClipboardContents),
.OperationModeOverride = _Params.OperationModeOverride
.OperationModeOverride = _Params.OperationModeOverride,
.ProfileGuid = Profile.Guid
}
For Each oSearch In Searches
@@ -357,8 +361,11 @@ Public Class frmMatch
Dim oForm As New frmDocumentResultList(_LogConfig, _Environment, oParams)
AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
AddHandler oForm.NeedsRefresh, AddressOf ProfileResultForm_NeedsRefresh
OpenForms.Add(oForm)
oForm.Show()
End Sub
Private Sub OpenDataResults(Profile As ProfileData, Searches As List(Of ProfileSearches.Search))
@@ -406,4 +413,23 @@ Public Class frmMatch
Show()
End If
End Sub
Private Async Sub ProfileResultForm_NeedsRefresh(sender As Object, e As Integer)
Dim oThisForm As IResultForm = sender
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
If TypeOf sender Is frmDocumentResultList Then
Dim oProfileId = e
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfileId)
Dim oResults = oSearches.Select(Function(search)
Return New DocumentResultList.DocumentResult() With {
.Title = search.TabCaption,
.Datatable = search.DataTable
}
End Function).ToList()
'RaiseEvent ResultsRefreshed(Me, Nothing)
oThisForm.RefreshResults(oResults)
End If
End Sub
End Class