ZooFlow: Clean up, faster search

This commit is contained in:
Jonathan Jenne
2022-02-18 15:02:51 +01:00
parent c6c548afe4
commit 77597f0ef2
53 changed files with 326 additions and 818 deletions

View File

@@ -31,6 +31,7 @@ Public Class frmMatch
Private ReadOnly _Environment As Environment
Private ReadOnly _Params As ClipboardWatcherParams
Private ReadOnly _Language As String
Private ReadOnly _ProfileSearch As ProfileSearches
Private ReadOnly PrimaryFont As New Font("Segoe UI", 12, FontStyle.Bold)
Private ReadOnly SecondaryFont As New Font("Segoe UI", 10)
@@ -61,6 +62,7 @@ Public Class frmMatch
_Logger = LogConfig.GetLogger()
_Environment = Environment
_Params = Params
_ProfileSearch = New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
_Language = Utils.NotNull(_Environment.User.Language, State.UserState.LANG_EN_US)
Thread.CurrentThread.CurrentUICulture = New CultureInfo(_Language)
@@ -324,7 +326,7 @@ Public Class frmMatch
Case TileGroupDocuments.Name
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfileId)
OpenDocumentResults(oProfile, oSearches)
Await OpenDocumentResults(oProfile, oSearches)
Case Else
' TODO: Load combined results
@@ -341,32 +343,17 @@ Public Class frmMatch
End Try
End Sub
Private Sub OpenDocumentResults(Profile As ProfileData, Searches As List(Of ProfileSearches.Search))
Dim oNameSlug = Utils.ConvertTextToSlug(Profile.Name)
Dim oSearchGuids = Searches.Select(Function(s) s.Guid).ToArray
Dim oWindowGuid = $"{Profile.Guid}-{oNameSlug}-{String.Join("-", oSearchGuids)}"
Dim oParams = New DocumentResultList.Params() With {
.WindowGuid = oWindowGuid,
.WindowTitle = GetResultWindowString(_Params.ClipboardContents),
.OperationModeOverride = _Params.OperationModeOverride,
.ProfileGuid = Profile.Guid
}
Private Async Function OpenDocumentResults(Profile As ProfileData, Searches As List(Of ProfileSearches.Search)) As Task
Dim oFormTitle = GetResultWindowString(_Params.ClipboardContents)
Dim oForm As frmDocumentResultList = Await _ProfileSearch.GetDocResultForm(Profile, oFormTitle, _Params.OperationModeOverride)
For Each oSearch In Searches
oParams.Results.Add(New DocumentResultList.DocumentResult() With {
.Title = oSearch.TabCaption,
.Datatable = oSearch.DataTable
})
Next
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
End Function
Private Sub OpenDataResults(Profile As ProfileData, Searches As List(Of ProfileSearches.Search))
Dim oNameSlug = Utils.ConvertTextToSlug(Profile.Name)