public static async Task Create(Rect Region)
        {
            var controls = new CaptureControls();

            controls.captureRecordingFrame = new CaptureRecordingFrame();
            controls.Top  = Math.Min(Region.Bottom + 5, Screen.FromPoint(System.Windows.Forms.Cursor.Position).WorkingArea.Bottom - controls.Height);
            controls.Left = Region.Left + (Region.Width / 2) - (controls.Width / 2);
            controls.captureRecordingFrame.Top    = Math.Max(0, Region.Top - 5);
            controls.captureRecordingFrame.Left   = Math.Max(0, Region.Left - 5);
            controls.captureRecordingFrame.Width  = Region.Width + 10;
            controls.captureRecordingFrame.Height = Region.Height + 10;
            controls.Show();
            controls.captureRecordingFrame.Show();

            if (Settings.Current.RecordingDelay > 0)
            {
                await Task.Delay(1000);

                while (controls.captureRecordingFrame.countdownText.Text != "0")
                {
                    controls.captureRecordingFrame.countdownText.Text = (int.Parse(controls.captureRecordingFrame.countdownText.Text) - 1).ToString();
                    await Task.Delay(1000);
                }
            }

            controls.captureRecordingFrame.countdownText.Visibility = Visibility.Collapsed;
            do
            {
                await Task.Delay(100);
            }while (controls.captureRecordingFrame.countdownText.IsVisible);

            var timer = new System.Windows.Threading.DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(100);
            var lastTick = DateTime.Now;

            timer.Tick += (send, arg) =>
            {
                if (GIFRecorder.State == GIFRecorder.RecordingState.Stopped)
                {
                    (send as System.Windows.Threading.DispatcherTimer).Stop();
                    return;
                }
                if (GIFRecorder.State == GIFRecorder.RecordingState.Recording)
                {
                    controls.CaptureDuration += DateTime.Now - lastTick;
                    controls.textTimer.Text   = controls.CaptureDuration.ToString("hh':'mm':'ss':'ff");
                    lastTick = DateTime.Now;
                }
            };
            timer.Start();

            GIFRecorder.Record(Capture.Current.GetDrawnRegion(true));
        }
        private async void Window_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Right)
            {
                if (textConfirmRegion.IsVisible)
                {
                    if (captureMode == Models.CaptureMode.PNG)
                    {
                        try
                        {
                            await HideAllButBackground();

                            Screenshot.SaveCapture(Screenshot.GetCapture(GetDrawnRegion(true), false));
                            this.Close();
                        }
                        catch (Exception ex)
                        {
                            System.Windows.MessageBox.Show("There was an error capturing the screenshot.  If the issue persists, please contact [email protected].", "Capture Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            MainWindow.Current.WriteToLog(ex);
                            this.Close();
                        }
                    }
                    else if (captureMode == Models.CaptureMode.GIF)
                    {
                        CaptureControls controls = null;
                        try
                        {
                            await HideAllButBackground();

                            var region = GetDrawnRegion(false);
                            await CaptureControls.Create(region);

                            this.Close();
                        }
                        catch (Exception ex)
                        {
                            controls?.Close();
                            System.Windows.MessageBox.Show("There was an error recording the video.  If the issue persists, please contact [email protected].", "Capture Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            MainWindow.Current.WriteToLog(ex);
                            this.Close();
                        }
                    }
                }
            }
            else if (e.ChangedButton == MouseButton.Left)
            {
                ManualRegionSelection        = true;
                textConfirmRegion.Visibility = Visibility.Visible;
            }
        }