Understanding SplashScreens

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 months and 2 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Understanding SplashScreens

Post by apowershelluser »

Is there a way to prevent my splash screen from creating so many windows?

My update code looks like this
  1. Show-SplashScreen -Image $pictureboxSplashScreenHidden.Image`
  2.                       -SplashText "Loading | v$ApplicationVersionSplash`n$ApplicationName"`
  3.                       -SplashUpdate 'Checking FileShare' -PbarValue 30 -PassThru
2023-04-20_08-49-38.png
2023-04-20_08-49-38.png (11.93 KiB) Viewed 1757 times
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Understanding SplashScreens

Post by brittneyr »

You need to close your splash screen form once you are done showing it.

You can do that like so:
  1. $splashForm = Show-SplashScreen -ImageLocation $imagePath -Title 'Loading...' -PassThru
  2.      
  3. #Initialize/load stuff
  4.    
  5. #Close the splash screen when you are done
  6. $splashForm.Close()
Brittney
SAPIEN Technologies, Inc.
User avatar
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Understanding SplashScreens

Post by apowershelluser »

I understand that, it was more keeping the app from opening additional splashscreen windows as the image shows

I did figure it out
  1. $splashscreen = Show-SplashScreen -Image $pictureboxSplashScreenHidden.Image`
  2. -SplashText "Loading | v$ApplicationVersionSplash`n$ApplicationName"`
  3. -SplashUpdate 'Checking FileShare' -PbarValue 1 -PassThru
  4.  
  5. $Pbarsplash = $SplashScreen.Controls | Where-Object { $_.Name -eq 'pbarsplash' }
  6. $labelupdateSplash = $SplashScreen.Controls | Where-Object { $_.Name -eq 'labelupdateSplash' }
  7.  
  8. $Pbarsplash.value = 2
  9. $labelupdateSplash.text = "Getting $ApplicationName checklist"
  10.  
  11. $Pbarsplash.value = 3
  12. $labelupdateSplash.text = "do next thing"
  13.  
  14. $Pbarsplash.value = 4
  15. $labelupdateSplash.text = "do  next thing"
This topic is 11 months and 2 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked