I have an OOB Silverlight 4 application (I can upgrade to Silverlight 5 if it makes this easier to accomplish), and I need to monitor a file in the My Documents folder for changes.
The file is modified by another program running on the machine, when the file changes, I need my silverlight application to react to the changes.
It appears that the FileSystemWatcher is not available in silverlight, so right now I see my only solution is some kind of polling where I just check the file on some sort of short timer.
This seems like this could be a somewhat big performance hit.
Is there a common way of doing this that I'm not aware of? Is there anyway to get the FileSystemWatcher working in silverlight?
You could try to PInvoke the API: http://www.pinvoke.net/default.aspx/kernel32/FindFirstChangeNotification.html
See also an MSDN example of using this API: http://msdn.microsoft.com/en-us/library/Aa365261
This will require the use of Silverlight 5, Out of Browser and elevated permissions and a Windows OS.