This commit is contained in:
SchreiberM 2021-01-07 12:39:48 +01:00
commit bc54fc0211
6 changed files with 57 additions and 48 deletions

View File

@ -29,6 +29,8 @@ Public Class frmDataResultList
Public Property ShouldReturnToPreviousForm As Boolean Implements IResultForm.ShouldReturnToPreviousForm
Private Property OperationMode As IResultForm.Mode Implements IResultForm.OperationMode
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DataResultParams)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()

View File

@ -1,12 +1,10 @@
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.Windows.Forms
Imports DevExpress.Utils.Menu
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Windows.NativeMethods
Imports DigitalData.Modules.Windows.File
Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.EDMI.API.Rights
Imports DigitalData.Modules.EDMI.API
Imports DigitalData.GUIs.Common
Public Class DocumentPropertyMenu
Private ReadOnly _Logger As Logger
@ -33,8 +31,8 @@ Public Class DocumentPropertyMenu
_File = New Modules.Windows.File(LogConfig)
End Sub
Public Function GetMenuItems(IsLegacy As Boolean, AccessRight As AccessRight) As List(Of DXMenuItem)
If IsLegacy Then
Public Function GetMenuItems(OperationMode As IResultForm.Mode, AccessRight As AccessRight) As List(Of DXMenuItem)
If OperationMode = IResultForm.Mode.NoAppServer Then
Return GetLegacyMenuItems()
Else
Return GetIDBMenuItems(AccessRight)

View File

@ -13,6 +13,6 @@ End Class
Public Class ColumnNames
Public ObjectIdColumn As String = "DocId"
Public FullPathColumn As String = "FULL_PATH"
Public FilenameColumn As String = "Filename"
Public FullPathColumn As String = "FULL_FILENAME"
Public FilenameColumn As String = "Name"
End Class

View File

@ -15,20 +15,16 @@ Imports DigitalData.Modules.EDMI.API.Client
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.BandedGrid
Imports System.ComponentModel
Imports System.Globalization
Imports System.Threading
Public Class frmDocumentResultList
Implements IResultForm
Private COLUMN_FILEPATH = "FULL_FILENAME"
Private COLUMN_FILENAME = "Filename"
Private COLUMN_DOCID = "DocID"
Private COLUMN_ICON = "ICON"
Private _IsLoading As Boolean = True
Private _IsLegacy As Boolean = True
Private _IDBClient As Client
Private _LogConfig As LogConfig
@ -44,6 +40,8 @@ Public Class frmDocumentResultList
Private _DocumentInfo As DocumentInfo = Nothing
Private Property OperationMode As IResultForm.Mode Implements IResultForm.OperationMode
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DocumentResultParams)
@ -69,7 +67,15 @@ Public Class frmDocumentResultList
Private Sub frmDocumentResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
MaybeInitIDB()
If _Environment.Service.IsActive AndAlso _Environment.Service.Address <> String.Empty Then
OperationMode = IResultForm.Mode.WithAppServer
Else
OperationMode = IResultForm.Mode.NoAppServer
End If
If OperationMode = IResultForm.Mode.WithAppServer Then
InitAppServer()
End If
' Initialize Viewer with GDPicture.NET License
If _Environment.Settings.GdPictureKey = String.Empty Then
@ -83,7 +89,7 @@ Public Class frmDocumentResultList
SplitContainerControl2.SplitterPosition = _Config.Config.SplitContainer2Distance
SwitchDetailContainerHorizontal.Checked = _Config.Config.SplitContainer2Horizontal
If _IsLegacy = False Then
If OperationMode <> IResultForm.Mode.NoAppServer Then
' Location and size will be managed by the ZooFlow Search Window
If Utils.IsVisibleOnAnyScreen(_Config.Config.WindowLocation) Then
If Utils.LocationIsVisible(_Config.Config.WindowLocation) Then
@ -123,9 +129,9 @@ Public Class frmDocumentResultList
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
DocumentViewer1.CloseDocument()
If _IsLegacy Then
If OperationMode = IResultForm.Mode.NoAppServer Then
LoadFile_Legacy(oRow)
Else
ElseIf OperationMode = IResultForm.Mode.WithAppServer Then
LoadFile_IDB(oRow)
End If
@ -150,20 +156,20 @@ Public Class frmDocumentResultList
End Try
End Sub
Private Sub MaybeInitIDB()
_IsLegacy = Not _Environment.Service.IsActive
If _Environment.Service.IsActive Then
Dim oSplit As List(Of String) = _Environment.Service.Address.Split(":").ToList()
Dim oAddress As String = oSplit.Item(0)
Dim oPort As Integer = oSplit.Item(1)
Private Function InitAppServer() As Boolean
Dim oSplit As List(Of String) = _Environment.Service.Address.Split(":").ToList()
Dim oAddress As String = oSplit.Item(0)
Dim oPort As Integer = oSplit.Item(1)
_IDBClient = New Client(_LogConfig, oAddress, oPort)
_IDBClient = New Client(_LogConfig, oAddress, oPort)
If Not _IDBClient.Connect() Then
_Logger.Warn("Client could not connect to Service at [{0}]", _Environment.Service.Address)
End If
If Not _IDBClient.Connect() Then
_Logger.Warn("Client could not connect to Service at [{0}]", _Environment.Service.Address)
Return False
End If
End Sub
Return True
End Function
Private Sub LoadFile_Legacy(GridRow As DataRow)
Try
@ -191,7 +197,6 @@ Public Class frmDocumentResultList
End Try
End Sub
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
_IsLoading = True
Try
@ -214,16 +219,16 @@ Public Class frmDocumentResultList
Select Case index
Case 0
Dim oResult As DocumentResult = _ResultLists.Item(0)
CreateDocumentGrid(GridView1, oResult.Datatable)
CreateDocumentGrid(GridView1, oResult)
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
Case 1
Dim oResult As DocumentResult = _ResultLists.Item(1)
CreateDocumentGrid(GridView2, oResult.Datatable)
CreateDocumentGrid(GridView2, oResult)
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
Case 2
Dim oResult As DocumentResult = _ResultLists.Item(2)
CreateDocumentGrid(GridView3, oResult.Datatable)
CreateDocumentGrid(GridView3, oResult)
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
Case Else
@ -287,17 +292,15 @@ Public Class frmDocumentResultList
End Select
End Sub
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
Private Sub CreateDocumentGrid(GridView As GridView, Result As DocumentResult)
Dim oDocDatatable As New DataTable
Try
If Datatable.Columns.Contains(COLUMN_DOCID) = False Then
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}]!")
If Result.Datatable.Columns.Contains(COLUMN_DOCID) = False Then
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}] for search {Result.Title}!")
End If
If _IsLegacy Then
End If
If Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}]!")
If OperationMode = IResultForm.Mode.NoAppServer And Result.Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}] for search {Result.Title}!")
End If
'Die Icon Colum erstellen und konfigurieren
@ -323,7 +326,7 @@ Public Class frmDocumentResultList
})
Dim oRestColArray As New List(Of String)
For Each oColumn As DataColumn In Datatable.Columns
For Each oColumn As DataColumn In Result.Datatable.Columns
If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
Dim oNewColumn As New DataColumn() With {
.DataType = oColumn.DataType,
@ -336,7 +339,7 @@ Public Class frmDocumentResultList
End If
Next
For Each oRow As DataRow In Datatable.Rows
For Each oRow As DataRow In Result.Datatable.Rows
Dim oFullpath = oRow.Item(COLUMN_FILEPATH)
Dim oDocID = oRow.Item(COLUMN_DOCID)
Dim oFilename = Path.GetFileName(oFullpath)
@ -377,13 +380,12 @@ Public Class frmDocumentResultList
Try
GridView.Columns.Item(COLUMN_DOCID).Visible = False
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
If _IsLegacy = False Then
' Hide Fullpath completely in IDB Mode
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
If OperationMode = IResultForm.Mode.WithAppServer Then
' Hide Fullpath completely in AppServer Mode
GridView.Columns.Item(COLUMN_FILEPATH).OptionsColumn.ShowInCustomizationForm = False
End If
@ -410,7 +412,7 @@ Public Class frmDocumentResultList
GridView.OptionsView.BestFitMaxRowCount = -1
GridView.BestFitColumns(True)
Catch ex As ApplicationException
MsgBox($"Error while loading grid data: {vbNewLine}{vbNewLine}{ex.Message}", MsgBoxStyle.Critical, Text)
MsgBox($"Error while loading grid data for search {Result.Title}: {vbNewLine}{vbNewLine}{ex.Message}", MsgBoxStyle.Critical, Text)
_Logger.Error(ex)
Catch ex As Exception
_Logger.Error(ex)
@ -623,7 +625,7 @@ Public Class frmDocumentResultList
e.Menu.Items.Clear()
For Each oItem In oMenu.GetMenuItems(_IsLegacy, _DocumentInfo.AccessRight)
For Each oItem In oMenu.GetMenuItems(OperationMode, _DocumentInfo.AccessRight)
e.Menu.Items.Add(oItem)
Next
End If

View File

@ -1,4 +1,11 @@
Public Interface IResultForm
Enum Mode
WithAppServer
NoAppServer
End Enum
Property OperationMode As Mode
Property ShouldReturnToPreviousForm As Boolean
Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean
End Interface

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.1.0")>
<Assembly: AssemblyFileVersion("1.2.1.0")>
<Assembly: AssemblyVersion("1.2.2.0")>
<Assembly: AssemblyFileVersion("1.2.2.0")>