using System;
using System.Windows;
using System.Windows.Threading;

namespace BeWo
{
    /// <summary>
	/// Interaktionslogik für ConfirmDemoDialog.xaml
    /// </summary>
    public partial class ConfirmDemoDialog : Window
    {
		public ConfirmDemoDialog()
        {
            InitializeComponent();
			CountButton.Content = "Bitte warten (10 sek.)";
			CountButton.IsEnabled = false;

			this.Loaded += new RoutedEventHandler(ConfirmDemoDialog_Loaded);
			
        }

		void ConfirmDemoDialog_Loaded(object sender, RoutedEventArgs e)
		{

			int count = 9;

			new DispatcherTimer(
				TimeSpan.FromMilliseconds(1000),
				DispatcherPriority.Background,
				(s1, e1) =>
				{
					CountButton.Content = String.Format("Bitte warten ({0} sek.)", count);

					if (count-- == 0)
					{
						CountButton.Content = "OK";
						CountButton.IsEnabled = true;
						((DispatcherTimer) s1).Stop();
					}
				},
				this.Dispatcher).Start();
		}


        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            //DialogResult = true;
			Close();
        }
    }
}
