I am writing a Windows 8 App that will primarily run in the background. This app will be specific to computers (i.e. no tablets or phones, in case that makes a difference). It needs to be able to watch a specified folder while it is running in the background and be notified when there is a change in that folder. Because it is a Windows Store App I cannot use a FileSystemWatcher, which would be perfect in my situation. Also, I cannot use a timer to watch the folder because these changes will be occurring every 10-15 seconds and the timer does not support times shorter than 15 minutes. What other options do I have?
I am writing a Windows 8 App that will primarily run in the background.
Share
Since you can’t use a timer that fires every 15 seconds or so, the only thing I can recommend is running a simple loop, which before the loop it checks the system time from the system clock, and then with each loop it checks difference between current system clock and the originally stored value. When you get to 15 seconds the loop stops and starts the code that checks the folder. If the code in the loop is simple and makes use of a
Sleepcall it shouldn’t take hardly any system resources.I hope this helps you!