3 Commits

Author SHA1 Message Date
Jonathan Jenne
cb2372e1e7 Common: Version 2.4.1.0 2022-11-08 10:52:58 +01:00
Jonathan Jenne
c8bdad9cf5 ClipboardWatcher, Common: Improve checking for client 2022-11-08 10:51:52 +01:00
Jonathan Jenne
9708b0ddeb ClipboardWatcher: Fix null ref when client is not initialized in Environment 2022-11-08 08:54:41 +01:00
4 changed files with 44 additions and 29 deletions

View File

@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("ClipboardWatcher")>
<Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("1.5.1.0")>
<Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.0.0")>
<Assembly: AssemblyFileVersion("1.5.0.0")>
<Assembly: AssemblyVersion("1.5.1.0")>
<Assembly: AssemblyFileVersion("1.5.1.0")>

View File

@@ -12,10 +12,10 @@ Imports DigitalData.Modules.ZooFlow.Params
Public Class ProfileSearches
Inherits BaseClass
Private _Environment As Environment
Private _Client As Client
Private _ClipboardContents As String
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
@@ -31,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.IsOnline = True Then
If _ClientIsOnline Then
Try
Dim oSplit() As String = _Environment.Service.Address.Split(":")
Dim oAppServerAddress As String = oSplit(0)
@@ -50,6 +52,8 @@ Public Class ProfileSearches
Logger.Warn($"Could not initialize the AppServer: {ex.Message}")
Logger.Error(ex)
End Try
Else
Logger.Debug("No client found in Env.")
End If
Catch ex As Exception
Logger.Error(ex)
@@ -82,15 +86,14 @@ Public Class ProfileSearches
End Function
Public Async Function LoadDocumentSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
Return Await Task.Run(Function()
Return DoLoadDocumentSearches(ProfileId)
End Function)
Return Await Task.Run(Function() DoLoadDocumentSearches(ProfileId))
End Function
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
@@ -100,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
@@ -146,9 +150,7 @@ Public Class ProfileSearches
End Function
Public Async Function LoadDataSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
Return Await Task.Run(Function()
Return DoLoadDataSearches(ProfileId)
End Function)
Return Await Task.Run(Function() DoLoadDataSearches(ProfileId))
End Function
Private Function DoLoadDataSearches(ProfileId As Integer) As List(Of Search)
@@ -157,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

View File

@@ -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

View File

@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Common")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyTrademark("2.4.1.0")>
<Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.0.0")>
<Assembly: AssemblyFileVersion("2.4.0.0")>
<Assembly: AssemblyVersion("2.4.1.0")>
<Assembly: AssemblyFileVersion("2.4.1.0")>