ClipboardWatcher, Common: Improve checking for client

This commit is contained in:
Jonathan Jenne
2022-11-08 10:51:52 +01:00
parent 9708b0ddeb
commit c8bdad9cf5
2 changed files with 30 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ Public Class ProfileSearches
Private ReadOnly _Environment As Environment
Private ReadOnly _Client As Client
Private ReadOnly _ClipboardContents As String
Private ReadOnly _ClientIsOnline As Boolean = False
Public Class Search
Public Guid As Integer
@@ -30,8 +31,10 @@ Public Class ProfileSearches
_Environment = pEnvironment
_ClipboardContents = pClipboardContents
_ClientIsOnline = _Environment.Service.Client IsNot Nothing AndAlso _Environment.Service.Client.IsOnline = True
Try
If _Environment.Service.Client IsNot Nothing AndAlso _Environment.Service.Client.IsOnline = True Then
If _ClientIsOnline Then
Try
Dim oSplit() As String = _Environment.Service.Address.Split(":")
Dim oAppServerAddress As String = oSplit(0)
@@ -89,7 +92,8 @@ Public Class ProfileSearches
Private Function DoLoadDocumentSearches(ProfileId As Integer) As List(Of Search)
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
Dim oSearchesDataTable As DataTable
If _Environment.Service.Client.IsOnline = True Then
If _ClientIsOnline Then
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DOC_SEARCH", $"PROFILE_ID = {ProfileId} AND ACTIVE = 1", "TAB_INDEX")
oSearchesDataTable = oTableResult.Table
If oSearchesDataTable Is Nothing Then
@@ -99,6 +103,7 @@ Public Class ProfileSearches
Else
oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
End If
Dim oDocSearches As New List(Of Search)
If Not IsNothing(oSearchesDataTable) Then
Dim oCounter As Integer = 0
@@ -154,7 +159,7 @@ Public Class ProfileSearches
Try
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
Dim oSearchesDataTable As DataTable
If _Environment.Service.Client.IsOnline = True Then
If _ClientIsOnline Then
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DATA_SEARCH", $"PROFILE_ID = {ProfileId} AND ACTIVE = 1", "TAB_INDEX")
oSearchesDataTable = oTableResult.Table
If oSearchesDataTable Is Nothing Then