private async void LoadWorkshops(int workshopSet, int position, bool localOnly, bool force = false) { if (CurrentWorkshopSet > 0) { cts.Cancel(); workshopList = await Services.Workshop.GetWorkshops(cts.Token, workshopSet, localOnly, force); workshopListAdapter.Clear(); workshopListAdapter.AddAll(workshopList, position); listActioner = new ListActionHelper(workshopListAdapter, workshopListView, this, true); ViewHelper.ToggleMenu(menu, true); RunOnUiThread(delegate { if (workshopListAdapter.Count > 0) { FindViewById <ProgressBar>(Resource.Id.workshopLoading).Visibility = ViewStates.Gone; NotifyWorkshopListUpdate(); } else if (!localOnly) { FindViewById <ProgressBar>(Resource.Id.workshopLoading).Visibility = ViewStates.Gone; FindViewById <TextView>(Resource.Id.noWorkshops).Visibility = ViewStates.Visible; } }); } }
private async void InitList(Android.Views.View context, Android.Views.LayoutInflater inflater) { cts.Cancel(); //Load from local first await Task.Factory.StartNew(() => LoadData(context, true)); listActioner = new ListActionHelper(listAdapter, listView, activity, isWorkshop); //Do background refresh await Task.Factory.StartNew(() => LoadData(context, false)); }
public bool Back() { if (viewFlipper.DisplayedChild > 0) { workshopListAdapter.Clear(); NotifyListUpdate(); CurrentWorkshopSet = 0; listActioner = null; ViewHelper.ToggleMenu(menu, false); return(FlipView()); } return(false); }