Common: Fix Property Dialog, Fix context Menu in DocumentResultList

This commit is contained in:
Jonathan Jenne
2021-01-05 16:06:43 +01:00
parent 9cfdacb6f8
commit 59e925d6b2
10 changed files with 274 additions and 133 deletions

View File

@@ -135,52 +135,66 @@ Public Class frmDocumentResultList
End Try
End Sub
Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
Private Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
_ActiveRowHandle = e.FocusedRowHandle
If e.FocusedRowHandle >= 0 Then
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
DocumentViewer1.CloseDocument()
Try
Cursor = Cursors.WaitCursor
If _IsLegacy Then
LoadFile_Legacy(oRow)
Else
Await LoadFile_IDB(oRow)
If e.FocusedRowHandle >= 0 Then
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
DocumentViewer1.CloseDocument()
If _IsLegacy Then
LoadFile_Legacy(oRow)
Else
LoadFile_IDB(oRow)
End If
DocumentViewer1.LoadFile(_DocumentInfo.FullPath)
If _DocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
DocumentViewer1.SetViewOnly(True)
RibbonPageGroup_Export.Visible = False
Else
DocumentViewer1.SetViewOnly(False)
RibbonPageGroup_Export.Visible = True
End If
End If
End If
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Error while changing row: " & ex.Message, MsgBoxStyle.Critical, Text)
Finally
Cursor = Cursors.Default
End Try
End Sub
Private Sub LoadFile_Legacy(GridRow As DataRow)
Try
Dim oFullPath = GridRow.Item(COLUMN_FILEPATH)
DocumentViewer1.LoadFile(oFullPath)
_DocumentInfo = New DocumentInfo() With {
.AccessRight = Rights.AccessRight.FULL,
.FullPath = oFullPath
}
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Error while loading file", MsgBoxStyle.Critical, Text)
End Try
End Sub
Private Async Function LoadFile_IDB(GridRow As DataRow) As Task
Private Sub LoadFile_IDB(GridRow As DataRow)
Try
Dim oObjectId = GridRow.Item(COLUMN_DOCID)
_Logger.Debug($"Gettin' Infor for oObjectId: {oObjectId}")
_DocumentInfo = Await _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId)
DocumentViewer1.LoadFile(_DocumentInfo.FullPath)
If _DocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
DocumentViewer1.SetViewOnly(True)
RibbonPageGroup_Export.Visible = False
Else
DocumentViewer1.SetViewOnly(False)
RibbonPageGroup_Export.Visible = True
End If
' This needs to be Sync bc otherwise the PopupMenuShowing event will fire before this method loaded the Document Info
_DocumentInfo = _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId)
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Error while loading file", MsgBoxStyle.Critical, Text)
End Try
End Function
End Sub
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
@@ -589,7 +603,7 @@ Public Class frmDocumentResultList
If oRow IsNot Nothing Then
Dim oObjectId = oRow.Item(COLUMN_DOCID)
Dim oPropertyDialog As New frmObjectPropertyDialog(_LogConfig, _Environment, oObjectId)
Dim oPropertyDialog As New frmObjectPropertyDialog(_LogConfig, _Environment, _IDBClient, oObjectId)
oPropertyDialog.Show()
End If
Catch ex As Exception
@@ -645,6 +659,7 @@ Public Class frmDocumentResultList
Dim oMenu As New DocumentPropertyMenu(
_LogConfig,
_Environment,
_IDBClient,
oFilepath,
oObjectId)