BrunoWB BrunoWB - 1 year ago 125
C# Question

Xamarin, return WCF data to PCL from specific platform libraries

I'm working on a client/server project but struggling to make it work, mostly because

cannot be accessed in PCL.

But that's OK, I managed to use
that I call from PCL to manage the connection with the server from each specific platform.

My problem is, once I call for example

var result = DependencyService.Get<Interface>().Operation(param);

this will go to the platform specific, there I'm doing the binding, endpoint and calling the real operation from WCF, that is Async, so from now I cannot return the result from WFC in this method, because this will be returned to another method once the operation is completed.

My goal is to do most of the job on PCL so I don't have to start writing my interface multiple times for each platform. So in resume what I need is a way to return result from server (WCF, or some other that would make it work) in my PCL.

Answer Source

enter image description hereCreate WCF proxy/client in PCL using VS and avoid all these problems

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download