Example #1
0
        public async void ShowRequests(int group_id)
        {
            var token = prefs.GetString("token", null);

            if (token != null && (Activity as GroupContentActivity).CheckConnection())
            {
                try
                {
                    progressBar.Visibility   = ViewStates.Visible;
                    contentLayout.Visibility = ViewStates.Gone;
                    var requests = await _manager.GetPostPermissionRequests(token, group_id);

                    if (requests != null)
                    {
                        requestsList.Members = requests;
                        requestsAdapter.NotifyDataSetChanged();
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    var    dialog  = new Android.App.AlertDialog.Builder(Context);
                    string message = "Ваши параметры авторизации устарели." +
                                     "\nВы будете возвращены на страницу авторизации, чтобы пройти процедуру авторизации заново";
                    dialog.SetMessage(message);
                    dialog.SetCancelable(false);
                    dialog.SetPositiveButton("Ок", delegate
                    {
                        (Activity as GroupContentActivity).Finish();
                    });
                    dialog.Show();
                }
                catch (Exception ex)
                {
                    var    dialog  = new Android.App.AlertDialog.Builder(Context);
                    string message = ex.Message;
                    dialog.SetMessage(message);
                    dialog.SetPositiveButton("Ок", delegate { });
                    dialog.Show();
                }
                finally
                {
                    progressBar.Visibility   = ViewStates.Gone;
                    contentLayout.Visibility = ViewStates.Visible;
                    swiperefresh.Refreshing  = false;
                }
            }
        }