private void StopButton_Click(object sender, RoutedEventArgs e)
        {
            t.Stop();


            StopButton.IsEnabled = false;


            CancelWindow dlg = new CancelWindow();

            dlg.ShowDialog();

            if (SignedIn == true)
            {
                Database1TimerstuffTableAdapters.TimerInfoTableAdapter  ad  = new Database1TimerstuffTableAdapters.TimerInfoTableAdapter();
                Database1TimerstuffTableAdapters.TimerInfo1TableAdapter ad1 = new Database1TimerstuffTableAdapters.TimerInfo1TableAdapter();
                ad.Connection  = new SqlCeConnection(Properties.Settings.Default.Database1ConnectionString1);
                ad1.Connection = new SqlCeConnection(Properties.Settings.Default.Database1ConnectionString1);

                //"Data Source=\"C:\\Users\\Thad\\Documents\\Programming Practice\\Productivity Timer\\Productivity Timer\\Database1.sdf\""

                TimeSpan tspan        = new TimeSpan(HoursToGo, MinutesToGo, SecondsToGo);
                TimeSpan elapsedtspan = new TimeSpan(Hours, Minutes, Seconds);

                ad.Fill(dataset.TimerInfo);
                ad.Insert(User, currentTime, false, dlg.CancelReason, null, tspan.ToString(), elapsedtspan.ToString(), taskBox.Text);
                ad.Update(dataset);
                ad.FillByUser(dataset.TimerInfo, User);

                ad1.Fill(dataset.TimerInfo1, User);
            }



            Seconds = 0;
            Minutes = 0;
        }
        private void UpdateTimes(object sender, ElapsedEventArgs e)
        {
            Seconds = Seconds + 1;
            if (Seconds == 60)
            {
                Seconds = 0;
                Minutes = Minutes + 1;
            }
            if (Minutes == 60)
            {
                Minutes = 0;
                Hours   = Hours + 1;
            }
            if (tickcount < 5)
            {
                tickcount++;
            }

            if (Seconds == SecondsToGo && Minutes == MinutesToGo && Hours == HoursToGo)
            {
                t.Stop();

                if (this.Dispatcher.CheckAccess())
                {
                    this.WindowState           = WindowState.Normal;
                    MinutesSetBox.Focusable    = true;
                    SecondsSetBox.Focusable    = true;
                    ThirtyMinsPreset.Focusable = true;
                    TwoHoursPreset.Focusable   = true;
                    OneHourPreset.Focusable    = true;
                    CustomRadio.Focusable      = true;
                    StopButton.Focusable       = false;
                    taskBox.Focusable          = true;
                }
                else
                {
                    this.Dispatcher.Invoke((Action)(() => this.WindowState = WindowState.Normal));
                    this.Dispatcher.Invoke((Action)(() => MinutesSetBox.Focusable = true));
                    this.Dispatcher.Invoke((Action)(() => SecondsSetBox.Focusable = true));
                    this.Dispatcher.Invoke((Action)(() => ThirtyMinsPreset.Focusable = true));
                    this.Dispatcher.Invoke((Action)(() => TwoHoursPreset.Focusable = true));
                    this.Dispatcher.Invoke((Action)(() => OneHourPreset.Focusable = true));
                    this.Dispatcher.Invoke((Action)(() => CustomRadio.Focusable = true));
                    this.Dispatcher.Invoke((Action)(() => StopButton.Focusable = false));
                    this.Dispatcher.Invoke((Action)(() => taskBox.Focusable = true));
                }

                if (signedIn == true)
                {
                    if (this.Dispatcher.CheckAccess())
                    {
                        donedlg.ShowDialog();
                    }
                    else
                    {
                        this.Dispatcher.Invoke((Action)(() => donedlg.ShowDialog()));
                    }



                    Database1TimerstuffTableAdapters.TimerInfoTableAdapter ad = new Database1TimerstuffTableAdapters.TimerInfoTableAdapter();
                    ad.Connection = new System.Data.SqlServerCe.SqlCeConnection(Properties.Settings.Default.Database1ConnectionString1);
                    Database1TimerstuffTableAdapters.TimerInfo1TableAdapter ad1 = new Database1TimerstuffTableAdapters.TimerInfo1TableAdapter();
                    ad1.Connection = new SqlCeConnection(Properties.Settings.Default.Database1ConnectionString1);


                    TimeSpan tspan = new TimeSpan(Hours, Minutes, Seconds);

                    ad.Fill(dataset.TimerInfo);
                    try
                    {
                        ad.Insert(User, currentTime, donedlg.Completed, null, donedlg.failReason, tspan.ToString(), tspan.ToString(), task);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    ad.Update(dataset);

                    ad.FillByUser(dataset.TimerInfo, User);

                    ad1.Fill(dataset.TimerInfo1, User);


                    if (this.Dispatcher.CheckAccess())
                    {
                        taskBox.Text = null;
                    }
                    else
                    {
                        this.Dispatcher.Invoke((Action)(() => taskBox.Text = null));
                    }
                    task = null;
                }
            }
            else
            {
                if (tickcount == 5)
                {
                    if (this.Dispatcher.CheckAccess())
                    {
                        this.WindowState = WindowState.Minimized;
                    }
                    else
                    {
                        this.Dispatcher.Invoke((Action)(() => this.WindowState = WindowState.Minimized));
                    }
                }
            }
        }