Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Async Design Question

$
0
0

I have couple of items in a listview in my app. Users can mark each item as favourite or can unlike it as well. When user marks an item as favourite, a call is made to a rest service to write the item to the database. Now since users can quickly like/unlike an item by clicking in listview row, instead of calling rest service for each click, I saved these likes/dislikes in a list in memory and then sync the list onDisappearing event of the view (basically await a Task). Is this a good approach to handle this scenario?

For some reason when I try to now navigate to another view from this listview asynchronously, I get an unhandled exception. As soon as I remove the logic of syncing likes/dislikes from ondisappearing method, I dont see that error again. So not sure if its a good idea to place logic of awaiting for sync in onDisappearing event.

Any ideas on this will be very helpful.

Thanks


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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