The alarm clock application works by setting a certain time and then it perform a certain task eg:sound an alarm, display a messagebox test message. But the problem comes where i need to snooze(delay) the alarm clock for a certain time period like 10 second... Then it will re-initialise the initial alarm clock function.
i tried this but it doesn't work... Why? or is there other methods to snooze the alarm clock?
DateTime SnoozeTime; // global
private void btnSNOOZE_Click(object sender, EventArgs e)
{
pnlDisplay.BackColor = SystemColors.Control;
myPlayer.Stop();
SnoozeTime = DateTime.Now.AddSeconds(10);
Time2.Enabled = true;
}
private void Time2_Tick_1(object sender, EventArgs e)
{
if (DateTime.Now == SnoozeTime)
{
Time.Enabled = false;
Random Random = new Random();
Color[] strColor = { Color.Red, Color.Blue, Color.Green, Color.Yellow };
pnlDisplay.BackColor = strColor[Random.Next(0, strColor.Length)];
myPlayer.SoundLocation = @"C:\Users\Tan Woon Pang\Desktop\Alarm Clock\Alarm Clock\bin\B.wav";
myPlayer.PlayLooping();
MessageBox.Show(txtReminder.Text, "Reminder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
btnResetTime.Enabled = true;
btnSNOOZE.Enabled = true;
}
}