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

View File

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

View File

@@ -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,18 +127,29 @@ 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
If Environment.Service.Client IsNot Nothing AndAlso Environment.Service.Client.IsOnline Then
oOperationMode = OperationMode.WithAppServer oOperationMode = OperationMode.WithAppServer
Else Else
oOperationMode = OperationMode.NoAppServer oOperationMode = OperationMode.NoAppServer
End If End If
Logger.Debug("OperationMode set to [{0}]", oOperationMode)
If Params.OperationModeOverride <> OperationMode.None Then If Params.OperationModeOverride <> OperationMode.None Then
Logger.Debug("Overriding OperationMode with [{0}]", Params.OperationModeOverride)
oOperationMode = Params.OperationModeOverride oOperationMode = Params.OperationModeOverride
End If 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

View File

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