I am working on a project that allows me to create a program and give it tasks. Right now I am working on where I can tell it to set an alarm. The alarm feature works well, but I have a problem. When I set the alarm, I can say "goodnight" and then the program turns my monitor off into sleep mode. When the alarm goes off I want it to turn the monitor back on 10 or 15 seconds before it executes the code that happens when the alarm goes off.
Here is a bit of my code:
DateTime now = DateTime.Now;
string time = now.GetDateTimeFormats('t')[0];
if (time == Settings.Default.Alarm && Settings.Default.AClockEnbl == true)
{
SetMonitorInState(MonitorState.MonitorStateOn);
}
if (time == Settings.Default.Alarm && Settings.Default.AClockEnbl == true)
{
//All other alarm code
}
I want the first if statement to tell the command to happen 10 seconds before Settings.Default.Alarm
Can anybody help?