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

How are you guys running background tasks in a PCL?

$
0
0

We're creating all of our Command Objects in a PCL so that they can be used by Android and iOS.

I've got a service that talks to the database, and it seems to take enough time that it's noticeable in the UI.

_userService.Save(user);

Now I tried to do something like this.

new Task(() => _userService.Save(user)).Start();

but it doesn't save the user.
I was also looking at using

ThreadPool.QueueUserWorkItem(o => _userService.Save(user));

but here I don't know if it'll work cross platform.

can anyone lend some info on the right way to run a service off the UI thread?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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