Пример #1
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell cell = tableView.DequeueReusableCell("cell");
                OptionInfo      info = null;

                if (this.owner.owner.Sections.Length > 0)
                {
                    OptionSection sectionInfo = this.owner.owner.Sections [indexPath.Section];
                    info = sectionInfo.Items [indexPath.Row];
                    if (indexPath.Row == sectionInfo.SelectedOption)
                    {
                        cell.Accessory = UITableViewCellAccessory.Checkmark;
                    }
                }
                else
                {
                    info = this.owner.owner.Options [indexPath.Row];
                    if (indexPath.Row == this.owner.owner.SelectedOption)
                    {
                        cell.Accessory = UITableViewCellAccessory.Checkmark;
                    }
                }

                cell.TextLabel.Text = info.OptionText;
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                return(cell);
            }
Пример #2
0
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                this.owner.owner.SelectedOption = indexPath.Row;
                OptionInfo info = null;

                if (this.owner.owner.Sections.Length > 0)
                {
                    OptionSection sectionInfo = this.owner.owner.Sections [indexPath.Section];
                    info = sectionInfo.Items [indexPath.Row];
                    sectionInfo.SelectedOption = indexPath.Row;
                }
                else
                {
                    info = this.owner.owner.Options [indexPath.Row];
                    this.owner.owner.SelectedOption = indexPath.Row;
                }

                if (info.Handler != null)
                {
                    info.Handler(info, EventArgs.Empty);
                }

                if (this.owner.owner.Popover != null && this.owner.owner.Popover.PopoverVisible)
                {
                    this.owner.owner.Popover.Dismiss(false);
                }
                else
                {
                    this.owner.NavigationController.PopViewController(true);
                }
            }
Пример #3
0
            public override nint RowsInSection(UITableView tableView, nint section)
            {
                if (this.owner.owner.Sections.Length > 0)
                {
                    OptionSection sectionInfo = this.owner.owner.Sections[section];
                    return(sectionInfo.Items.Count);
                }

                return(owner.owner.Options.Length);
            }
Пример #4
0
        void AddOptionInSection(OptionInfo option, string sectionName)
        {
            foreach (OptionSection section in this.sections)
            {
                if (section.Title.Equals(sectionName))
                {
                    section.Items.Add(option);
                    return;
                }
            }

            OptionSection newSection = new OptionSection(sectionName);

            newSection.Items.Add(option);
            this.sections.Add(newSection);
        }
Пример #5
0
        public void SetSelectedOptionInSection(int selectedOption, int section)
        {
            OptionSection sec = sections [section];

            sec.SelectedOption = selectedOption;
        }
        void AddOptionInSection(OptionInfo option, string sectionName)
        {
            foreach (OptionSection section in this.sections) {
                if (section.Title.Equals(sectionName)) {
                    section.Items.Add (option);
                    return;
                }
            }

            OptionSection newSection = new OptionSection(sectionName);
            newSection.Items.Add(option);
            this.sections.Add(newSection);
        }
Пример #7
0
            public override string TitleForHeader(UITableView tableView, nint section)
            {
                OptionSection sectionInfo = this.owner.owner.Sections[section];

                return(sectionInfo.Title);
            }