If you set StartupUri using XAML, the main window that is created
is not available from either the MainWindow property or the Windows
property of the Application object until after the Startup event is
processed. If you need access to the main window during startup, you
need to manually create a new window object from your Startup event
handler.