Logging und Vorbereitung MAPPING wie in taskFLOW

This commit is contained in:
Developer01
2026-05-04 16:40:14 +02:00
parent b586bf496b
commit 734e056248
15 changed files with 303 additions and 268 deletions

View File

@@ -29,7 +29,7 @@ Public Class frmDocumentResultList
' Interface implementations
Private ReadOnly Property LogConfig As LogConfig Implements IBaseForm.LogConfig
Private ReadOnly Property Logger As Logger Implements IBaseForm.Logger
Private ReadOnly Property _Logger As Logger Implements IBaseForm._Logger
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
' Helper Classes
@@ -50,6 +50,11 @@ Public Class frmDocumentResultList
Private ReadOnly Workspace As Workspace(Of Config)
Private WithEvents Watcher As Watcher
Private CopyWMFile2Temp As Boolean = False
Private WM_SUFFIX As String = "\\WINDREAM\OBJECTS"
Private MAP_SHAREDRIVE As String = ""
Private MAP_BLACKLIST As String = ""
' Runtime variables
Private Property ResultLists As List(Of DocumentResult)
@@ -79,6 +84,7 @@ Public Class frmDocumentResultList
Private Property GridList As List(Of GridControl)
Private Property ViewList As List(Of BandedGridView)
Private Property OperationMode As OperationMode Implements IResultForm.OperationMode
Private _documentPathHandler As DocumentPathHandler
Public ReadOnly Property Config1 As ConfigManager(Of Config)
Get
@@ -112,12 +118,13 @@ Public Class frmDocumentResultList
ResultLists = pParams.Results
LogConfig = pLogConfig
Logger = pLogConfig.GetLogger()
_Logger = pLogConfig.GetLogger()
FormHelper = New FormHelper(pLogConfig, Me)
_documentPathHandler = New DocumentPathHandler(pLogConfig)
UserLanguage = ObjectEx.NotNull(Environment.User.Language, State.UserState.LANG_EN_US)
LanguageEx.LogApplicationLanguage(Logger)
LanguageEx.SetApplicationLanguage(Logger, UserLanguage)
LanguageEx.LogApplicationLanguage(_Logger)
LanguageEx.SetApplicationLanguage(_Logger, UserLanguage)
Config = New ConfigManager(Of Config)(pLogConfig, oConfigPath, oConfigPath)
Helpers = New DocumentResultList.Helpers(pLogConfig)
@@ -126,7 +133,6 @@ Public Class frmDocumentResultList
FileEx = New Modules.Windows.File(pLogConfig)
LayoutManager = New Layout(pLogConfig, Config, New List(Of GridView) From {GridView1, GridView2, GridView3}, pEnvironment)
Workspace = New Workspace(Of Config)(pLogConfig, Config, WorkspaceManager1, UserLanguage)
End Sub
Private Function GetOperationMode() As OperationMode
@@ -139,18 +145,18 @@ Public Class frmDocumentResultList
oOperationMode = OperationMode.NoAppServer
End If
Logger.Debug("OperationMode set to [{0}]", oOperationMode)
_Logger.Debug("OperationMode set to [{0}]", oOperationMode)
If Params.OperationModeOverride <> OperationMode.None Then
Logger.Debug("Overriding OperationMode with [{0}]", Params.OperationModeOverride)
_Logger.Debug("Overriding OperationMode with [{0}]", Params.OperationModeOverride)
oOperationMode = Params.OperationModeOverride
End If
Logger.Debug("OperationMode is now [{0}]", oOperationMode)
_Logger.Debug("OperationMode is now [{0}]", oOperationMode)
Catch ex As Exception
Logger.Error(ex)
Logger.Warn("Error while determining OperationMode. Setting to [{0}]", oOperationMode)
_Logger.Error(ex)
_Logger.Warn("Error while determining OperationMode. Setting to [{0}]", oOperationMode)
End Try
Return oOperationMode
@@ -166,7 +172,7 @@ Public Class frmDocumentResultList
End If
LanguageEx.LogApplicationLanguage(Logger)
LanguageEx.LogApplicationLanguage(_Logger)
Documentloader = New Loader(LogConfig, OperationMode, EDMI_API_Client, Environment.User)
@@ -316,8 +322,11 @@ Public Class frmDocumentResultList
End If
DocumentViewer1.Done()
If _documentPathHandler IsNot Nothing Then
_documentPathHandler.Cleanup()
End If
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
End Try
End Sub
@@ -341,19 +350,37 @@ Public Class frmDocumentResultList
End If
UpdateRibbonActions(oDocument)
If IsNothing(oDocument) Then
DocumentViewer1.CloseDocument()
FormHelper.ShowErrorMessage(New IOException("File could not be loaded!"), "GridView_FocusedRowChanged")
Exit Sub
End If
' Save reference to current document
_CurrentDocument = oDocument
' Load Document in Document Viewer
Dim oFileName = $"{oObjectId}.{oDocument.Extension}"
DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocument.Contents))
If IsNothing(oDocument) Then
DocumentViewer1.CloseDocument()
FormHelper.ShowErrorMessage(New IOException("File could not be loaded!"), "GridView_FocusedRowChanged")
Exit Sub
'If CopyWMFile2Temp = True Then
' _Logger.Debug("Loading document into viewer with path handler and copying WM file to temp. ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
' ' Optionen konfigurieren
' Dim options As New DocumentPathHandler.DocumentPathOptions With {
' .EnableMapping = True,
' .WMSuffix = WM_SUFFIX,
' .SpecificDrive = If(Len(MAP_SHAREDRIVE) = 1, MAP_SHAREDRIVE, ""),
' .DriveBlacklist = MAP_BLACKLIST,
' .CopyToTemp = True,
' .TempFolder = TEMP_DOCUMENT_FOLDER,
' .UnmapAfterCopy = True
' }
'Else
If Not IsNothing(oDocument.Contents) Then
_Logger.Debug("Loading document into viewer with MemoryStream handler. ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocument.Contents))
Else
_Logger.Debug("Loading document into viewer from filepath ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
DocumentViewer1.LoadFile_FromPath(oFullPath)
End If
'End If
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
Await CtrlObjectPropertyDialog.LoadObject(oObjectId)
@@ -416,7 +443,7 @@ Public Class frmDocumentResultList
Return True
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
Return False
End Try
End Function
@@ -531,7 +558,7 @@ Public Class frmDocumentResultList
CheckoutManager = New CheckInOut(LogConfig, EDMI_API_Client)
If Not EDMI_API_Client.Connect() Then
Logger.Warn("Client could not connect to Service at [{0}]", Environment.Service.Address)
_Logger.Warn("Client could not connect to Service at [{0}]", Environment.Service.Address)
Return False
End If
@@ -568,7 +595,7 @@ Public Class frmDocumentResultList
Return True
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
MessageBox.Show("Error while refreshing results:" & vbNewLine & vbNewLine & ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
@@ -580,12 +607,12 @@ Public Class frmDocumentResultList
Private Sub LoadGridData(View As GridView, Result As DocumentResultList.DocumentResult)
If Result.Datatable.Columns.Contains(ColumnDocumentId) = False Then
Logger.Error($"Datatable is missing DocId Column [{ColumnDocumentId}] for search {Result.Title}!")
_Logger.Error($"Datatable is missing DocId Column [{ColumnDocumentId}] for search {Result.Title}!")
'Throw New ApplicationException($"Datatable is missing DocId Column [{ColumnDocumentId}] for search {Result.Title}!")
End If
If OperationMode = OperationMode.NoAppServer And Result.Datatable.Columns.Contains(ColumnFilepath) = False Then
Logger.Error($"Datatable is missing Filepath Column [{ColumnFilepath}] for search {Result.Title}!")
_Logger.Error($"Datatable is missing Filepath Column [{ColumnFilepath}] for search {Result.Title}!")
'Throw New ApplicationException($"Datatable is missing Filepath Column [{ColumnFilepath}] for search {Result.Title}!")
End If
@@ -781,9 +808,9 @@ Public Class frmDocumentResultList
GridView.BestFitColumns()
Catch ex As ApplicationException
MsgBox($"Error while loading grid data for search {Result.Title}: {vbNewLine}{vbNewLine}{ex.Message}", MsgBoxStyle.Critical, Text)
Logger.Error(ex)
_Logger.Error(ex)
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
End Try
End Sub
@@ -882,7 +909,7 @@ Public Class frmDocumentResultList
Await Watcher.OpenDocument(_CurrentDocument)
End If
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
End Try
End Sub
@@ -948,7 +975,7 @@ Public Class frmDocumentResultList
Try
Await Watcher.OpenDocument(_CurrentDocument)
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
End Try
End Sub
@@ -1056,7 +1083,7 @@ Public Class frmDocumentResultList
End If
End If
Catch ex As Exception
Logger.Error(ex)
_Logger.Error(ex)
End Try
End Sub
@@ -1172,7 +1199,4 @@ Public Class frmDocumentResultList
End Sub
Private Sub GridView_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridView3.FocusedRowChanged, GridView2.FocusedRowChanged, GridView1.FocusedRowChanged
End Sub
End Class