Zooflow: Update clipboard watcher module for zooflow

This commit is contained in:
Jonathan Jenne
2021-12-17 10:25:39 +01:00
parent cb00685085
commit 59d36568ed
16 changed files with 157 additions and 1196 deletions

View File

@@ -118,6 +118,7 @@
</Compile>
<Compile Include="DocumentResultList\DocumentResultCache.vb" />
<Compile Include="GridBuilder.vb" />
<Compile Include="Helpers.vb" />
<Compile Include="IResultForm.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">

View File

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

View File

@@ -1,4 +1,6 @@
Public Class DocumentResultParams
Imports DigitalData.GUIs.Common.Helpers
Public Class DocumentResultParams
''' <summary>
''' WindowGuid is used to save layout data
''' </summary>
@@ -6,6 +8,7 @@
Public WindowTitle As String = ""
Public Results As New List(Of DocumentResult)
Public ColumnNames As New ColumnNames
Public OperationModeOverride As OperationMode = OperationMode.None
End Class
Public Class DocumentResult
@@ -16,4 +19,5 @@ Public Class ColumnNames
Public ObjectIdColumn As String = "DocId"
Public FullPathColumn As String = "FULL_FILENAME"
Public FilenameColumn As String = "Name"
Public IconColumn As String = "ICON"
End Class

View File

@@ -7,7 +7,6 @@ Imports DevExpress.XtraBars
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraGrid.Menu
Imports DevExpress.XtraGrid.Views.BandedGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Grid
@@ -16,21 +15,20 @@ Imports DevExpress.XtraPrinting
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.EDMI.API.Client
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.Filesystem
Public Class frmDocumentResultList
Implements IResultForm
' These are NOT constants, only defaults
' Can be changed when calling frmDocumentResultList
Private COLUMN_FILEPATH As String = "FULL_FILENAME"
Private COLUMN_FILENAME As String = "Filename"
Private COLUMN_DOCID As String = "DocID"
Private COLUMN_ICON As String = "ICON"
Private ReadOnly COLUMN_FILEPATH As String = "FULL_FILENAME"
Private ReadOnly COLUMN_FILENAME As String = "Filename"
Private ReadOnly COLUMN_DOCID As String = "DocID"
Private ReadOnly COLUMN_ICON As String = "ICON"
' Constants
Private Const OPEN_FILE As String = "Datei öffnen"
@@ -43,16 +41,17 @@ Public Class frmDocumentResultList
' Helper Classes
Private _IDBClient As Client
Private _LogConfig As LogConfig
Private _Logger As Logger
Private _Config As ConfigManager(Of DocumentResultConfig)
Private _Environment As Environment
Private _Params As DocumentResultParams
Private _ResultLists As List(Of DocumentResult)
Private _Helpers As DocumentResultList
Private _Filesystem As Modules.Filesystem.File
Private _GridBuilder As GridBuilder
Private _File As Modules.Windows.File
Private ReadOnly _LogConfig As LogConfig
Private ReadOnly _Logger As Logger
Private ReadOnly _Config As ConfigManager(Of DocumentResultConfig)
Private ReadOnly _Environment As Environment
Private ReadOnly _Params As DocumentResultParams
Private ReadOnly _ResultLists As List(Of DocumentResult)
Private ReadOnly _Helpers As DocumentResultList
Private ReadOnly _Filesystem As Modules.Filesystem.File
Private ReadOnly _GridBuilder As GridBuilder
Private ReadOnly _File As Modules.Windows.File
Private ReadOnly _OpenDocuments As New DocumentResultCache(50000000)
' Runtime variables
Private _IsLoading As Boolean = True
@@ -63,13 +62,13 @@ Public Class frmDocumentResultList
'Private _HashOriginalFile As String = Nothing
'Private _HashOpenedFile As String = Nothing
Private WithEvents _FileOpenTimer As New Timer
Private _OpenDocuments As New DocumentResultCache(50000000)
Private _CurrentDocument As DocumentResultInfo = Nothing
Private _CurrentDocumentId As Long = Nothing
Private _Language As String
Private ReadOnly _Language As String
Private Property OperationMode As IResultForm.Mode Implements IResultForm.OperationMode
Private WithEvents _FileOpenTimer As New Timer
Private Property OperationMode As Helpers.OperationMode Implements IResultForm.OperationMode
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
@@ -83,6 +82,7 @@ Public Class frmDocumentResultList
COLUMN_DOCID = Params.ColumnNames.ObjectIdColumn
COLUMN_FILENAME = Params.ColumnNames.FilenameColumn
COLUMN_FILEPATH = Params.ColumnNames.FullPathColumn
COLUMN_ICON = Params.ColumnNames.IconColumn
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
@@ -97,15 +97,28 @@ Public Class frmDocumentResultList
_Language = Utils.NotNull(_Environment.User.Language, State.UserState.LANG_EN_US)
End Sub
Private Function GetOperationMode() As Helpers.OperationMode
Dim oOperationMode = OperationMode.None
If _Environment.Service.IsActive AndAlso _Environment.Service.Address <> String.Empty Then
oOperationMode = Helpers.OperationMode.WithAppServer
Else
oOperationMode = Helpers.OperationMode.NoAppServer
End If
If _Params.OperationModeOverride <> Helpers.OperationMode.None Then
oOperationMode = _Params.OperationModeOverride
End If
Return oOperationMode
End Function
Private Sub frmDocumentResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
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
' Operation mode is either guessed from service settings
' or explictly set from OperationModeOverride in Params
OperationMode = GetOperationMode()
If OperationMode = Helpers.OperationMode.WithAppServer Then
InitAppServer()
End If
@@ -125,7 +138,7 @@ Public Class frmDocumentResultList
SplitContainerControl2.SplitterPosition = _Config.Config.SplitContainer2Distance
SwitchDetailContainerHorizontal.Checked = _Config.Config.SplitContainer2Horizontal
If OperationMode <> IResultForm.Mode.NoAppServer Then
If OperationMode <> Helpers.OperationMode.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
@@ -136,8 +149,8 @@ Public Class frmDocumentResultList
End If
End If
SwitchMainContainerHorizontal.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
SwitchDetailContainerHorizontal.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
SwitchMainContainerHorizontal.Visibility = BarItemVisibility.Never
SwitchDetailContainerHorizontal.Visibility = BarItemVisibility.Never
End If
_GridBuilder.
@@ -171,11 +184,33 @@ Public Class frmDocumentResultList
DocumentViewer1.CloseDocument()
If OperationMode = IResultForm.Mode.NoAppServer Then
oDocumentInfo = LoadFile_Legacy(oRow)
ElseIf OperationMode = IResultForm.Mode.WithAppServer Then
oDocumentInfo = LoadFile_IDB(oRow)
End If
Select Case OperationMode
Case Helpers.OperationMode.NoAppServer
oDocumentInfo = LoadFile_Legacy(oRow)
If oDocumentInfo.Contents IsNot Nothing Then
Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
DocumentViewer1.LoadFile(oFileInfo.Name, New MemoryStream(oDocumentInfo.Contents))
Else
DocumentViewer1.LoadFile(oDocumentInfo.FullPath)
End If
Case Helpers.OperationMode.WithAppServer
oDocumentInfo = LoadFile_IDB(oRow)
If oDocumentInfo.Contents IsNot Nothing Then
Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
DocumentViewer1.LoadFile(oFileInfo.Name, New MemoryStream(oDocumentInfo.Contents))
Else
DocumentViewer1.LoadFile(oDocumentInfo.FullPath)
End If
Case Helpers.OperationMode.ZooFlow
oDocumentInfo = LoadFile_ZooFlow(oRow)
End Select
If IsNothing(oDocumentInfo) Then
Show_Warning("File could not be loaded!")
@@ -191,7 +226,6 @@ Public Class frmDocumentResultList
If oDocumentInfo.Contents IsNot Nothing Then
Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
DocumentViewer1.LoadFile(oFileInfo.Name, New MemoryStream(oDocumentInfo.Contents))
Else
DocumentViewer1.LoadFile(oDocumentInfo.FullPath)
@@ -281,6 +315,27 @@ Public Class frmDocumentResultList
End Try
End Function
Private Function LoadFile_ZooFlow(GridRow As DataRow)
Try
Dim oObjectId = GridRow.Item(COLUMN_DOCID)
_Logger.Debug("Loading FileObject for ObjectId: [{0}]", oObjectId)
' This needs to be Sync bc otherwise the PopupMenuShowing event will fire before this method loaded the FileObject
Dim oFileObject As FileObject = _IDBClient.GetFileObject(oObjectId)
Dim oResultDocumentInfo As New DocumentResultInfo() With {
.AccessRight = "",
.FullPath = "",
.Contents = oFileObject._FileContents
}
_Logger.Debug("Successfully loaded Information for ObjectId: [{0}]", oObjectId)
Catch ex As Exception
_Logger.Error(ex)
Return Nothing
End Try
End Function
Private Function LoadFile_AsByteArray(DocumentInfo As DocumentResultInfo) As DocumentResultInfo
Try
_Logger.Debug("Loading File [{0}]", DocumentInfo.FullPath)
@@ -380,7 +435,7 @@ Public Class frmDocumentResultList
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}] for search {Result.Title}!")
End If
If OperationMode = IResultForm.Mode.NoAppServer And Result.Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
If OperationMode = Helpers.OperationMode.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
@@ -516,7 +571,7 @@ Public Class frmDocumentResultList
oFilePathColumn.Visible = False
' Hide Fullpath column completely in AppServer-Mode
If OperationMode = IResultForm.Mode.WithAppServer Then
If OperationMode = Helpers.OperationMode.WithAppServer Then
oFilePathColumn.OptionsColumn.ShowInCustomizationForm = False
End If
End If
@@ -877,7 +932,7 @@ Public Class frmDocumentResultList
_CurrentDocumentId = oObjectId
If OperationMode = IResultForm.Mode.WithAppServer Then
If OperationMode = Helpers.OperationMode.WithAppServer Then
If oRight = Rights.AccessRight.FULL Or oRight = Rights.AccessRight.VIEW_EXPORT Then
MenuFullAccess_IDB.ShowPopup(oPoint)
Else

8
GUIs.Common/Helpers.vb Normal file
View File

@@ -0,0 +1,8 @@
Public Class Helpers
Public Enum OperationMode
WithAppServer
NoAppServer
ZooFlow
None
End Enum
End Class

View File

@@ -1,10 +1,7 @@
Public Interface IResultForm
Enum Mode
WithAppServer
NoAppServer
End Enum
Imports DigitalData.GUIs.Common.Helpers
Property OperationMode As Mode
Public Interface IResultForm
Property OperationMode As OperationMode
Property ShouldReturnToPreviousForm As Boolean
Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean

View File

@@ -0,0 +1,3 @@
DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a