what is the best method to let the Actions pane refresh?
-
2005年12月29日 0:38
I have a VSTO Excel workbook that loads a CSV text file 138 MByte big [ --- don't ask why :) ---], chop it in several pieces, format it, and load it in a final workbook. The whole operation takes about 2 minutes.
All the logic so far is working great (I am programming it in C#). The only issue I have is that I am using an Actions Pane that tells the user about the progress of the operation. In the pane I have a textbox and a progress bar.
Now, I put several progressbar.PerformStep() at several points in the code while the loading, formatting and chopping happen. But because Excel continues working immediately after it, the update of the actions pane is inconsistent, as the PerformStep() of the progressbar is called, but it is not shown always right on the pane. I have seen that this happens also when i try to add text to the textbox.
progrBar.Visible =
true;progrBar.Value = progrBar.Minimum;
Foo _foo = new Foo(); if (_foo.LoadTextFile()){
progrBar.PerformStep();----> It should show 25% (sometimes does, sometimes doesn't)
_foo.CreateTempFile();
progrBar.PerformStep();----> 50% (dito)
_foo.ChopIt();
progrBar.PerformStep();----->75% (dito)
_foo.MoveToExcel();
progrBar.Value = progrBar.Maximum; --->100% (dito)
progrBar.Visible =
false;txtOutput.Text +=
"FOO GENERATED";So, my question is: what is/are the best tecniques to allow the controls in the actions pane to refresh correctly without putting unnecesary DoNothing() loops?
Thanks,
Doriak

