using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Media; using System.Globalization; using System.Diagnostics; namespace ALARM { public partial class Alarm : Form { public Alarm() { InitializeComponent(); } private void btnOpen_Click(object sender, EventArgs e) { bool isAlarmOk = true; while (isAlarmOk) { string dt = DateTime.Now.ToShortTimeString(); if (string.Compare(dt,txtTime.Text) == 0) { isAlarmOk = false; SoundPlayer sp = new SoundPlayer(); sp.SoundLocation = @"C:\Users\Rahsan-PC\Documents\Visual Studio 2012\Projects\ALARM\ALARM\bin\Debug\sound\ding.wav"; sp.Load(); sp.PlaySync(); break; } } } private void btnClose_Click(object sender, EventArgs e) { timer1.Stop(); } private void Alarm_Load(object sender, EventArgs e) { txtDay.Text = DateTime.Now.ToShortDateString(); txtTime.Text = DateTime.Now.ToShortTimeString(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)