ClipboardWatcher, Common: Improve checking for client
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -55,6 +55,8 @@ Public Class frmDocumentResultList
|
||||
Private Property ResultLists As List(Of DocumentResult)
|
||||
|
||||
Private IsLoading As Boolean = True
|
||||
Private ClientIsOnline As Boolean = False
|
||||
|
||||
Private _DragBoxFromMouseDown As Rectangle
|
||||
Private _ScreenOffset As Point
|
||||
Private _CurrentDocument As DocumentResultList.Document = Nothing
|
||||
@@ -125,17 +127,28 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Function GetOperationMode() As OperationMode
|
||||
Dim oOperationMode As OperationMode
|
||||
Dim oOperationMode As OperationMode = OperationMode.NoAppServer
|
||||
|
||||
If Environment.Service IsNot Nothing AndAlso Environment.Service.Client.IsOnline AndAlso Environment.Service.Address <> String.Empty Then
|
||||
oOperationMode = OperationMode.WithAppServer
|
||||
Else
|
||||
oOperationMode = OperationMode.NoAppServer
|
||||
End If
|
||||
Try
|
||||
If Environment.Service.Client IsNot Nothing AndAlso Environment.Service.Client.IsOnline Then
|
||||
oOperationMode = OperationMode.WithAppServer
|
||||
Else
|
||||
oOperationMode = OperationMode.NoAppServer
|
||||
End If
|
||||
|
||||
If Params.OperationModeOverride <> OperationMode.None Then
|
||||
oOperationMode = Params.OperationModeOverride
|
||||
End If
|
||||
Logger.Debug("OperationMode set to [{0}]", oOperationMode)
|
||||
|
||||
If Params.OperationModeOverride <> OperationMode.None Then
|
||||
Logger.Debug("Overriding OperationMode with [{0}]", Params.OperationModeOverride)
|
||||
oOperationMode = Params.OperationModeOverride
|
||||
End If
|
||||
|
||||
Logger.Debug("OperationMode is now [{0}]", oOperationMode)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Logger.Warn("Error while determining OperationMode. Setting to [{0}]", oOperationMode)
|
||||
End Try
|
||||
|
||||
Return oOperationMode
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user