Common/DocumentResultList: WIP Opening and updating files

This commit is contained in:
Jonathan Jenne
2022-01-18 16:18:16 +01:00
parent 9d51074991
commit cc24b8eb31
4 changed files with 83 additions and 48 deletions

View File

@@ -63,12 +63,6 @@ Public Class frmDocumentResultList
Private _FileOpenList As New Dictionary(Of Integer, String)
Private ReadOnly _Language As String
' TODO: Hashes for checking if the opened file was modified externally
Private _HashOriginalFile As String = Nothing
Private _HashOpenedFile As String = Nothing
Private WithEvents _FileOpenTimer As New Timer
Private Property OperationMode As OperationMode Implements IResultForm.OperationMode
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
@@ -609,38 +603,7 @@ Public Class frmDocumentResultList
End Function
Public Sub FileOpenTimer_Elapsed() Handles _FileOpenTimer.Tick
Try
Dim oIds = Process.GetProcesses().
Select(Function(process) process.Id).
ToList()
Dim oNewFileOpenList As New Dictionary(Of Integer, String)
For Each oOpenFile In _FileOpenList
If oIds.Contains(oOpenFile.Key) Then
oNewFileOpenList.Add(oOpenFile.Key, oOpenFile.Value)
End If
Next
If oNewFileOpenList.Count < _FileOpenList.Count Then
Dim oClosedFiles = _FileOpenList.
Except(oNewFileOpenList).
ToList()
If oClosedFiles.Count = 1 Then
Dim oOpenFile = oClosedFiles.First()
DocumentViewer1.LoadFile(oOpenFile.Value)
Else
'ClearGridData()
UpdateGridData()
End If
_FileOpenList = oNewFileOpenList
End If
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub
#Region "Context Menu"
Private Sub GridView_PopupMenuShowing(sender As Object, e As PopupMenuShowingEventArgs) Handles GridView2.PopupMenuShowing, GridView3.PopupMenuShowing, GridView1.PopupMenuShowing