Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Async method calls inside a PCL

$
0
0

Hi, I've got a PCL project to share code between iOS, Android, WindowsPhone and WinRT. There are some really expensive methods inside that PCL I would like to call async and receive a callback when it's finished to work with the results and do some error handling etc.

I tried to use a delegate to call the expensive methods async with BeginInvoke and EndInvoke. The PCL compiles and it seems to work inside an Android project. But in WindowsPhone projects this kind of async calls is not supported. It's recommended to use the BackgroundWorker class instead. But unfortunately this class is not available inside the PCL profile.

A possible solution is to abstract the async calls and provide specific implementations for each platform. But I don't like abstracting basic things like this. Does anyone know a better solution? Is there another way to do async calls that works for all platforms?

Wosi


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>