I am creating an application in which there is a foreground application (of course), and both PeriodicTask and ResourceIntensiveTask.
I need to disable scheduled tasks if the user launches the application while they are starting.
I see no way to do this with system-wide mutexes. Ideally, when background tasks started, the thread would be turned off, which would listen for the signal from the foreground application, and if it receives this signal, it could completely close the background tasks.
Besides polling (say, folders for a specific file), does anyone have a clear idea about how my foreground application can signal that my background agents are closing if the foreground application is running?
I'm heading for sockets, but that seems redundant.
Background:
I am currently using IsolStorage to store my data (not the database) - I will eventually move on to using the database.
My foreground app synchronizes local data with the web service and updates the user interface when adding new elements from the web service. I use the file that I am looking for to find data items, and which I add when new items are synchronized.
I want background agents to perform this synchronization in the background, updating files in isolated storage, including indexes, etc. But as soon as I launch the foreground application, I need the background application to stop, so that in the foreground and in the background, both try to update the same files at the same time.
, , .