I'm creating a multi-form project in PowerShell Studio, with a splash screen form and a main form. However, closing the splash screen form is exiting the entire application. The project is structured with a Startup.pss
file, splash.psf
file, and a main_form.psf
file.
I've tried a couple different ways of getting around this. In Startup.pss
, there is the following:
function Main {
Show-splash_psf
$script:ExitCode = 0
}
This correctly launches the splash screen form. Inside splash.psf
is the following regarding launch:
$formSplashScreen_Load = {
$paramShowSplashScreen = @{
Image = $pictureboxSplashScreenHidden.Image
Title = "Loading..."
PassThru = $false
}
Show-SplashScreen @paramShowSplashScreen
Show-main_form_psf
$splash.Close()
}
The Show-SplashScreen
function call doesn't deal with closing the form. This does correctly launch the main form, however both forms close right after they appear. I realize closing the splash screen should be quick, but I'm confused as to why it's closing the main form along with it.
I've tried hiding the splash form instead with this:
Show-SplashScreen @paramShowSplashScreen
Show-main_form_psf
$splash.Hide()
But this ends up doing the same thing. Might have something to do with a parent/child relationship but I'm unsure of what's involved there.