ClipboardWatcher: Add Waiting Form

This commit is contained in:
Jonathan Jenne
2021-02-09 12:59:35 +01:00
parent d8367df621
commit 910c755966
6 changed files with 306 additions and 41 deletions

View File

@@ -71,38 +71,48 @@ Public Class frmMatch
Dim oCreatedTiles As Integer = oResult.Item1
Dim oMatchedProfiles As Integer = oResult.Item2
If oCreatedTiles = -1 Then
Exit Sub
End If
Try
SplashScreenManager1.ShowWaitForm()
TileControlMatch.Enabled = False
If oCreatedTiles = 0 Then
_Logger.Warn("No Tiles Created: No Results found for ""{0}""", _Params.ClipboardContents)
Close()
End If
Label1.Text = GetResultString(oCreatedTiles, oMatchedProfiles, _Params.ClipboardContents)
_Logger.Debug($"Created Tiles: {oCreatedTiles} ")
_Logger.Debug($"Matched Profiles: {oMatchedProfiles}")
If oCreatedTiles = 1 Then
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then
_Logger.Debug($"ONLY Docs")
'ONLY DOCS AND NÒ DATA
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid)
OpenDocumentResults(oProfile, oSearches)
Hide()
ElseIf oProfile.CountDocs > 0 And oProfile.CountData > 0 Then
_Logger.Debug($"Docs AND Data")
ElseIf oProfile.CountDocs = 0 And oProfile.CountData > 0 Then
_Logger.Debug($"ONLY Data")
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid)
OpenDataResults(oProfile, oSearches)
Hide()
If oCreatedTiles = -1 Then
Exit Sub
End If
End If
If oCreatedTiles = 0 Then
_Logger.Warn("No Tiles Created: No Results found for ""{0}""", _Params.ClipboardContents)
Close()
End If
Label1.Text = GetResultString(oCreatedTiles, oMatchedProfiles, _Params.ClipboardContents)
_Logger.Debug($"Created Tiles: {oCreatedTiles} ")
_Logger.Debug($"Matched Profiles: {oMatchedProfiles}")
If oCreatedTiles = 1 Then
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then
_Logger.Debug($"ONLY Docs")
'ONLY DOCS AND NÒ DATA
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid)
OpenDocumentResults(oProfile, oSearches)
Hide()
ElseIf oProfile.CountDocs > 0 And oProfile.CountData > 0 Then
_Logger.Debug($"Docs AND Data")
ElseIf oProfile.CountDocs = 0 And oProfile.CountData > 0 Then
_Logger.Debug($"ONLY Data")
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid)
OpenDataResults(oProfile, oSearches)
Hide()
End If
End If
Catch ex As Exception
_Logger.Error(ex)
Finally
TileControlMatch.Enabled = True
SplashScreenManager1.CloseWaitForm()
End Try
End Sub
Private Sub frmMatch_Activated(sender As Object, e As EventArgs) Handles Me.Activated
@@ -244,6 +254,9 @@ Public Class frmMatch
Private Async Sub TileControlMatch_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControlMatch.ItemClick
Try
SplashScreenManager1.ShowWaitForm()
TileControlMatch.Enabled = False
Dim oItem As TileItem = e.Item
Dim oProfileId As Integer = oItem.Tag
@@ -271,6 +284,9 @@ Public Class frmMatch
Catch ex As Exception
MsgBox($"Error while loading Searches: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)
_Logger.Error(ex)
Finally
SplashScreenManager1.CloseWaitForm()
TileControlMatch.Enabled = True
End Try
End Sub