I have a C# program that runs continuously. Since it runs so fast I often want to make it go to sleep for a minute or two before querying my database again I simply use this line of code System.Threading.Thread.Sleep(60000); to make it go to sleep for a minute and will probably change it to sleep longer once it's in production.
My problem is I have another button I wish to have available to exit the program during these sleep cycles, but the button itself, the entire application is asleep and I can't click on the button until the application wakes up again.
Maybe I'm doing it all wrong. Can someone help?