Esempio n. 1
0
        //Refresh
        private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e)
        {
            try
            {
                MAdapter.LastActivitiesList.Clear();
                MAdapter.NotifyDataSetChanged();

                MainScrollEvent.IsLoading = false;

                StartApiService();
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Esempio n. 2
0
        //Refresh
        private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e)
        {
            try
            {
                MAdapter.LastActivitiesList.Clear();
                MAdapter.NotifyDataSetChanged();

                MainScrollEvent.IsLoading = false;

                StartApiService();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Esempio n. 3
0
        private async Task LoadActivitiesAsync(string offset = "0")
        {
            if (Methods.CheckConnectivity())
            {
                int countList = MAdapter.LastActivitiesList.Count;
                (int apiStatus, var respond) = await RequestsAsync.Global.Get_Activities("6", offset);

                if (apiStatus == 200)
                {
                    if (respond is LastActivitiesObject result)
                    {
                        var respondList = result.Activities.Count;
                        if (respondList > 0)
                        {
                            if (countList > 0)
                            {
                                foreach (var item in from item in result.Activities let check = MAdapter.LastActivitiesList.FirstOrDefault(a => a.Id == item.Id) where check == null select item)
                                {
                                    MAdapter.LastActivitiesList.Add(item);
                                }

                                Activity.RunOnUiThread(() => { MAdapter.NotifyItemRangeInserted(countList, MAdapter.LastActivitiesList.Count - countList); });
                            }
                            else
                            {
                                MAdapter.LastActivitiesList = new ObservableCollection <ActivityDataObject>(result.Activities);
                                Activity.RunOnUiThread(() => { MAdapter.NotifyDataSetChanged(); });
                            }
                        }
                        else
                        {
                            if (MAdapter.LastActivitiesList.Count > 10 && !LastActivitiesRecyclerView.CanScrollVertically(1))
                            {
                                Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_NoMoreActivities), ToastLength.Short)?.Show();
                            }
                        }
                    }
                }
                else
                {
                    Methods.DisplayReportResult(Activity, respond);
                }

                //MainScrollEvent.IsLoading = false;
                Activity.RunOnUiThread(ShowEmptyPage);
            }
            else
            {
                LastActivitiesRecyclerView.Visibility     = ViewStates.Gone;
                LayoutSuggestionLastActivities.Visibility = ViewStates.Gone;

                Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
            }
        }
Esempio n. 4
0
        //Refresh
        private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e)
        {
            try
            {
                MAdapter.LastActivitiesList.Clear();
                MAdapter.NotifyDataSetChanged();

                if (Methods.CheckConnectivity())
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => ContextProfile.GetActivities()
                    });
                }
                else
                {
                    Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }