I am currently developping an application where I need to check if the user has replaced a file (by MD5) and I thought of a Timer.
A Timer that checks every 1-2 seconds If the MD5 of the file is not what I expected, If not, I need to disable a MenuStripItem.
My question is, is it bad to edit a control's property every 1-2 seconds?
Thanks a lot.
Modifying a control's property every 1-2 seconds does not seem like a bad idea, but checking a file's hash so often seems like a bad idea. You should at least compare the file dates and size before comparing the hash.
A better approach would be to check it only when the menu item is used.
FileSystemWatcher is the usual way to keep track of changes in a folder, but it is not fully reliable FileSystemWatcher vs polling to watch for file changes