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 _Environment As Environment
|
||||||
Private ReadOnly _Client As Client
|
Private ReadOnly _Client As Client
|
||||||
Private ReadOnly _ClipboardContents As String
|
Private ReadOnly _ClipboardContents As String
|
||||||
|
Private ReadOnly _ClientIsOnline As Boolean = False
|
||||||
|
|
||||||
Public Class Search
|
Public Class Search
|
||||||
Public Guid As Integer
|
Public Guid As Integer
|
||||||
@@ -30,8 +31,10 @@ Public Class ProfileSearches
|
|||||||
|
|
||||||
_Environment = pEnvironment
|
_Environment = pEnvironment
|
||||||
_ClipboardContents = pClipboardContents
|
_ClipboardContents = pClipboardContents
|
||||||
|
_ClientIsOnline = _Environment.Service.Client IsNot Nothing AndAlso _Environment.Service.Client.IsOnline = True
|
||||||
|
|
||||||
Try
|
Try
|
||||||
If _Environment.Service.Client IsNot Nothing AndAlso _Environment.Service.Client.IsOnline = True Then
|
If _ClientIsOnline Then
|
||||||
Try
|
Try
|
||||||
Dim oSplit() As String = _Environment.Service.Address.Split(":")
|
Dim oSplit() As String = _Environment.Service.Address.Split(":")
|
||||||
Dim oAppServerAddress As String = oSplit(0)
|
Dim oAppServerAddress As String = oSplit(0)
|
||||||
@@ -89,7 +92,8 @@ Public Class ProfileSearches
|
|||||||
Private Function DoLoadDocumentSearches(ProfileId As Integer) As List(Of Search)
|
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 oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
|
||||||
Dim oSearchesDataTable As DataTable
|
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")
|
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DOC_SEARCH", $"PROFILE_ID = {ProfileId} AND ACTIVE = 1", "TAB_INDEX")
|
||||||
oSearchesDataTable = oTableResult.Table
|
oSearchesDataTable = oTableResult.Table
|
||||||
If oSearchesDataTable Is Nothing Then
|
If oSearchesDataTable Is Nothing Then
|
||||||
@@ -99,6 +103,7 @@ Public Class ProfileSearches
|
|||||||
Else
|
Else
|
||||||
oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
|
oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oDocSearches As New List(Of Search)
|
Dim oDocSearches As New List(Of Search)
|
||||||
If Not IsNothing(oSearchesDataTable) Then
|
If Not IsNothing(oSearchesDataTable) Then
|
||||||
Dim oCounter As Integer = 0
|
Dim oCounter As Integer = 0
|
||||||
@@ -154,7 +159,7 @@ Public Class ProfileSearches
|
|||||||
Try
|
Try
|
||||||
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
|
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
|
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")
|
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DATA_SEARCH", $"PROFILE_ID = {ProfileId} AND ACTIVE = 1", "TAB_INDEX")
|
||||||
oSearchesDataTable = oTableResult.Table
|
oSearchesDataTable = oTableResult.Table
|
||||||
If oSearchesDataTable Is Nothing Then
|
If oSearchesDataTable Is Nothing Then
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ Public Class frmDocumentResultList
|
|||||||
Private Property ResultLists As List(Of DocumentResult)
|
Private Property ResultLists As List(Of DocumentResult)
|
||||||
|
|
||||||
Private IsLoading As Boolean = True
|
Private IsLoading As Boolean = True
|
||||||
|
Private ClientIsOnline As Boolean = False
|
||||||
|
|
||||||
Private _DragBoxFromMouseDown As Rectangle
|
Private _DragBoxFromMouseDown As Rectangle
|
||||||
Private _ScreenOffset As Point
|
Private _ScreenOffset As Point
|
||||||
Private _CurrentDocument As DocumentResultList.Document = Nothing
|
Private _CurrentDocument As DocumentResultList.Document = Nothing
|
||||||
@@ -125,17 +127,28 @@ Public Class frmDocumentResultList
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function GetOperationMode() As OperationMode
|
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
|
Try
|
||||||
oOperationMode = OperationMode.WithAppServer
|
If Environment.Service.Client IsNot Nothing AndAlso Environment.Service.Client.IsOnline Then
|
||||||
Else
|
oOperationMode = OperationMode.WithAppServer
|
||||||
oOperationMode = OperationMode.NoAppServer
|
Else
|
||||||
End If
|
oOperationMode = OperationMode.NoAppServer
|
||||||
|
End If
|
||||||
|
|
||||||
If Params.OperationModeOverride <> OperationMode.None Then
|
Logger.Debug("OperationMode set to [{0}]", oOperationMode)
|
||||||
oOperationMode = Params.OperationModeOverride
|
|
||||||
End If
|
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
|
Return oOperationMode
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
Reference in New Issue
Block a user