Hi All,
I am using winform threads and I have craeted a new thread to perform
soem lengthy operations asynchronously.
My problem is that while this operation is being performed i am
updating the window status bar to display the status of the operation.
But as soon as the window loses the focus it freezes (mean the staus
bar is not updated anymore).
following is my code (in UI thread):
AsyncCallback ac = new AsyncCallback(ASyncCallBackMethod);
mi = new MethodInvoker(RunPackage);
mi.BeginInvoke(ac, null);
while((Helper.HelperInstance).Status != Helper.Success)
{
if(!InvokeRequired)
{
informationPanel.Text = "Now running: " +
(Helper.HelperInstance).NowRunning;
if(progressPanel.ProgressPosition == 50)
progressPanel.Reset();
progressPanel.Step();
Thread.Sleep(500);
}
}
progressPanel.Reset();
informationPanel.Text = "Operation Completed Successfully.";
ShowSummary(); //displays the results in a datagrid
FYI : when showSummary() is executed window is able to display the
final results.
Any help will be appreciated.
Thanks.
Vivek