Ejemplo n.º 1
0
        public override UIView GetViewForHeader(UITableView tableView, nint section)
        {
            StructureSectionDto structureSection = null;

            if (sectionsWithRows.structureSectionList != null && sectionsWithRows.structureSectionList.Count > 0)
            {
                structureSection = sectionsWithRows.structureSectionList[(int)section];
            }
            else
            {
                return(null);
            }

            var cell = (HeaderViewCell)tableView.DequeueReusableCell("HeaderCell");

            cell.SetContent(structureSection.description);

            if (IsOdd((int)section + 1))
            {
                cell.ContentView.BackgroundColor = ColorHelper.FromType(ColorType.OddRow);
            }
            else
            {
                cell.ContentView.BackgroundColor = ColorHelper.FromType(ColorType.EvenRow);
            }

            return(cell.ContentView);
        }
        void SetupSectionsWithElements()
        {
            // Structure that all will be added to
            structure = new StructureDto();

            // Hendelse
            StructureSectionDto structureHendelse = structure.AddStructureSection(LangUtil.Get("Structure.Hendelse.Header"));

            structureHendelse.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Hendelse.Trafikk"), "ic_trafikk");
            structureHendelse.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Hendelse.Brann"), "ic_brann");

            // Eksakt posisjon
            StructureSectionDto structureEksaktPosisjon = structure.AddStructureSection(LangUtil.Get("Structure.EksaktPosisjon.Header"));

            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Position, LangUtil.Get("Structure.EksaktPosisjon.Posisjon"), "ic_posisjon");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Address, LangUtil.Get("Structure.EksaktPosisjon.Adresse"), "ic_adresse");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.EksaktPosisjon.Oppmotested"), "ic_oppmotested");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.EksaktPosisjon.Ankomst"), "ic_ankomst");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.EksaktPosisjon.Avreise"), "ic_avreise");

            // Nivå
            StructureSectionDto structureNiva = structure.AddStructureSection(LangUtil.Get("Structure.Niva.Header"));

            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Niva.1"), "ic_1");
            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Niva.2"), "ic_2");
            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Niva.3"), "ic_3");
            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Niva.QuattroVarsling"), "ic_quattro");

            // Sikkerhet
            StructureSectionDto structureSikkerhet = structure.AddStructureSection(LangUtil.Get("Structure.Sikkerhet.Header"));

            structureSikkerhet.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Sikkerhet.Farer"), "ic_farer");
            structureSikkerhet.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Sikkerhet.Brann"), "ic_brann");
            structureSikkerhet.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Sikkerhet.Sikkerhet"), "ic_sikkerhet");

            // Pasienter
            StructureSectionDto structurePasienter = structure.AddStructureSection(LangUtil.Get("Structure.Pasienter.Header"));

            structurePasienter.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Pasienter.Antall"), "ic_pasienter");
            structurePasienter.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Pasienter.Type"), "ic_skader");
            structurePasienter.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Pasienter.Omfang"), "ic_skademekanikk");

            // Evakuering
            StructureSectionDto structureEvakuering = structure.AddStructureSection(LangUtil.Get("Structure.Evakuering.Header"));

            structureEvakuering.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Evakuering.Flaskehalser"), "ic_flaskehalser");
            structureEvakuering.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Evakuering.Kjeder"), "ic_evakuering");
            structureEvakuering.AddStructureElement(StructureElementDto.ElementType.Normal, LangUtil.Get("Structure.Evakuering.Rett"), "ic_rett");

            structure.currentStructureSectionId = 0;
        }
Ejemplo n.º 3
0
        void SetupSectionsWithElements()
        {
            // Structure that all will be added to
            structure = new StructureDto();

            // Hendelse
            StructureSectionDto structureHendelse = structure.AddStructureSection(Resources.GetString(Resource.String.Structure_Hendelse_Header), "");

            structureHendelse.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Hendelse_Trafikk), "ic_trafikk");
            structureHendelse.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Hendelse_Brann), "ic_brann");

            // Eksakt posisjon
            StructureSectionDto structureEksaktPosisjon = structure.AddStructureSection(Resources.GetString(Resource.String.Structure_EksaktPosisjon_Header), "");

            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Position, Resources.GetString(Resource.String.Structure_EksaktPosisjon_Posisjon), "ic_posisjon");
            //  structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Address, Resources.GetString(Resource.String.Structure_EksaktPosisjon_Adresse), "ic_adresse");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_EksaktPosisjon_Oppmotested), "ic_oppmotested");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_EksaktPosisjon_Ankomst), "ic_ankomst");
            structureEksaktPosisjon.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_EksaktPosisjon_Avreise), "ic_avreise");

            // Nivå
            StructureSectionDto structureNiva = structure.AddStructureSection(Resources.GetString(Resource.String.Structure_Niva_Header), "");

            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Niva_1), "ic_1");
            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Niva_2), "ic_2");
            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Niva_3), "ic_3");
            structureNiva.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Niva_QuattroVarsling), "ic_quattro");

            // Sikkerhet
            StructureSectionDto structureSikkerhet = structure.AddStructureSection(Resources.GetString(Resource.String.Structure_Sikkerhet_Header), "");

            structureSikkerhet.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Sikkerhet_Farer), "ic_farer");
            structureSikkerhet.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Sikkerhet_Brann), "ic_brann");
            structureSikkerhet.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Sikkerhet_Sikkerhet), "ic_sikkerhet");

            // Pasienter
            StructureSectionDto structurePasienter = structure.AddStructureSection(Resources.GetString(Resource.String.Structure_Pasienter_Header), "");

            structurePasienter.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Pasienter_Antall), "ic_pasienter");
            structurePasienter.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Pasienter_Type), "ic_skader");
            structurePasienter.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Pasienter_Omfang), "ic_skademekanikk");

            // Evakuering
            StructureSectionDto structureEvakuering = structure.AddStructureSection(Resources.GetString(Resource.String.Structure_Evakuering_Header), "");

            structureEvakuering.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Evakuering_Flaskehalser), "ic_flaskehalser");
            structureEvakuering.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Evakuering_Kjeder), "ic_evakuering");
            structureEvakuering.AddStructureElement(StructureElementDto.ElementType.Normal, Resources.GetString(Resource.String.Structure_Evakuering_Rett), "ic_rett");
        }
