using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Media;
namespace Alarm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (numericUpDown1.Value > 59)
{
numericUpDown1.Value = 00;
}
if (numericUpDown2.Value > 59)
{
numericUpDown2.Value = 00;
}
if (numericUpDown3.Value > 23)
{
numericUpDown3.Value = 00;
}
}
private void timer2_Tick(object sender, EventArgs e)
{
if (DateTime.Now.Date == dateTimePicker1.Value &&
DateTime.Now.Hour == numericUpDown3.Value &&
DateTime.Now.Minute == numericUpDown2.Value &&
DateTime.Now.Second == numericUpDown1.Value)
{
SoundPlayer asd = new SoundPlayer();
asd.SoundLocation = "The Underdog.wav";
asd.PlayLooping();
}
}
private void button2_Click(object sender, EventArgs e)
{
button1.Visible = true;
button2.Visible = false;
timer2.Enabled = true;
}
private void button1_Click_1(object sender, EventArgs e)
{
button1.Visible = false;
button2.Visible = true;
timer2.Enabled = false;
}
private void timer3_Tick(object sender, EventArgs e)
{
//The date that we set should not be early than right now.
if (numericUpDown1.Value >= DateTime.Now.Second &&
numericUpDown2.Value >= DateTime.Now.Minute &&
numericUpDown3.Value >= DateTime.Now.Hour &&
dateTimePicker1.Value >= DateTime.Now)
{
label4.Visible = false;
}
else
{
label4.Visible = true;
}
}
}
}