Refreshing modeless dialogs?

D

DoB

What is the preferred way to refresh modeless dialogs?

I am using the modeless dialog that shows a progress of a sequential
process.
The dialog class has nonvisual properties containg the progress status data
and the dialog window has a timer and refreshes on every tick, but it does
not seem to work correctly.

Maybe I am doing it all wrong... what is a suggested way of programing this,
provided that I want to have one general dialog for many sequential
processes?

I imagine the usage should look something like this:

void SequentialProcess()
{
int Step = 0;
ProgressDialog pd = new ProgressDialog();
pd.Show();

some_loop {
...
Step++;
pd.ProgressValue = Step; // this line should not refresh anything
because it would be too costly
}

pd.Close();
}

And the ProgressDialog should refresh itself, on timer for instance...

Regards,
DoB.
 
D

DoB

That said...if your code looks anything like what you've posted here, the
main problem is likely to be the fact that you are showing the dialog
using the same thread that you're using for your "sequential process".

Yes... this seems to be the reason.
Ideally, I would prefer to create a separate thread for the dialog box
rather than for the SequentialProcess, byt I am no sure how to do that.

Anyway, thanks for your suggestions, maybe I will redesign the whole thing.

DoB.

P.S.
Can BackgroundWorker update the controls directly?
I mean... a form is creating a background worker designed to load the tree
view which is a time consuming process... is it safe to update the contents
of the tree view directly from within DoWork?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top