public static void ShowBlocking(Rect rectangle, Color color, TimeSpan duration)
 {
     Show(() =>
     {
         window?.Close();
         window = new OverlayRectangleWindow(rectangle, color, duration);
         window.ShowDialog();
     });
 }
        private void TimerTick(object sender, EventArgs e)
        {
            var timer = (DispatcherTimer)sender;

            timer.Tick -= this.TimerTick;
            timer.Stop();
            this.Close();
            window = null;
        }