I want to take a moment to thank everyone who has been following my Halloween Countdown, commenting, sharing links, etc. I truly hope that anyone who came across this blog in search of Halloween goodies will stick around after next week. If you’ve enjoyed recent posts, I’m pretty sure you’ll enjoy the oddities that show up on here during the rest of the year.
Monstrous thanks!

Image by Alex Pardee

One response to “Monstrous Thanks!”
I’ve been doing countdown lanuch exercise and I’ve got few questions.1. How should I define user inserted value to TimeSpan object? At the moment I have it defined asTimeSpan timer = new TimeSpan(0,0,0);timer=TimeSpan.Parse(txtTime.Text);2. I have this.Close(); on Abort_click event but what would be the solution to stop the timer rather than closing whole form? disp.Stop(); didn’t work on this case.My code:namespace CountdownLaunch{ /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { TimeSpan timer = new TimeSpan(0,0,0); DispatcherTimer disp = new DispatcherTimer(); public MainWindow() { InitializeComponent(); txtTime.Text = timer.ToString(); //timer=TimeSpan.Parse(txtTime.Text); txtbTime.Text = txtTime.Text; } private void btnAbortLaunch_Click(object sender, RoutedEventArgs e) { if((string)btnAbortLaunch.Content == “_Abort”) { this.Close(); //disp.Stop(); } lblBlast.Content = “”; btnAbortLaunch.Content = “_Abort”; disp.Tick += new EventHandler(disp_Tick); disp.Interval = new TimeSpan(0, 0, 1); disp.Start(); } void disp_Tick(object sender, EventArgs e) { if (txtTime.Text == “00:00:00”) { lblBlast.Content = “Blast Off!”; btnAbortLaunch.Content = “_Launch”; disp.Stop(); return; } timer = timer.Subtract(new TimeSpan(0, 0, 1)); txtTime.Text = timer.ToString(); txtbTime.Text = txtTime.Text; } }//end class}//end namespace