Common: improve file watcher, fix refreshing data after update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@@ -9,9 +9,10 @@ Public Class ProfileSearches
|
||||
Private _LogConfig As LogConfig
|
||||
Private _Logger As Logger
|
||||
Private _Environment As Environment
|
||||
Private _Params As ClipboardWatcherParams
|
||||
Private _Client As Client
|
||||
|
||||
Private _ClipboardContents As String
|
||||
|
||||
Public Class Search
|
||||
Public Guid As Integer
|
||||
Public DataTable As DataTable
|
||||
@@ -21,11 +22,11 @@ Public Class ProfileSearches
|
||||
Public SQLCommand As String
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As ClipboardWatcherParams)
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, pClipboardContents As String)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Environment = Environment
|
||||
_Params = Params
|
||||
_ClipboardContents = pClipboardContents
|
||||
Try
|
||||
If _Environment.Service.IsActive = True Then
|
||||
Try
|
||||
@@ -84,7 +85,7 @@ Public Class ProfileSearches
|
||||
oSQL = oRow.Item("SQL_COMMAND")
|
||||
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _ClipboardContents)
|
||||
|
||||
Dim oConnectionString = ProfileUtils.GetConnectionString(_Environment.Database, oConnectionId)
|
||||
|
||||
@@ -150,7 +151,7 @@ Public Class ProfileSearches
|
||||
oSQL = oRow.Item("SQL_COMMAND")
|
||||
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _ClipboardContents)
|
||||
|
||||
Dim oConnectionString = ProfileUtils.GetConnectionString(_Environment.Database, oConnectionId)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user