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

@@ -163,7 +163,7 @@ Public Class frmFlowForm
Private ClassWindow As Window
Private ProfileFilter As ProfileFilter
Private ProfileLoader As ClassProfileLoader
Private _Environment As Environment
Private Property _Environment As Environment
' Runtime Flags
Private ApplicationLoading As Boolean = True
@@ -187,7 +187,6 @@ Public Class frmFlowForm
Init = New ClassInit(My.LogConfig, Me)
AddHandler Init.Completed, AddressOf Init_Completed
Init.InitializeApplication()
_Environment = My.Application.GetEnvironment
' === Register Sidebar ===
RegisterBar(ABEdge.ABE_RIGHT)
@@ -204,6 +203,8 @@ Public Class frmFlowForm
ApplicationLoading = False
SplashScreenManager.CloseForm(False)
_Environment = My.Application.GetEnvironment()
' === Initialize Error Handler ===
Logger = My.LogConfig.GetLogger()
ErrorHandler = New BaseErrorHandler(My.LogConfig, Logger, Me)
@@ -911,40 +912,40 @@ Public Class frmFlowForm
oState.CurrentClipboardContents = ClipboardContents
If oState.MonitoringActive = False Then
Dim oMessage As String = "Clipboard Watcher is not active!"
Logger.Warn(oMessage)
'If oState.MonitoringActive = False Then
' Dim oMessage As String = "Clipboard Watcher is not active!"
' Logger.Warn(oMessage)
Exit Sub
End If
' Exit Sub
'End If
If oState.UserProfiles Is Nothing Then
Dim oMessage As String = "User Profiles are empty!"
Logger.Warn(oMessage)
'If oState.UserProfiles Is Nothing Then
' Dim oMessage As String = "User Profiles are empty!"
' Logger.Warn(oMessage)
Exit Sub
End If
' Exit Sub
'End If
If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
Dim oMessage As String = "Profile Processes are empty!"
Logger.Warn(oMessage)
'If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
' Dim oMessage As String = "Profile Processes are empty!"
' Logger.Warn(oMessage)
Exit Sub
End If
' Exit Sub
'End If
If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
Dim oMessage As String = "Profile Windows are empty!"
Logger.Warn(oMessage)
'If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
' Dim oMessage As String = "Profile Windows are empty!"
' Logger.Warn(oMessage)
Exit Sub
End If
' Exit Sub
'End If
If oState.ProfileControls Is Nothing OrElse oState.ProfileControls.Rows.Count = 0 Then
Dim oMessage As String = "Profile Processes are empty!"
Logger.Warn(oMessage)
'If oState.ProfileControls Is Nothing OrElse oState.ProfileControls.Rows.Count = 0 Then
' Dim oMessage As String = "Profile Processes are empty!"
' Logger.Warn(oMessage)
Exit Sub
End If
' Exit Sub
'End If
Dim oWindowInfo = ClassWindow.GetWindowInfo()
@@ -961,7 +962,7 @@ Public Class frmFlowForm
Try
Dim oProfiles = ProfileFilter.Profiles
Dim oEnvironment = ClassEnvironment.GetEnvironment()
Dim oEnvironment = My.Application.GetEnvironment()
' Filter by Clipboard Contents
oProfiles = ProfileFilter.FilterProfilesByClipboardRegex(oProfiles, ClipboardContents)
@@ -995,13 +996,11 @@ Public Class frmFlowForm
End Try
End Sub
Private Sub HotkeyClass_HotKeyPressed(HotKeyID As String)
Private Async Sub HotkeyClass_HotKeyPressed(HotKeyID As String)
Dim oState = My.Application.ClipboardWatcher
Select Case HotKeyID
Case HOTKEY_TRIGGER_WATCHER
'Animator.Highlight(Cursor.Position)
If oState.CurrentClipboardContents = String.Empty Then
Logger.Info("Current Clipboard Contents is empty. Exiting.")
Exit Sub
@@ -1021,10 +1020,21 @@ Public Class frmFlowForm
ElseIf oState.CurrentProfilesWithResults.Count = 0 Then
NotifyIcon.ShowBalloonTip(NOTIFICATION_DELAY, "ClipboardWatcher", "Es wurden weder Dokumente noch Daten gefunden!", ToolTipIcon.Warning)
ElseIf oState.CurrentProfilesWithResults.Count = 1 Then
Dim oProfile = oState.CurrentProfilesWithResults.First()
Dim oProfileSearches As New ProfileSearches(My.LogConfig, My.Application.GetEnvironment(), oState.CurrentClipboardContents)
Dim oFormTitle = GetResultWindowString(oState.CurrentClipboardContents)
' For now we assume these are document results instead of data results
Dim oForm = Await oProfileSearches.GetDocResultForm(oProfile, oFormTitle, Modules.ZooFlow.Constants.OperationMode.ZooFlow)
AddHandler oForm.NeedsRefresh, AddressOf ProfileResultForm_NeedsRefresh
oForm.Show()
Else
Dim oProfiles = oState.CurrentProfilesWithResults
Dim oEnvironment = My.Application.GetEnvironment()
Dim oParams As New DigitalData.Modules.ZooFlow.ClipboardWatcherParams With {
Dim oParams As New ClipboardWatcherParams With {
.ClipboardContents = oState.CurrentClipboardContents,
.MatchingProfiles = oProfiles,
.MatchTreeView = oState.MatchTreeView,
@@ -1050,6 +1060,26 @@ Public Class frmFlowForm
End Select
End Sub
Private Async Sub ProfileResultForm_NeedsRefresh(sender As Object, e As Integer)
Dim oThisForm As IResultForm = sender
Dim oState = My.Application.ClipboardWatcher
Dim oProfileSearch As New ProfileSearches(My.LogConfig, _Environment, oState.CurrentClipboardContents)
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
Private Sub PictureBoxPM1_Click(sender As Object, e As EventArgs) Handles PictureBoxPM1.Click
ToastNotificationsManager1.ShowNotification(ToastNotificationsManager1.Notifications(1))
End Sub