By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

Modal dialog box and update status message

P: n/a
Hello,
I am writing modal dialog box to display progress of downloading file.
I am starting download of a file in constructor of dialog using some
asynchronous method call which returns me an asynchronous object. I
could use this object to get status. I will be using this status to
update status message on dialog.

Which method should I override to update the status message ?

Can I follow the approach just like

while ( obj.status != DOWNLOAD_COMPLETE )
{
updateStatusMessage(obj.Status);
}

But in this case , which is the method I should override?
thanks,
Oct 7 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Mon, 06 Oct 2008 20:39:42 -0700, Roland <aj***********@gmail.comwrote:
Hello,
I am writing modal dialog box to display progress of downloading file.
I am starting download of a file in constructor of dialog using some
asynchronous method call which returns me an asynchronous object. I
could use this object to get status. I will be using this status to
update status message on dialog.
Your description is fairly vague, which will make it difficult for anyone
to offer much in the way of specific advice.
Which method should I override to update the status message ?
Which method of _what_?
Can I follow the approach just like

while ( obj.status != DOWNLOAD_COMPLETE )
{
updateStatusMessage(obj.Status);
}
Not likely. If you do that on the thread that owns your dialog, you're
going to cause the UI to stop responding.
But in this case , which is the method I should override?
I doubt you need to override any method, at least for the purpose of
updating status.

You _do_ need some way of receiving status updates. That should happen on
a thread other than the one that owns the dialog, and so when you receive
the status update, you will need to use the Control.Invoke() method to
ensure that the code executing to actually update the UI happens on the
correct thread.

You may want to look at the BackgroundWorker class, which provides a
transparent mechanism for providing progress and completion notifications
without you having to explicitly call Control.Invoke().

Pete
Oct 7 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.