Adding a FolderWatch to a streaming application?

  • Thread starter Thread starter pkirill-vea
  • Start date Start date
P

pkirill-vea

Guest
A little background - I've created an application that pulls the video feed from Video Intercom (Algo 8036) we have at the front door of our building and displays in a window on a PC. It's not an actual video stream as the intercom unit creates a JPG every 100ms and the app repeatedly grabs that every 250ms. With several people using the app, the intercom unit tends to bog down so I've set it so when the app is not "on top" it pauses the video.This, of course has it's own problems in that people who answer these calls forget to bring the app to the front before letting people into the building.

The intercom sends entries to a syslog and when motion is detected, the syslog application is configured to update a text file. I've created a Watcher to monitor the text file, but it seems the watcher is running once and then never captures changes. I can't seem to make it "persistent" and I'm looking for ideas on how to do that. All the info I've seen seems to have to watcher as a standalone app. The watcher code I'm using is below:

//I've tried this in a void, as a separate thread, and in the public section at the top of the form code
FileSystemWatcher watcher = new FileSystemWatcher("\\\\SERVER_NAME\\CamView_Watch", "camviewer.log");
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.LastAccess;
watcher.Filter = "*.log";
watcher.Changed += OnChanged;
watcher.EnableRaisingEvents = true;

private void OnChanged(object source, FileSystemEventArgs e) =>
MessageBox.Show($"File: {e.FullPath} {e.ChangeType}");

Any help would be greatly appreciated!

Continue reading...
 
Back
Top