Class Name: |
HL7PlusFileWatcher |
HL7+ Category: |
|
Description: |
General purpose event driven stateless file watching object |
Why the HL7PlusFileWatcher? Because sometimes you might need a quick and easy background process that will just watch a file on the file system send you an event if it changes or is deleted.
*All example code is in Visual Basic.Net
'Declare your file watcher at the class level Private WithEvents oWatcher As HL7PlusFileWatcher = Nothing
'Start the File Watcher object Private Sub ButtonStart(sender As Object, e As EventArgs) Handles ButtonStart.Click Try oWatcher = New HL7PlusFileWatcher("C:\HL7\SomeFile.hl7") oWatcher.RefreshInterval = HL7PlusFileWatcher.UPFWRefreshInterval.RI10Seconds oWatcher.StartMonitor() Catch ex As Exception MessageBox.Show(ex.Message, "Error Starting") End Try End Sub
'Stop the File Watcher object Private Sub ButtonStop(sender As Object, e As EventArgs) Handles ButtonStop.Click Try If Not IsNothing(oWatcher) Then If oWatcher.IsRunning Then oWatcher.StopMonitor() End If End If Catch ex As Exception MessageBox.Show(ex.Message, "Error Stopping") End Try End Sub
|
Enumerator Name: UPFWRefreshInterval
Description: Used to set the refresh interval (in milliseconds) when the HL7PlusFileWatcher is running Members: RI5Seconds = 5000 RI10Seconds = 10000 RI20Seconds = 20000 RI30Seconds = 30000 RI45Seconds = 45000 RI1Minute = 60000
|
|
|
|
This object class uses our standard HL7PlusException Class interface for error handling wherever possible.
See the HL7PlusException Implementation Reference
|