I have a function that performs several steps, one at a time, and I would like to display a form or something that tells the user their function is being processed
Basically the function in the Main Form looks like this:
public void MyFunction ()
{
//Step1, takes aproximately 20 seconds
//Step2, takes 10 seconds
//Step3, takes about 25 seconds
}
So, the idea is to inform the user something is under process, because during Step 1, 2 and 3, the GUI remains unresponsive. I don't want to use a simple ProgressBar, it's an image processing software and there's no space to add a ProgressBar, it should be something that pops up basically. I was thinking on another form but not sure how would that work..
Any ideas on how to do this?
Thank you,
Matias.
To create a simple solution consider this:
Create a another form (in my case
Progress
) and put something on it which visualizes the progress. In my case it looks like this:The form itself has the
FormBorderStyle
set toFixedToolWindow
andStartPosition
set toCenterParent
.Now change the constructor to the a
BackgroundWorker
argument and set up the events and start the process.In the main form just add something like this:
To show the popup progress thingy simply call
PopupJob
. TheOurRealJob
can be replaced with your code.When you do it this way, the code will run in the background and the form will stay responsive. Because we are calling
Form.ShowDialog()
the progress form will be at the front and the main form can not be used until the job is done.