Event listeners for the worker class is defined as follows:
this.ListenPort.DoWork += new DoWorkEventHandler(DoWork);
this.ListenPort.RunWorkerCompleted += new
RunWorkerCompletedEventHandler(RunWorkerCompleted) ;
this.ListenPort.WorkerSupportsCancellation = true;
Following are the functions:
private void DoWork(object sender, DoWorkEventArgs e)
{
while ((Value = Input(Address)) != 0);
RefreshWindow("In DoWork");
}
private void RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
RefreshWindow("Received " + Value);
}
Now the problem is that if a waiting loop is applied at the work function,
the loop is not executed and the work completed function is reached. In the
above case "In DoWork" message does not appear; but if the while loop is
commented the message appears. Pls help!