Y
YF
Dear all,
I have a compact framework application that calls a webservice. I call the
webservice asynchronously on a button click event and when the web service
method completes successfully the callback function is successfully called.
The code looks as follows:
---------------------
private void btnRegister_Click(object sender, System.EventArgs e)
{
// set the wait cursor
Cursor.Current = Cursors.WaitCursor;
// component for calling webservice
Worker theWorker = new Worker();
// register the event and pass delegate
theWorker.WebMethodCompletedEvent += new
Worker.WebMethodCompleted(this.registerCompleted);
// call web method
theWorker.ClaimDevice(tbDeviceID.Text);
}
private void registerCompleted(int aResult)
{
// do stuff.
// restore cursor
Cursor.Current = Cursors.Default;
}
---------------------
My problem is that the cursor is not restored to the default cursor after
the callback. I know it's a problem with the async. callback of the
webservice cause if i replace the asynchronous method with a synchronous
method the cursor is restored. But ofcourse i want to keep the webservice
call asynchronous. Does anyone have an idea how i can fix this?
Thanks,
Yang
I have a compact framework application that calls a webservice. I call the
webservice asynchronously on a button click event and when the web service
method completes successfully the callback function is successfully called.
The code looks as follows:
---------------------
private void btnRegister_Click(object sender, System.EventArgs e)
{
// set the wait cursor
Cursor.Current = Cursors.WaitCursor;
// component for calling webservice
Worker theWorker = new Worker();
// register the event and pass delegate
theWorker.WebMethodCompletedEvent += new
Worker.WebMethodCompleted(this.registerCompleted);
// call web method
theWorker.ClaimDevice(tbDeviceID.Text);
}
private void registerCompleted(int aResult)
{
// do stuff.
// restore cursor
Cursor.Current = Cursors.Default;
}
---------------------
My problem is that the cursor is not restored to the default cursor after
the callback. I know it's a problem with the async. callback of the
webservice cause if i replace the asynchronous method with a synchronous
method the cursor is restored. But ofcourse i want to keep the webservice
call asynchronous. Does anyone have an idea how i can fix this?
Thanks,
Yang