locked
Trying to add a marquee progress bar splash screen, while there is a delay in the main form loading RRS feed

  • Question

  • Hi there,

    This is my scenario :

     Inputform > has 3 input boxes, user can only use one.
    OK button launches the SplashScreen

    SplashScreen is a basic form with a text box saying "please wait" and a marquee progressbar
    SplashScreen on load does this:
        $InputForm.Close()
        Find

    Find - does various searches (AD,DNS,DHCP,SCCM)
    Once it's done all of this, it launches - SearchOutputform

    SearchOutputform is the main form where all of the data collected by Find is diplayed, and has a number of buttons to do various things.

    What i'm trying to achieve is this, when the OK button is pressed on the Input form, there can be a long delay before the Find function does it's work, and then fires up the SearchOutputform form.
    I want to have the SplashScreen showing WHILE the Find function is doing it's thing, then when the Find function has completed, it closes the SplashScreen and opens the SearchOutputform.

    What i'm getting with the above logical order is that the splash screen only shows AFTER the SearchOutputform is closed, even though it's called before.

    How can i get this to work ? What would the technique be ?
    Please help !!

    Many thanks

    Damian

    PS using WinForms
    • Edited by DamianBz Sunday, August 19, 2018 4:31 PM
    • Moved by Bill_Stewart Wednesday, December 12, 2018 6:16 PM This is not "debug/fix/rewrite my script for me" forum
    Sunday, August 19, 2018 4:29 PM

All replies

  • It can't be done by any normal means.  All forms in PowerShell are modal and when one is blocked all are blocked.

    You will have to learn about forms event precedence and about how to maintain form responsiveness.  The most common method for doing this is by using a job to do loading and long running scripts in the background.

    Here is an article explaining much of the how and why.

    https://info.sapien.com/index.php/guis/gui-advanced-tips/powershell-studio-creating-responsive-forms

    and:

    https://info.sapien.com/index.php/guis/gui-advanced-tips/creating-responsive-loops


    \_(ツ)_/

    Sunday, August 19, 2018 4:37 PM
  • Well thanks Bill_Stewart for explaining to me that a forum is not the place to come to, to learn and get help !

    You must have read the secret text where I was asking for someone to write my script for me.

    Don't worry, I've learnt my lesson ... don't bother asking for advice about a Microsoft product on a Microsoft forum.

    PS I figured out my solution on my own, mainly from reading stuff from more friendly and helpful forums.

    Bye.  

    Wednesday, December 12, 2018 7:20 PM