예제 #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            RowModel currentModel = sections[indexPath.Section].Rows[indexPath.Row];

            UITableViewCell cell = tableView.DequeueReusableCell("cell") ??
                                   new UITableViewCell(UITableViewCellStyle.Subtitle, "Cell");

            switch (currentModel.CellAccessory)
            {
            case UITableViewCellAccessory.Checkmark:
                cell.Accessory = currentModel.IsChecked ? currentModel.CellAccessory : UITableViewCellAccessory.None;
                break;

            default:
                cell.Accessory = currentModel.CellAccessory;
                break;
            }

            cell.Tag            = indexPath.Row;
            cell.TextLabel.Text = currentModel.Name;
            cell.AccessoryView  = currentModel.AccessoryView;

            if (currentModel.CustomUI != null)
            {
                currentModel.CustomUI.Frame = currentModel.CustomUIBounds;
                cell.Add(currentModel.CustomUI);
            }

            return(cell);
        }
예제 #2
0
        public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            RowModel currentModel = sections[indexPath.Section].Rows[indexPath.Row];

            if (currentModel.RowHeight > 0)
            {
                return(currentModel.RowHeight);
            }
            return(UITableView.AutomaticDimension);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UITableView           baseMapTypeTableView = new UITableView(View.Frame);
            DataTableSource       baseMapTypeSource    = new DataTableSource();
            Collection <RowModel> baseMapTypeRows      = new Collection <RowModel>();

            string[] baseMapTypeItems = { "World Map Kit Road", "World Map Kit Aerial", "World Map Kit Aerial With Labels", "Open Street Map", "Bing Maps Aerial", "Bing Maps Road" };
            foreach (var nameItem in baseMapTypeItems)
            {
                RowModel row = new RowModel(nameItem);
                row.CellAccessory = UITableViewCellAccessory.Checkmark;
                baseMapTypeRows.Add(row);
            }
            baseMapTypeRows[0].IsChecked = true;

            SectionModel baseMapTypeSection = new SectionModel(string.Empty, baseMapTypeRows);

            baseMapTypeSource.Sections.Add(baseMapTypeSection);
            baseMapTypeSource.RowClick  = BaseMapTypeRowClick;
            baseMapTypeTableView.Source = baseMapTypeSource;
            View = baseMapTypeTableView;
        }
        private void InitializeOptionsSource()
        {
            earthquakePointLayer = (ShapeFileFeatureLayer)Global.HighLightOverlay.Layers["EarthquakePointLayer"];
            earthquakeHeatLayer  = (HeatLayer)Global.HighLightOverlay.Layers["EarthquakeHeatLayer"];

            int rowWidth   = 400;
            int sliderWith = 190;

            if (Global.UserInterfaceIdiomIsPhone)
            {
                rowWidth   = 300;
                sliderWith = 90;
            }

            baseMapTypeSource           = new DataTableSource();
            baseMapTypeSource.RowClick += RowClick;

            RectangleF rowFrame = new RectangleF(10, 5, rowWidth, 30);

            Collection <RowModel> baseMapRows = new Collection <RowModel>();
            RowModel baseMapModel             = new RowModel("Base Map");

            baseMapLabel = new UILabel(new RectangleF(5, 5, rowWidth * 0.6f, 40));
            baseMapLabel.TextAlignment          = UITextAlignment.Right;
            baseMapLabel.TextColor              = UIColor.Black;
            baseMapLabel.UserInteractionEnabled = false;

            baseMapModel.CellAccessory  = UITableViewCellAccessory.DisclosureIndicator;
            baseMapModel.CustomUI       = baseMapLabel;
            baseMapModel.CustomUIBounds = new RectangleF(rowWidth * 0.35f, 10, rowWidth * 0.6f, 30);
            baseMapModel.RowHeight      = 50;
            baseMapRows.Add(baseMapModel);
            baseMapTypeSource.Sections.Add(new SectionModel("Base Map Type", baseMapRows)
            {
                HeaderHeight = 30
            });

            Collection <RowModel> displayTypeRows = new Collection <RowModel>();
            RowModel           displayTypeModel   = new RowModel(string.Empty);
            UISegmentedControl displayTypeSegment = new UISegmentedControl();

            displayTypeSegment.InsertSegment("Point Type", 1, true);
            displayTypeSegment.InsertSegment("Heat Style", 2, true);
            displayTypeSegment.InsertSegment("IsoLine Style", 3, true);
            displayTypeSegment.ValueChanged   += DisplayTypeSegmentValueChanged;
            displayTypeSegment.SelectedSegment = 0;
            displayTypeModel.CustomUI          = displayTypeSegment;
            displayTypeModel.CustomUIBounds    = new RectangleF(10, 10, rowWidth, 30);
            displayTypeModel.RowHeight         = 50;

            displayTypeRows.Add(displayTypeModel);
            baseMapTypeSource.Sections.Add(new SectionModel("Display Type", displayTypeRows)
            {
                HeaderHeight = 30
            });

            Collection <RowModel> queryOperation = new Collection <RowModel>();
            RowModel magnitude = new RowModel(string.Empty);
            RowModel depth     = new RowModel(string.Empty);
            RowModel date      = new RowModel(string.Empty);

            RectangleF silderFrame = new RectangleF(150, 0, sliderWith, 30);

            RangeSliderView magnitudeView =
                new RangeSliderView(new UIRangeSlider(silderFrame, Global.QueryConfiguration.LowerMagnitude,
                                                      Global.QueryConfiguration.UpperMagnitude, Global.QueryConfiguration.LowerMagnitude,
                                                      Global.QueryConfiguration.UpperMagnitude)
            {
                Name = "Magnitude:"
            });

            magnitudeView.Frame      = rowFrame;
            magnitude.CustomUI       = magnitudeView;
            magnitude.CustomUIBounds = rowFrame;
            magnitude.RowHeight      = 45;

            RangeSliderView depthView =
                new RangeSliderView(new UIRangeSlider(silderFrame, Global.QueryConfiguration.LowerDepth,
                                                      Global.QueryConfiguration.UpperDepth, Global.QueryConfiguration.LowerDepth,
                                                      Global.QueryConfiguration.UpperDepth)
            {
                Name = "Depth(KM):"
            });

            depthView.Frame      = rowFrame;
            depth.CustomUI       = depthView;
            depth.CustomUIBounds = rowFrame;
            depth.RowHeight      = 45;

            RangeSliderView dateView =
                new RangeSliderView(new UIRangeSlider(silderFrame, Global.QueryConfiguration.LowerYear,
                                                      Global.QueryConfiguration.UpperYear, Global.QueryConfiguration.LowerYear,
                                                      Global.QueryConfiguration.UpperYear)
            {
                Name = "Date(Year):"
            });

            dateView.Frame      = rowFrame;
            date.CustomUI       = dateView;
            date.CustomUIBounds = rowFrame;
            date.RowHeight      = 45;

            queryOperation.Add(magnitude);
            queryOperation.Add(depth);
            queryOperation.Add(date);
            baseMapTypeSource.Sections.Add(new SectionModel("Query Operation", queryOperation)
            {
                HeaderHeight = 30
            });
            tbvBaseMapType.Source = baseMapTypeSource;
        }