Can not apply EAP pattern to WCF Service Client on Windows Phone 8 -


i trying apply eap pattern call wcf service. same code runs smoothly on windows console application hangs on indefinetely on task.wait on windows phone application.

any ideas problem highly appreciated.

thanks in advance

here extension method , helper function:

public static class serviceextensions {     public static task<string> doglobalizationresourcesinquiryasynctask(         service1client serviceclient,         int request)     {         var tcs = new taskcompletionsource<string>();         eventhandler<getdatacompletedeventargs> handler = null;         handler = (sender, e) => eaphelpers.transfercompletion(             tcs,             e,             () => e.result,             () => serviceclient.getdatacompleted -= handler);          serviceclient.getdatacompleted += handler;         try         {             serviceclient.getdataasync(request, tcs);         }         catch         {             serviceclient.getdatacompleted -= handler;             tcs.trysetcanceled();             throw;         }          return tcs.task;      } }  public static class eaphelpers {     public static void transfercompletion<t>(         taskcompletionsource<t> tcs,         asynccompletedeventargs e,         func<t> getresult,         action unregisterhandler)     {         if (e.userstate == tcs)         {             if (e.cancelled) tcs.trysetcanceled();             else if (e.error != null) tcs.trysetexception(e.error);             else tcs.trysetresult(getresult());             if (unregisterhandler != null) unregisterhandler();         }     } } 

i call extension method follows:

        service1client client = new service1client();         var task = client.doglobalizationresourcesinquiryasynctask(3);         task.wait();         var response = task.result; 


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -