Describe the bug
Stopping a recording when the recorders window is not shown throws an unhandled exception
To Reproduce
Steps to reproduce the behavior:
Go to "Options" > "Recorder" > [ X ] Enable selection panning
Set a shortcut key to enable panning while recording.
Move the mouse in a way that moves the window's location to a new location (this makes the window disappear until the mouse stops).
As the window disappears, quickly press F8 (stops recording)
An error will be thrown. recording is fine and no data is lost, but is a bit of an annoyance
Expected behavior
Recording should stop and application flow should continue as normal with no unexpected pop-ups
Screenshots
Desktop (please complete the following information):
OS: Windows 11
Version 2.37 - 2.39
Additional context
System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed.
at System.Windows.Window.VerifyCanShow()
at System.Windows.Window.Show()
at ScreenToGif.Windows.Other.RegionSelection.Select(Nullable`1 mode, Rect region, Monitor monitor) in C:\Users\nicke\source\repos\ScreenToGif\ScreenToGif\Windows\Other\RegionSelection.xaml.cs:line 197
at ScreenToGif.Windows.NewRecorder.DisplaySelection(Nullable`1 mode, Monitor display) in C:\Users\nicke\source\repos\ScreenToGif\ScreenToGif\Windows\NewRecorder.xaml.cs:line 1483
at ScreenToGif.Windows.NewRecorder.ShowBorderTimer_Tick(Object sender, EventArgs e) in C:\Users\nicke\source\repos\ScreenToGif\ScreenToGif\Windows\NewRecorder.xaml.cs:line 717
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
Describe the bug Stopping a recording when the recorders window is not shown throws an unhandled exception
To Reproduce Steps to reproduce the behavior:
Expected behavior Recording should stop and application flow should continue as normal with no unexpected pop-ups
Screenshots![image](https://github.com/NickeManarin/ScreenToGif/assets/1776215/e5daa54b-d582-4621-b265-4023e5d152a1)
Desktop (please complete the following information):
Additional context