using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Diagnostics; using System.Media; namespace CountdownTimer { /// /// Interaction logic for Window1.xaml /// public partial class Window1 : Window { private TimerSource _timerTicker = new TimerSource(); public Window1() { InitializeComponent(); timer.DataContext = _timerTicker; _timerTicker.Time = App.InitialTime; _timerTicker.TimedOut += _timerTicker_TimedOut; } void _timerTicker_TimedOut() { SoundPlayer player = new SoundPlayer("done.wav"); player.Play(); } private void button1_Click(object sender, RoutedEventArgs e) { timer.IsReadOnly = true; _timerTicker.Start(); button1.IsEnabled = false; } } }