I have asynchronous calls from the Init model in a view. The problem is that sometimes the asynchronous call returns to OnCreate, and the property in the user interface is not updated. Is there a suitable asynchronous / pending model for this case when we need to initialize asynchronous data?
pseudo code:
public async Task Init(string id)
{
Url = await LoadUrlAsync(id);
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.ui_xml);
ViewModel.PropertyChanged += ViewModel_PropertyChanged;
}
void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
_webView.LoadUrl(ViewModel.Url);
}
source
share