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

@@ -20,14 +20,9 @@ Public Class ClassFolderwatcher
'Gestartet also Stoppen
FWFolderWatcher.EnableRaisingEvents = False
My.Application.Globix.Folderwatchstarted = False
'FolderWatch neu instanzieren
FWFolderWatcher = New FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*")
Logger.Info(" >> FolderWatch neu instanziert")
FWFolderWatcher.IncludeSubdirectories = False
FWFolderWatcher.EnableRaisingEvents = True
AddHandler FWFolderWatcher.Created, AddressOf OnCreated
FWFolderWatcher = StartFolderwatcherForPath(My.Application.Globix.CurrentFolderWatchPath)
My.Application.Globix.Folderwatchstarted = True
'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "True")
My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save()
End If
@@ -43,13 +38,10 @@ Public Class ClassFolderwatcher
If FWScan.EnableRaisingEvents = True Then
'Gestartet also Stoppen
FWScan.EnableRaisingEvents = False
'FolderWatch neu instanzieren
FWScan = New System.IO.FileSystemWatcher(My.Application.Globix.CURRENT_SCAN_FOLDERWATCH, "*.*")
Logger.Info(" >> FolderWatchScan neu instanziert")
FWScan.IncludeSubdirectories = False
FWScan.EnableRaisingEvents = True
AddHandler FWScan.Created, AddressOf OnCreated
'SaveConfigValue("FWSCAN_started", "True")
FWScan = StartFolderwatcherForPath(My.Application.Globix.CURRENT_SCAN_FOLDERWATCH)
My.UIConfig.Globix.FolderWatchScanStarted = True
My.UIConfigManager.Save()
End If
@@ -60,28 +52,16 @@ Public Class ClassFolderwatcher
End Sub
Public Sub StartStop_FolderWatch()
Try
If FWFolderWatcher Is Nothing Then
FWFolderWatcher = New System.IO.FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*")
Logger.Info(" >> FolderWatch Gestartet")
FWFolderWatcher.IncludeSubdirectories = False
FWFolderWatcher.EnableRaisingEvents = True
AddHandler FWFolderWatcher.Created, AddressOf OnCreated
If FWFolderWatcher Is Nothing OrElse FWFolderWatcher.EnableRaisingEvents = False Then
' Folderwatch neu instanzieren
FWFolderWatcher = StartFolderwatcherForPath(My.Application.Globix.CurrentFolderWatchPath)
My.Application.Globix.Folderwatchstarted = True
My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save()
End If
If FWFolderWatcher.EnableRaisingEvents = False Then
' Dim watcher As New FileSystemWatcher()
' watcher.Path = CURRENT_FOLDERWATCH
FWFolderWatcher = New System.IO.FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*")
Logger.Info(" >> FolderWatch Gestartet")
FWFolderWatcher.IncludeSubdirectories = False
FWFolderWatcher.EnableRaisingEvents = True
AddHandler FWFolderWatcher.Created, AddressOf OnCreated
My.Application.Globix.Folderwatchstarted = True
My.UIConfig.Globix.FolderWatchStarted = True
My.UIConfigManager.Save()
Else
If FWFolderWatcher.EnableRaisingEvents = True Then
'Gestartet also Stoppen
FWFolderWatcher.EnableRaisingEvents = False
My.Application.Globix.Folderwatchstarted = False
@@ -161,6 +141,21 @@ Public Class ClassFolderwatcher
Return False
End If
End Function
Private Function StartFolderwatcherForPath(pPath As String) As FileSystemWatcher
Dim oWatcher = New FileSystemWatcher(pPath, "*.*") With {
.IncludeSubdirectories = False,
.EnableRaisingEvents = True
}
AddHandler oWatcher.Created, AddressOf OnCreated
Logger.Debug("Folder Watcher started for Path [{0}]", pPath)
My.UIConfig.Globix.FolderWatchScanStarted = True
My.UIConfigManager.Save()
Return oWatcher
End Function
Private Sub OnCreated(source As Object, e As FileSystemEventArgs)
Try
If Not IsNothing(My.Application.Globix.DTEXCLUDE_FILES) Then