示例#1
0
        private void MAdapterOnItemClick(object sender, InviteMembersAdapterClickEventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                ItemUser = MAdapter.GetItem(e.Position);
                if (ItemUser != null)
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Page.PageAddAsync(PageId, ItemUser.UserId)
                    });

                    Toast.MakeText(this, GetString(Resource.String.Lbl_Added), ToastLength.Short)?.Show();

                    var local = MAdapter.UserList.FirstOrDefault(a => a.UserId == ItemUser.UserId);
                    if (local != null)
                    {
                        MAdapter.UserList.Remove(local);
                        MAdapter.NotifyItemRemoved(MAdapter.UserList.IndexOf(local));
                    }

                    switch (MAdapter.UserList.Count)
                    {
                    case 0:
                        ShowEmptyPage();
                        break;
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#2
0
        private void MAdapterOnItemClick(object sender, InviteMembersAdapterClickEventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    return;
                }

                ItemUser = MAdapter.GetItem(e.Position);
                if (ItemUser != null)
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Group.GroupAdd(GroupId, ItemUser.UserId)
                    });

                    Toast.MakeText(this, GetString(Resource.String.Lbl_Done), ToastLength.Short).Show();

                    var local = MAdapter.UserList.FirstOrDefault(a => a.UserId == ItemUser.UserId);
                    if (local != null)
                    {
                        MAdapter.UserList.Remove(local);
                        MAdapter.NotifyItemRemoved(MAdapter.UserList.IndexOf(local));
                    }

                    if (MAdapter.UserList.Count == 0)
                    {
                        ShowEmptyPage();
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }