Common: Rename IsLegacy to OperationMode, Change default Default columns, dont require fullpath for appserver mode
This commit is contained in:
parent
0b95b76f80
commit
7034ab8d10
@ -29,6 +29,8 @@ Public Class frmDataResultList
|
|||||||
|
|
||||||
Public Property ShouldReturnToPreviousForm As Boolean Implements IResultForm.ShouldReturnToPreviousForm
|
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)
|
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DataResultParams)
|
||||||
' Dieser Aufruf ist für den Designer erforderlich.
|
' Dieser Aufruf ist für den Designer erforderlich.
|
||||||
InitializeComponent()
|
InitializeComponent()
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
Imports System.Runtime.InteropServices
|
Imports System.Windows.Forms
|
||||||
Imports System.Windows.Forms
|
|
||||||
Imports DevExpress.Utils.Menu
|
Imports DevExpress.Utils.Menu
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.Windows.NativeMethods
|
|
||||||
Imports DigitalData.Modules.Windows.File
|
|
||||||
Imports DigitalData.Modules.ZooFlow
|
Imports DigitalData.Modules.ZooFlow
|
||||||
Imports DigitalData.Modules.EDMI.API.Rights
|
Imports DigitalData.Modules.EDMI.API.Rights
|
||||||
Imports DigitalData.Modules.EDMI.API
|
Imports DigitalData.Modules.EDMI.API
|
||||||
|
Imports DigitalData.GUIs.Common
|
||||||
|
|
||||||
Public Class DocumentPropertyMenu
|
Public Class DocumentPropertyMenu
|
||||||
Private ReadOnly _Logger As Logger
|
Private ReadOnly _Logger As Logger
|
||||||
@ -33,8 +31,8 @@ Public Class DocumentPropertyMenu
|
|||||||
_File = New Modules.Windows.File(LogConfig)
|
_File = New Modules.Windows.File(LogConfig)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function GetMenuItems(IsLegacy As Boolean, AccessRight As AccessRight) As List(Of DXMenuItem)
|
Public Function GetMenuItems(OperationMode As IResultForm.Mode, AccessRight As AccessRight) As List(Of DXMenuItem)
|
||||||
If IsLegacy Then
|
If OperationMode = IResultForm.Mode.NoAppServer Then
|
||||||
Return GetLegacyMenuItems()
|
Return GetLegacyMenuItems()
|
||||||
Else
|
Else
|
||||||
Return GetIDBMenuItems(AccessRight)
|
Return GetIDBMenuItems(AccessRight)
|
||||||
|
|||||||
@ -13,6 +13,6 @@ End Class
|
|||||||
|
|
||||||
Public Class ColumnNames
|
Public Class ColumnNames
|
||||||
Public ObjectIdColumn As String = "DocId"
|
Public ObjectIdColumn As String = "DocId"
|
||||||
Public FullPathColumn As String = "FULL_PATH"
|
Public FullPathColumn As String = "FULL_FILENAME"
|
||||||
Public FilenameColumn As String = "Filename"
|
Public FilenameColumn As String = "Name"
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -15,20 +15,16 @@ Imports DigitalData.Modules.EDMI.API.Client
|
|||||||
Imports DevExpress.XtraGrid.Views.Base
|
Imports DevExpress.XtraGrid.Views.Base
|
||||||
Imports DevExpress.XtraGrid.Views.BandedGrid
|
Imports DevExpress.XtraGrid.Views.BandedGrid
|
||||||
Imports System.ComponentModel
|
Imports System.ComponentModel
|
||||||
Imports System.Globalization
|
|
||||||
Imports System.Threading
|
|
||||||
|
|
||||||
Public Class frmDocumentResultList
|
Public Class frmDocumentResultList
|
||||||
Implements IResultForm
|
Implements IResultForm
|
||||||
|
|
||||||
|
|
||||||
Private COLUMN_FILEPATH = "FULL_FILENAME"
|
Private COLUMN_FILEPATH = "FULL_FILENAME"
|
||||||
Private COLUMN_FILENAME = "Filename"
|
Private COLUMN_FILENAME = "Filename"
|
||||||
Private COLUMN_DOCID = "DocID"
|
Private COLUMN_DOCID = "DocID"
|
||||||
Private COLUMN_ICON = "ICON"
|
Private COLUMN_ICON = "ICON"
|
||||||
|
|
||||||
Private _IsLoading As Boolean = True
|
Private _IsLoading As Boolean = True
|
||||||
Private _IsLegacy As Boolean = True
|
|
||||||
Private _IDBClient As Client
|
Private _IDBClient As Client
|
||||||
|
|
||||||
Private _LogConfig As LogConfig
|
Private _LogConfig As LogConfig
|
||||||
@ -44,6 +40,8 @@ Public Class frmDocumentResultList
|
|||||||
|
|
||||||
Private _DocumentInfo As DocumentInfo = Nothing
|
Private _DocumentInfo As DocumentInfo = Nothing
|
||||||
|
|
||||||
|
Private Property OperationMode As IResultForm.Mode Implements IResultForm.OperationMode
|
||||||
|
|
||||||
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DocumentResultParams)
|
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
|
Private Sub frmDocumentResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
Try
|
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
|
' Initialize Viewer with GDPicture.NET License
|
||||||
If _Environment.Settings.GdPictureKey = String.Empty Then
|
If _Environment.Settings.GdPictureKey = String.Empty Then
|
||||||
@ -83,7 +89,7 @@ Public Class frmDocumentResultList
|
|||||||
SplitContainerControl2.SplitterPosition = _Config.Config.SplitContainer2Distance
|
SplitContainerControl2.SplitterPosition = _Config.Config.SplitContainer2Distance
|
||||||
SwitchDetailContainerHorizontal.Checked = _Config.Config.SplitContainer2Horizontal
|
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
|
' Location and size will be managed by the ZooFlow Search Window
|
||||||
If Utils.IsVisibleOnAnyScreen(_Config.Config.WindowLocation) Then
|
If Utils.IsVisibleOnAnyScreen(_Config.Config.WindowLocation) Then
|
||||||
If Utils.LocationIsVisible(_Config.Config.WindowLocation) Then
|
If Utils.LocationIsVisible(_Config.Config.WindowLocation) Then
|
||||||
@ -123,9 +129,9 @@ Public Class frmDocumentResultList
|
|||||||
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
||||||
DocumentViewer1.CloseDocument()
|
DocumentViewer1.CloseDocument()
|
||||||
|
|
||||||
If _IsLegacy Then
|
If OperationMode = IResultForm.Mode.NoAppServer Then
|
||||||
LoadFile_Legacy(oRow)
|
LoadFile_Legacy(oRow)
|
||||||
Else
|
ElseIf OperationMode = IResultForm.Mode.WithAppServer Then
|
||||||
LoadFile_IDB(oRow)
|
LoadFile_IDB(oRow)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -150,20 +156,20 @@ Public Class frmDocumentResultList
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub MaybeInitIDB()
|
Private Function InitAppServer() As Boolean
|
||||||
_IsLegacy = Not _Environment.Service.IsActive
|
Dim oSplit As List(Of String) = _Environment.Service.Address.Split(":").ToList()
|
||||||
If _Environment.Service.IsActive Then
|
Dim oAddress As String = oSplit.Item(0)
|
||||||
Dim oSplit As List(Of String) = _Environment.Service.Address.Split(":").ToList()
|
Dim oPort As Integer = oSplit.Item(1)
|
||||||
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
|
If Not _IDBClient.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)
|
||||||
End If
|
Return False
|
||||||
End If
|
End If
|
||||||
End Sub
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Sub LoadFile_Legacy(GridRow As DataRow)
|
Private Sub LoadFile_Legacy(GridRow As DataRow)
|
||||||
Try
|
Try
|
||||||
@ -191,7 +197,6 @@ Public Class frmDocumentResultList
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
|
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
|
||||||
_IsLoading = True
|
_IsLoading = True
|
||||||
Try
|
Try
|
||||||
@ -214,16 +219,16 @@ Public Class frmDocumentResultList
|
|||||||
Select Case index
|
Select Case index
|
||||||
Case 0
|
Case 0
|
||||||
Dim oResult As DocumentResult = _ResultLists.Item(0)
|
Dim oResult As DocumentResult = _ResultLists.Item(0)
|
||||||
CreateDocumentGrid(GridView1, oResult.Datatable)
|
CreateDocumentGrid(GridView1, oResult)
|
||||||
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
||||||
Case 1
|
Case 1
|
||||||
Dim oResult As DocumentResult = _ResultLists.Item(1)
|
Dim oResult As DocumentResult = _ResultLists.Item(1)
|
||||||
CreateDocumentGrid(GridView2, oResult.Datatable)
|
CreateDocumentGrid(GridView2, oResult)
|
||||||
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
||||||
|
|
||||||
Case 2
|
Case 2
|
||||||
Dim oResult As DocumentResult = _ResultLists.Item(2)
|
Dim oResult As DocumentResult = _ResultLists.Item(2)
|
||||||
CreateDocumentGrid(GridView3, oResult.Datatable)
|
CreateDocumentGrid(GridView3, oResult)
|
||||||
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
||||||
|
|
||||||
Case Else
|
Case Else
|
||||||
@ -287,15 +292,15 @@ Public Class frmDocumentResultList
|
|||||||
End Select
|
End Select
|
||||||
End Sub
|
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
|
Dim oDocDatatable As New DataTable
|
||||||
Try
|
Try
|
||||||
If Datatable.Columns.Contains(COLUMN_DOCID) = False Then
|
If Result.Datatable.Columns.Contains(COLUMN_DOCID) = False Then
|
||||||
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}]!")
|
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}] for search {Result.Title}!")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
|
If OperationMode = IResultForm.Mode.NoAppServer And Result.Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
|
||||||
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}]!")
|
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}] for search {Result.Title}!")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Die Icon Colum erstellen und konfigurieren
|
'Die Icon Colum erstellen und konfigurieren
|
||||||
@ -321,7 +326,7 @@ Public Class frmDocumentResultList
|
|||||||
})
|
})
|
||||||
|
|
||||||
Dim oRestColArray As New List(Of String)
|
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
|
If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
|
||||||
Dim oNewColumn As New DataColumn() With {
|
Dim oNewColumn As New DataColumn() With {
|
||||||
.DataType = oColumn.DataType,
|
.DataType = oColumn.DataType,
|
||||||
@ -334,7 +339,7 @@ Public Class frmDocumentResultList
|
|||||||
End If
|
End If
|
||||||
Next
|
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 oFullpath = oRow.Item(COLUMN_FILEPATH)
|
||||||
Dim oDocID = oRow.Item(COLUMN_DOCID)
|
Dim oDocID = oRow.Item(COLUMN_DOCID)
|
||||||
Dim oFilename = Path.GetFileName(oFullpath)
|
Dim oFilename = Path.GetFileName(oFullpath)
|
||||||
@ -379,8 +384,8 @@ Public Class frmDocumentResultList
|
|||||||
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
|
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
|
||||||
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
|
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
|
||||||
|
|
||||||
If _IsLegacy = False Then
|
If OperationMode = IResultForm.Mode.WithAppServer Then
|
||||||
' Hide Fullpath completely in IDB Mode
|
' Hide Fullpath completely in AppServer Mode
|
||||||
GridView.Columns.Item(COLUMN_FILEPATH).OptionsColumn.ShowInCustomizationForm = False
|
GridView.Columns.Item(COLUMN_FILEPATH).OptionsColumn.ShowInCustomizationForm = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -407,7 +412,7 @@ Public Class frmDocumentResultList
|
|||||||
GridView.OptionsView.BestFitMaxRowCount = -1
|
GridView.OptionsView.BestFitMaxRowCount = -1
|
||||||
GridView.BestFitColumns(True)
|
GridView.BestFitColumns(True)
|
||||||
Catch ex As ApplicationException
|
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)
|
_Logger.Error(ex)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
@ -620,7 +625,7 @@ Public Class frmDocumentResultList
|
|||||||
|
|
||||||
e.Menu.Items.Clear()
|
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)
|
e.Menu.Items.Add(oItem)
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
Public Interface IResultForm
|
Public Interface IResultForm
|
||||||
|
Enum Mode
|
||||||
|
WithAppServer
|
||||||
|
NoAppServer
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Property OperationMode As Mode
|
||||||
|
|
||||||
Property ShouldReturnToPreviousForm As Boolean
|
Property ShouldReturnToPreviousForm As Boolean
|
||||||
Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean
|
Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean
|
||||||
End Interface
|
End Interface
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user