android - Call webservice asynchronously -


i need call web service added webservice web reference , able call it. need make call async because need download lot of data , taking lot of time. tried use async/await method can not since method in webservice not async.

original code:

 public static void validatelogin(jsonparameters _param, ref validatecredentials result, ref string excep_error)     {         var _mobileservice = new mobileservice();         _mobileservice.url = appparam.iisstring + "/urladdressreference";         try         {             result = _mobileservice.downloaddata(_param);         }         catch (exception ex)         {             excep_error = ex.message;         }      } 

i tried add async task in place of void make method async, how can await webservice response?

after added webservice web reference can see created each method in async method , completed event. how can make use of them? (ex: downloaddata", method namedownloaddataasync`, , event "downloaddatacompleted")

is there way or need change webservice?

public async static task validatelogin(jsonparameters _param, ref validatecredentials result, ref string excep_error)         {           await task.run(()=>           {             var _mobileservice = new mobileservice();             _mobileservice.url = appparam.iisstring + "/urladdressreference";             try             {                 result = _mobileservice.downloaddata(_param);             }             catch (exception ex)             {                 excep_error = ex.message;             }          }); } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -