Remove Confirm Dialog After Confirm?
-
First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:
if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
...execute tons of logic...
}Thanks, j1e1g1
-
First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:
if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
...execute tons of logic...
}Thanks, j1e1g1
Hmm...this is slightly tricky since that dialog isn't controled by you and therefore can't do self contained logic on how to appear/disappear. I'm not familiar with how the Compact Framework behaves but it might be solved if you let the message pump work. What might be going on is that the message "close dialog" is in the message queue but isn't being done because of the "execute tons of logic" bit. I'm not sure how long of a fishing excirse you want to go on but one thing you can try is putting the "execute tons of logic" in another thread and let the message pump work in the primary UI thread. I'm not sure if this will work because as I said I am not sure how the Compact Framework behaves with threaded behavior let alone how the UI functions in subtle behaviors like this.
-
First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:
if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
...execute tons of logic...
}Thanks, j1e1g1
Wack in a call do Application.DoEvents() just before the "tons of logic" and the message box will disappear.
-
First of all, I'm using the .NET COMPACT Framework. I have a message box, with yes and no buttons. When a user clicks yes, a large amount of logic is executed (databases are queried, xml is parsed, docs are printed, etc). All of this logic takes about 10 seconds to complete, but the confirmation dialog just hangs there with the yes button depressed until a "success" message box is displayed. My boss doesn't like the way this looks, because the program appears to be "frozen". I would like to have the confirmation box disappear after the user presses yes - is this only possible if i bring up something else (i.e. a progress bar)? Also, is it possible to have a progress bar in a messagebox? Here is the code I'm using for the confirmation box:
if(MessageBox.Show("Backflush Pallet "+pallet+"?","Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{
...execute tons of logic...
}Thanks, j1e1g1
The simplest method would be to break the MessageBox.Show call out of the if block. DialogResult dr; dr = MessageBox.Show(yadda, yadda) if(dr == whatever) { .. do tons of whatever stuff }