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.Value = progrBar.Minimum;Foo _foo = new Foo(); if (_foo.LoadTextFile())
progrBar.PerformStep();----> It should show 25% (sometimes does, sometimes doesn't)
progrBar.PerformStep();----> 50% (dito)
progrBar.Value = progrBar.Maximum; --->100% (dito)
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?