Esempio n. 1
0
        public void GetGuardResponsableFromServer()
        {
            // Get person in guard from server

            Task.Run(async() =>
            {
                try
                {
                    PersonGuard personGuard = await AysaClient.Instance.GetGuardResponsableByName(UserSession.Instance.UserName);

                    Activity.RunOnUiThread(() =>
                    {
                        // Save person in guard in user session
                        UserSession.Instance.PersonInGuard = personGuard;
                    });
                }
                catch (HttpUnauthorized)
                {
                    //Activity.RunOnUiThread(() =>
                    //{
                    //    ShowErrorAlert("Sin autorización para operar.");
                    //});
                }
                catch (Exception ex)
                {
                    Activity.RunOnUiThread(() =>
                    {
                        ShowErrorAlert(ex.Message);
                    });
                }
            });
        }
        public override UIView GetViewForHeader(UITableView tableView, nint section)
        {
            HeaderPersonChargeCell header      = HeaderPersonChargeCell.Create(new CGRect(0, 0, this.owner.View.Frame.Width, HeightHeaderView));
            PersonGuard            personGuard = PeopleInGuard[(int)section];

            header.LoadPersonGuardInView(personGuard);

            return(header);
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            // Get Person in Guard and his contact type
            PersonGuard personGuard = PeopleInGuard[indexPath.Section];
            ContactType contactType = personGuard.ContactTypes[indexPath.Row];

            owner.ContacSelectedFromTableView(contactType);

            //tableView.DeselectRow(indexPath, false);
        }
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            PersonInChargeViewHolder vh = holder as PersonInChargeViewHolder;
            PersonGuard personGuard     = mPersonInChargeList[position];

            vh.txtNameTitle.Text = personGuard.NombreApellido;
            for (int i = 0; i < personGuard.ContactTypes.Count; i++)
            {
                ContactType contactType = personGuard.ContactTypes[i];

                // This flag is using to remove the separator line in the last row
                bool isLastRowInSection = i == personGuard.ContactTypes.Count - 1 ? true : false;

                vh.addSection(contactType, isLastRowInSection, OnClick);
            }
        }
        public void GetGuardResponsableFromServer()
        {
            // Get person in guard from server

            // Display an Activity Indicator in the status bar
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

            Task.Run(async() =>
            {
                try
                {
                    PersonGuard personGuard = await AysaClient.Instance.GetGuardResponsableByName(UserSession.Instance.UserName);

                    InvokeOnMainThread(() =>
                    {
                        // Save person in guard in user session
                        UserSession.Instance.PersonInGuard = personGuard;
                    });
                }
                catch (HttpUnauthorized)
                {
                    InvokeOnMainThread(() =>
                    {
                        ShowSessionExpiredError();
                    });
                }
                catch (Exception ex)
                {
                    InvokeOnMainThread(() =>
                    {
                        ShowErrorAlert(ex.Message);
                    });
                }
                finally
                {
                    // Dismiss an Activity Indicator in the status bar
                    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
                }
            });
        }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell(CellIdentifier) as PersonInChargeTableViewCell;

            // Remove the cell highlight color
            cell.SelectionStyle      = UITableViewCellSelectionStyle.None;
            cell.isLastCellInSection = false;

            // Get Person in Guard and his contact type
            PersonGuard personGuard = PeopleInGuard[indexPath.Section];
            ContactType contactType = personGuard.ContactTypes[indexPath.Row];


            if (indexPath.Row == personGuard.ContactTypes.Count - 1)
            {
                // Round bottom corners for the last row of tableView
                cell.isLastCellInSection = true;
            }

            cell.loadElementsInCell(contactType);

            return(cell);
        }
 public void LoadPersonGuardInView(PersonGuard person)
 {
     NameLabel.Text = person.NombreApellido;
 }
        public override nint RowsInSection(UITableView tableview, nint section)
        {
            PersonGuard personGuard = PeopleInGuard[(int)section];

            return(personGuard.ContactTypes.Count);
        }