Hi,
I've tried with both types of timer, calling asynch and
synch (all suffer the same problem) and I don't know
whether or not I'm calling from the main UI thread (how
would I tell?).
To recreate, make a simple web service containg code such
as:
[WebMethod(Description="This method waits for the
specified number of milliseconds.")]
public void wait(int numberOfSeconds)
{
// do something that takes a long time
System.Diagnostics.Process proc =
System.Diagnostics.Process.GetCurrentProcess();
proc.WaitForExit(numberOfSeconds);
}
Create web reference and a simple one button form as
follows (presuming timer is wired up to a progress bar,
with designer default properties):
private void button1_Click(object sender,
System.EventArgs e)
{
myNamespace.myClass myWait = new wait.InEditStorage();
timer2.Start();
MessageBox.Show("calling");
myWait.wait(10000);
MessageBox.Show("called");
timer2.Stop();
}
The progress bar works while waiting for user to
press "calling" but suspends while the web service call
is being made. The progress bar "catches up" once
the "called" dialogue is shown. This is with a
System.Timers.Timer. If using a
System.Windows.Forms.Timer then the behaviour is similar,
except that the progress bar doesn't "catch up", it
starts from where it was previously suspended when the
web service was called.
I suspect this is something to do with UI threads, as has
been mentioned, but I don't understand what is going
wrong here.
Any help would be appreciated.
Thanks,
Richard.