I have an application which shows multiple charts on tablet. I am using following:
1. HttpClient class to connect to web service and fetch the chart data.
2. ViewModel which fetches the data and update the charts's model
The charts are refreshed at interval of 5 seconds. If i update all the charts (around 15), application hangs and UI is non responsive. I think it could be because I am updating the model for charts on main thread. Is it possible to update chart data on some user thread?
Here is the code snippet for updating the chart model from dto (data transfer object) from web service, this model is binded with charts.
var dto = await Controller.Instance().DbService().FetchLineChartData(id).ConfigureAwait(false);
Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
{
if (dto != null)
{
model_.Update(dto);
}
});