private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (Current != null)
            {
                // if old instance exists, close the new instance
                this.Close();

                String errMsg = "Timer is already active!\nPress OK to go to the Timer Window";
                System.Windows.MessageBox.Show(errMsg, "Paint Night", System.Windows.MessageBoxButton.OK, MessageBoxImage.Error);

                if (!Current.IsActive)
                {
                    Current.Activate();
                }

                if (!Current.IsFocused)
                {
                    Current.Focus();
                }
            }
            else
            {
                // a new instance
                Current = this;
            }

            dt.Interval = TimeSpan.FromSeconds(1);
            dt.Tick    += Dt_Tick;
            printTime();
        }
        private void Window_Closed(object sender, EventArgs e)
        {
            // If user closes the window -- this is the new instance, Current is the old one
            if ((Current == this) && (Current != null))
            {
                Current = null;
            }

            dt.Stop();
        }
 private void btnTimer_Click(object sender, RoutedEventArgs e)
 {
     tw = new TimerWindow();
     tw.Show();
 }