public override void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); if (_albums != null) { ListAdapter = new StoreListAdapter(Activity, _albums); } else if (!_isGettingRemoteAlbums) { GetRemoteAlbumsAsync(); } }
public override void OnActivityCreated (Bundle savedInstanceState) { base.OnActivityCreated (savedInstanceState); if (_albums != null) { ListAdapter = new StoreListAdapter (Activity, _albums); } else if (!_isGettingRemoteAlbums) { GetRemoteAlbumsAsync (); } }
void GetRemoteAlbumsAsync() { Task.Factory .StartNew(() => GetRemoteAlbums()) .ContinueWith(t => { if (!t.IsFaulted && t.Result != null && Activity != null) { _albums = t.Result; ListAdapter = new StoreListAdapter(Activity, _albums); } _isGettingRemoteAlbums = false; }, TaskScheduler.FromCurrentSynchronizationContext() ); }
void GetRemoteAlbumsAsync () { Task.Factory .StartNew (() => GetRemoteAlbums ()) .ContinueWith (t => { if (!t.IsFaulted && t.Result != null && Activity != null) { _albums = t.Result; ListAdapter = new StoreListAdapter (Activity, _albums); } _isGettingRemoteAlbums = false; }, TaskScheduler.FromCurrentSynchronizationContext () ); }