#Region "File System Watcher ~MatthiWare~"
Protected Friend Sub MaakFSWatchers()
' Verkrijg elke HDD
For Each drive As DriveInfo In DriveInfo.GetDrives()
'nu gaat hij door elke drive in het systeem
'maak nu een file system watcher voor elke hdd
Dim fsw As New IO.FileSystemWatcher(drive.RootDirectory.ToString())
'de eigenschappen juist zetten
fsw.EnableRaisingEvents = True
fsw.IncludeSubdirectories = True
'de evenementen toevoegen
AddHandler fsw.Changed, AddressOf onChanged
AddHandler fsw.Created, AddressOf onCreated
AddHandler fsw.Renamed, AddressOf onRename
'voila ze zijn klaar nu gewoon nog de code in de sub's toevoegen
Console.WriteLine(String.Format("FileSystemWatcher gemaakt voor: {0}", drive.RootDirectory.ToString()))
Next
Console.WriteLine("FSWatchers zijn klaar voor gebruik!")
End Sub
Protected Friend Sub onChanged(ByVal sender As Object, ByVal e As FileSystemEventArgs)
MsgBox(e.FullPath)
Throw New NotImplementedException("Je moet er wel je eigen code inzetten hé :)")
End Sub
Protected Friend Sub onCreated(ByVal sender As Object, ByVal e As FileSystemEventArgs)
MsgBox(e.FullPath)
Throw New NotImplementedException("Je moet er wel je eigen code inzetten hé :)")
End Sub
Protected Friend Sub onRename(ByVal sender As Object, ByVal e As FileSystemEventArgs)
MsgBox(e.FullPath)
Throw New NotImplementedException("Je moet er wel je eigen code inzetten hé :)")
End Sub
#End Region