开发者

Cancelling call to web-service from application

开发者 https://www.devze.com 2023-03-04 21:17 出处:网络
I have a winform app that has two buttons GetData and Close. On GetData I retrieve some data from a web-service whereas Close just closes the dialog. I am calling the web-service on a separate thread.

I have a winform app that has two buttons GetData and Close. On GetData I retrieve some data from a web-service whereas Close just closes the dialog. I am calling the web-service on a separate thread. This thread is class instance variable. If getting data from web-service is taking开发者_开发技巧 too long and user click on close, I want to cancel that call to web-service and just close the dialog.

What is the best way of cancelling that call to web-service, by just calling abort on thread instance? Any other idea/best practices are welcome too.


You can not cancel it. Once the webservice call is placed then it will get executed even if the calling thread is aborted.

0

精彩评论

暂无评论...
验证码 换一张
取 消