Ejemplo n.º 4
0
        public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            const string normalCellIdentifier = "MainNormalCell";
            const string positionIdentifier   = "MainLocationCell";
            const string addressIdentifier    = "AddressCell";

            int section = indexPath.Section;
            int row     = indexPath.Row;

            string cellIdenifier;

            StructureElementDto structureElement = null;

            if (sectionsWithRows.structureSectionList != null && sectionsWithRows.structureSectionList.Count > 0)
            {
                StructureSectionDto structureSection = sectionsWithRows.structureSectionList[(int)section];

                if (structureSection.structureElementList != null && structureSection.structureElementList.Count > 0)
                {
                    structureElement = structureSection.structureElementList[row];
                }
            }

            if (structureElement == null)
            {
                cellIdenifier = null;
            }

            if (structureElement.elementType == StructureElementDto.ElementType.Normal)
            {
                cellIdenifier = normalCellIdentifier;
            }
            else if (structureElement.elementType == StructureElementDto.ElementType.Position)
            {
                cellIdenifier = positionIdentifier;
            }
            else if (structureElement.elementType == StructureElementDto.ElementType.Address)
            {
                cellIdenifier = addressIdentifier;
            }
            else
            {
                cellIdenifier = null;
            }

            var cell = tableView.DequeueReusableCell(cellIdenifier);

            return(cell.Bounds.Height);
        }
Ejemplo n.º 5
0
        public override nfloat GetHeightForHeader(UITableView tableView, nint section)
        {
            if (sectionsWithRows.structureSectionList != null && sectionsWithRows.structureSectionList.Count > 0)
            {
                StructureSectionDto structureSection = sectionsWithRows.structureSectionList[(int)section];

                if (structureSection.structureElementList != null && structureSection.structureElementList.Count > 0)
                {
                    return(headerHeight);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 6
0
        public override nint RowsInSection(UITableView tableview, nint section)
        {
            if (sectionsWithRows.structureSectionList != null && sectionsWithRows.structureSectionList.Count > 0)
            {
                StructureSectionDto structureSection = sectionsWithRows.structureSectionList[(int)section];

                if (structureSection.structureElementList != null && structureSection.structureElementList.Count > 0)
                {
                    return(structureSection.structureElementList.Count);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 7
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = null;
            const string    normalCellIdentifier = "MainNormalCell";
            const string    positionIdentifier   = "MainLocationCell";
            const string    addressIdentifier    = "AddressCell";

            int section = indexPath.Section;
            int row     = indexPath.Row;

            StructureElementDto structureElement = null;

            if (sectionsWithRows.structureSectionList != null && sectionsWithRows.structureSectionList.Count > 0)
            {
                StructureSectionDto structureSection = sectionsWithRows.structureSectionList[(int)section];

                if (structureSection.structureElementList != null && structureSection.structureElementList.Count > 0)
                {
                    structureElement = structureSection.structureElementList[row];
                }
            }

            if (structureElement == null)
            {
                return(null);
            }

            if (structureElement.elementType == StructureElementDto.ElementType.Normal)
            {
                // Normal row
                MainNormalRowViewCell mainNormalRowViewCell = tableView.DequeueReusableCell(normalCellIdentifier, indexPath) as MainNormalRowViewCell;

                mainNormalRowViewCell.SetContent(structureElement);

                cell = mainNormalRowViewCell;
            }
            else if (structureElement.elementType == StructureElementDto.ElementType.Position)
            {
                // Location row
                MainLocationRowViewCell locationCell = tableView.DequeueReusableCell(positionIdentifier, indexPath) as MainLocationRowViewCell;
                locationCell.SetContent();
                cell = locationCell;
            }
            else if (structureElement.elementType == StructureElementDto.ElementType.Address)
            {
                var addressCell = tableView.DequeueReusableCell(addressIdentifier, indexPath) as AddressViewCell;
                addressCell.SetContent();
                cell = addressCell;
            }
            else
            {
                return(null);
            }

            if (cell != null)
            {
                if (IsOdd((int)section + 1))
                {
                    cell.BackgroundColor = ColorHelper.FromType(ColorType.OddRow);
                }
                else
                {
                    cell.BackgroundColor = ColorHelper.FromType(ColorType.EvenRow);
                }
            }
            return(cell);
        }