Common: Disable Watcher when opmode = notappserver

This commit is contained in:
Jonathan Jenne
2022-04-05 14:16:44 +02:00
parent f515ebf69f
commit a5fb2dac3f
2 changed files with 30 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ Namespace DocumentResultList
Private WithEvents FileOpenTimer As New Timer
Private FileEx As Modules.Filesystem.File
Private EnableWatching As Boolean = True
' TODO: Hashes for checking if the opened file was modified externally
Private HashOriginalFile As String = Nothing
@@ -47,8 +48,13 @@ Namespace DocumentResultList
End Class
Public Sub New(pLogConfig As LogConfig)
MyClass.New(pLogConfig, True)
End Sub
Public Sub New(pLogConfig As LogConfig, pEnableWatching As Boolean)
MyBase.New(pLogConfig)
FileEx = New Modules.Filesystem.File(pLogConfig)
EnableWatching = pEnableWatching
End Sub
Public Async Function OpenDocument(pDocument As Document) As Task(Of Boolean)
@@ -68,6 +74,11 @@ Namespace DocumentResultList
Return False
End If
If EnableWatching = False Then
Logger.Debug("File was opened. Watching and Events are disabled.")
Return True
End If
Dim oProcessId = oResult.Item1
Dim oFilePath = oResult.Item2