Handling in DocumentResultLsit

This commit is contained in:
Developer01
2026-05-05 08:04:48 +02:00
parent 734e056248
commit 45485400e1
3 changed files with 66 additions and 54 deletions

View File

@@ -269,7 +269,8 @@ Public Class frmDocumentResultList
' This loads the default workspace, for now
Workspace.LoadWorkspace(Config.Config.SelectedWorkspace)
' Selektion zuverlässig setzen
SelectFirstRowInGrid1()
' This needs to done be after loading the grid
' so we can set the row handle and start loading the (only) file
@@ -304,7 +305,13 @@ Public Class frmDocumentResultList
End Try
End Sub
Private Sub SelectFirstRowInGrid1()
If GridView1.RowCount > 0 Then
GridView1.FocusedRowHandle = 0
Else
GridView1.FocusedRowHandle = GridControl.InvalidRowHandle
End If
End Sub
Private Sub Workspace_WorkspaceLoaded(sender As Object, e As String)
lblCurrentWorkspace.Caption = String.Format(lblCurrentWorkspace.Tag, e)
End Sub
@@ -374,10 +381,10 @@ Public Class frmDocumentResultList
' }
'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))
_Logger.Debug("Loading document into viewer with MemoryStream handler (LoadFile_FromStream). ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
DocumentViewer1.LoadFile_FromStream(oFileName, New MemoryStream(oDocument.Contents))
Else
_Logger.Debug("Loading document into viewer from filepath ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
_Logger.Debug("Loading document into viewer from filepath (LoadFile_FromPath). ObjectId: [{0}], Filename: [{1}], FullPath: [{2}]", oObjectId, oFileName, oFullPath)
DocumentViewer1.LoadFile_FromPath(oFullPath)
End If
'End If
@@ -589,9 +596,14 @@ Public Class frmDocumentResultList
UpdateTotalResults()
LoadGridDataAndLayout()
' After the new results are loaded, set the old row handle
' to trigger the row change events and load object properties
GridView1.FocusedRowHandle = oCurrentRowHandle
' Restore old selection only if still valid; otherwise select first row
If GridView1.IsValidRowHandle(oCurrentRowHandle) Then
GridView1.FocusedRowHandle = oCurrentRowHandle
ElseIf GridView1.RowCount > 0 Then
GridView1.FocusedRowHandle = 0
Else
GridView1.FocusedRowHandle = GridControl.InvalidRowHandle
End If
Return True
Catch ex As Exception