I'm trying to build a simple alarm clock application that shows a MessageBox at a particular time. I've been trying to teach myself about threading, but I'm having a hard time putting my finger on what I need (since there's so many different ways to do everything, it seems). There are a ton of tutorials out there, but I haven't stumbled upon any good ones. I understand the basics of running threads, but I don't understand how to do inter-thread communication (with everything running asynchronously)

Right now, I have a while loop that checks to see if the system time matches the alarm time.

Obviously, it runs the CPU at 100% all the time. So I tried putting Thread.Sleep() in the loop, but obviously, that just locks up the UI. If I start the while loop on its own thread, it can't access the alarm control's value (or at least, I can't figure out a way to get it to do so). If I were to pass that information to the thread in some way, how could I update the thread if the alarm control changes? I'm currently using the TimePicker from the Avalon control library, which has generous amounts of properties and event handlers. Could someone help me understand how to use threading in this case? Or is there a much simpler way of doing this?

I appreciate anyone's help or suggestions!