In your first code snippet, you use ShowDialog() which is a blocking call, replace it with Show().
ShowDialog()
Show()
Ref:
https://learn.microsoft.com/en-us/dotnet/api/system.windows.window.show?view=windowsdesktop-9.0
https://learn.microsoft.com/en-us/dotnet/api/system.windows.window.showdialog?view=windowsdesktop-9.0