// CREATE EQUIPMENT BLOCK FROM LDT

        public void CreateLDTXmlEquipment()
        {
            Parse_LDT ldtparser = new Parse_LDT();
            //ldtparser.ParseLDT();

            var equipdata = new UNI11733Equipment()
            {
                Gonioradiometer = new UNI11733EquipmentGonioradiometer()
                {
                    Type = UNI11733EquipmentGonioradiometerType.CIE_A
                }
            };

            xml.Equipment = new[] { equipdata };
        }
        // CREATE HEADER BLOCK FROM LDT

        public void CreateLDTXmlHeader()
        {
            //MessageBox.Show(Moreinfouri.MoreInfoURL);
            //MessageBox.Show(DocumentCreator.DocCreator);
            //MessageBox.Show(DocumentComments.DocComments);
            //MessageBox.Show(LampCode.LampCatNumber);

            Parse_LDT ldtparser = new Parse_LDT();

            //--------------CREATE HEADER BLOCK FROM LDT --------------------------

            CommentList.Clear();
            CommentList.Add(DocumentComments.DocComments);
            // Convert to array
            var ldtCommentArray = CommentList.ToArray();

            iesReferenceList.Clear();
            iesReferenceList.Add(Photometric_management.Instance.ldtiesname);
            // Convert to array
            var IESLDTReferenceArray = iesReferenceList.ToArray();

            //ldtparser.ParseLDT();

            var headerdata = new UNI11733Header
            {
                Manufacturer  = Manufacture,
                CatalogNumber = CatalogNumber,
                GTIN          = GTINnumber.GTINnum,
                Description   = Model_Description,
                Laboratory    = Laboratory.Lab,
                ReportNumber  = ReportNumber,
                ReportDate    = ReportDate,

                DocumentCreator      = DocumentCreator.DocCreator,
                DocumentCreationDate = DateTime.Now,
                //DocumentCreationDate = DateTime.Today,
                DocumentCreationDateSpecified = true,
                UniqueIdentifier = UUIDContainer.UUIDvalue,
                Comment          = ldtCommentArray,
                Reference        = IESLDTReferenceArray,
                MoreInfoURI      = Moreinfouri.MoreInfoURL //"www.relux.com"
            };

            xml.Header = new[] { headerdata };
        }
        // CREATE DOMENSION BLOCK FROM LDT

        public void CreateLDTXmlDimensions()
        {
            Parse_LDT ldtparser = new Parse_LDT();
            //ldtparser.ParseLDT();

            var dimensiondata = new UNI11733LuminaireDimensions();

            dimensiondata.Length = Convert.ToDecimal(EmitterBoxLength.EmBoxLength);
            dimensiondata.Width  = Convert.ToDecimal(EmitterBoxWidth.EmBoxWidth);
            dimensiondata.Height = Convert.ToDecimal(EmitterBoxHeight.EmBoxHeight);

            var luminairedata = new UNI11733Luminaire();

            //if (CircularShape == "Align_Z") // is cylindrical
            if (EmitterBoxShapeCirc.EmBoxShapeCirc == "Align_Z") // is cylindrical
            {
                luminairedata.Shape          = UNI11733LuminaireShape.Align_Z;
                luminairedata.ShapeSpecified = true;
            }
            else if (EmitterBoxShapeCirc.EmBoxShapeCirc == "Align_X") // is cylindrical
            {
                luminairedata.Shape          = UNI11733LuminaireShape.Align_X;
                luminairedata.ShapeSpecified = true;
            }

            else if (EmitterBoxShapeCirc.EmBoxShapeCirc == "Align_Y") // is cylindrical
            {
                luminairedata.Shape          = UNI11733LuminaireShape.Align_Y;
                luminairedata.ShapeSpecified = true;
            }


            luminairedata.NumEmitter = 1; //Int32.Parse(Eulumdatdata[25]);
            luminairedata.Dimensions = new[] { dimensiondata };

            xml.Luminaire = new[] { luminairedata };
        }
        // CREATE LIGHTSOURCE BLOCK FROM LDT

        public void CreateLDTXmlLightSource()
        {
            Parse_LDT ldtparser = new Parse_LDT();
            //ldtparser.ParseLDT();

            var coltempdata = new UNI11733EmitterColorTemperature();
            int fixedCCT;

            if (Int32.TryParse(FixedCCT, out fixedCCT))
            {
                coltempdata.FixedCCT = fixedCCT;
            }
            else
            {
                coltempdata.FixedCCT = 0;
            }
            coltempdata.FixedCCTSpecified = true;

            //--------------CREATE LIGHTSOURCE BLOCK FROM LDT--------------------------

            var lsourcedata = new UNI11733Emitter();

            lsourcedata.Quantity             = NumberLightSource;
            lsourcedata.Description          = LampDescription;
            lsourcedata.CatalogNumber        = "Not applicable";
            lsourcedata.RatedLumens          = RatedLumen;
            lsourcedata.RatedLumensSpecified = true;
            lsourcedata.InputWattage         = Decimal.Parse(InputWattage.Replace(",", "."));
            lsourcedata.ColorTemperature     = new[] { coltempdata };

            lsourcedata.ColorRendering = new UNI11733EmitterColorRendering()
            {
                CIE_CRI = new UNI11733EmitterColorRenderingCIE_CRI()
            };
            int ra;

            if (Int32.TryParse(RaCRI, out ra))
            {
                lsourcedata.ColorRendering.CIE_CRI.Ra = ra;
            }
            else
            {
                lsourcedata.ColorRendering.CIE_CRI.Ra = 0;
            }

            lsourcedata.LuminousData = new UNI11733EmitterLuminousData()
            {
                LuminousIntensity = new UNI11733EmitterLuminousDataLuminousIntensity()
            };

            lsourcedata.LuminousData.LuminousIntensity.AbsolutePhotometry = ABSPhotom;

            lsourcedata.LuminousData.LuminousIntensity.NumberMeasured = 1;

            lsourcedata.LuminousData.LuminousIntensity.NumberHorz = NumberHorizontal;

            lsourcedata.LuminousData.LuminousIntensity.NumberVert = NumberVertical;

            Decimal[] cplaneset = new Decimal[NumberHorizontal];

            for (int nhh = 0; nhh < NumberHorizontal; nhh++)
            {
                int cpindex = 42 + nhh;
                cplaneset[nhh] = Decimal.Parse(Ldtlines[cpindex].Replace(",", "."));
                //MessageBox.Show(cplaneset[nh].ToString());
            }
            ;

            Decimal[] distcpset = new Decimal[NumberVertical];

            for (int nvv = 0; nvv < NumberVertical; nvv++)
            {
                int distcpindex = 42 + NumberHorizontal + nvv;
                distcpset[nvv] = Decimal.Parse(Ldtlines[distcpindex].Replace(",", "."));
            }
            ;


            int xmlNHoriz = NumberHorizontal;

            if (symm == 1)
            {
                xmlNHoriz = 1;
            }
            ;

            if (symm == 2)
            {
                xmlNHoriz = 180 / (360 / NumberHorizontal) + 1;
            }
            ;

            if (symm == 3)
            {
                xmlNHoriz = 180 / (360 / NumberHorizontal) + 1;
            }
            ;

            if (symm == 4)
            {
                xmlNHoriz = 90 / (360 / NumberHorizontal) + 1;
            }
            ;

            int candelaidx = xmlNHoriz * NumberVertical;

            Decimal[] intensitydata = new decimal[candelaidx];

            for (int ni = 0; ni < candelaidx; ni++)
            {
                int idataindex = 42 + NumberHorizontal + NumberVertical + ni;
                intensitydata[ni] = Decimal.Parse(Ldtlines[idataindex].Replace(",", "."));
            }
            ;

            lsourcedata.LuminousData.LuminousIntensity.IntData = new IntDataType2[candelaidx];

            for (int nh = 0; nh < xmlNHoriz; nh++)
            {
                //lsourcedata.LuminousData.LuminousIntensity.IntData = new  IntDataType2() ;

                for (int nv = 0; nv < NumberVertical; nv++)
                {
                    lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical] = new IntDataType2();
                    if (symm == 3)
                    {
                        lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical].h = cplaneset[nh + 90 / (360 / NumberHorizontal)];
                    }
                    else
                    {
                        lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical].h = cplaneset[nh];
                    }
                    lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical].hSpecified = true;

                    lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical].v          = distcpset[nv];
                    lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical].vSpecified = true;

                    lsourcedata.LuminousData.LuminousIntensity.IntData[nv + nh * NumberVertical].Value = intensitydata[nv];
                }
                ;
            }
            ;


            //--------------CREATE EMISSIONAREAS BLOCK FROM LDT --------------------------

            lsourcedata.EmissionAreas = new UNI11733EmitterEmissionAreas();

            //------------ CREATE BOTTOM FACE FROM LDT-----------------------------

            if (DFF > 10)
            {
                lsourcedata.EmissionAreas.BottomFace = new UNI11733EmitterEmissionAreasBottomFace()
                {
                    BottomArea = new UNI11733EmitterEmissionAreasBottomFaceBottomArea()
                };

                lsourcedata.EmissionAreas.BottomFace.NumberBottom = Convert.ToInt32(NumEmitterBottomFace.NumEmBtmFace);

                lsourcedata.EmissionAreas.BottomFace.BottomArea.Length       = Convert.ToDecimal(EmitterBottomLength.EmBtmLength);
                lsourcedata.EmissionAreas.BottomFace.BottomArea.LengthOffset = Convert.ToDecimal(EmitterBottomLengthOffset.EmBtmLengthOff);

                if (Convert.ToDecimal(EmitterBottomWidth.EmBtmWidth) == 0)
                {
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.Width             = Convert.ToDecimal(EmitterBottomLength.EmBtmLength);
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.WidthOffset       = Convert.ToDecimal(EmitterBottomLengthOffset.EmBtmLengthOff);
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.Circular          = true;
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.CircularSpecified = true;
                }
                else
                {
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.Width             = Convert.ToDecimal(EmitterBottomWidth.EmBtmWidth);
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.WidthOffset       = Convert.ToDecimal(EmitterBottomWidthOffset.EmBtmWidthoff);
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.Circular          = false;
                    lsourcedata.EmissionAreas.BottomFace.BottomArea.CircularSpecified = false;
                }
            }

            //------------ CREATE TOP FACE FROM LDT -----------------------------


            if (DFF < 60)
            {
                lsourcedata.EmissionAreas.TopFace                      = new UNI11733EmitterEmissionAreasTopFace();
                lsourcedata.EmissionAreas.TopFace.NumberTop            = Convert.ToInt32(NumEmitterTopFace.NumEmTopFace);
                lsourcedata.EmissionAreas.TopFace.TopArea              = new UNI11733EmitterEmissionAreasTopFaceTopArea();
                lsourcedata.EmissionAreas.TopFace.TopArea.Length       = Convert.ToDecimal(EmitterTopLength.EmTopLength);
                lsourcedata.EmissionAreas.TopFace.TopArea.Width        = Convert.ToDecimal(EmitterTopWidth.EmTopWidth);
                lsourcedata.EmissionAreas.TopFace.TopArea.LengthOffset = Convert.ToDecimal(EmitterTopLengthOffset.EmTopLengthOff);
                lsourcedata.EmissionAreas.TopFace.TopArea.WidthOffset  = Convert.ToDecimal(EmitterTopWidthOffset.EmTopWidthoff);
                if (Convert.ToDecimal(EmitterTopWidth.EmTopWidth) == 0)
                {
                    lsourcedata.EmissionAreas.TopFace.TopArea.Circular          = true;
                    lsourcedata.EmissionAreas.TopFace.TopArea.CircularSpecified = true;
                }
                else
                {
                    lsourcedata.EmissionAreas.TopFace.TopArea.Circular          = false;
                    lsourcedata.EmissionAreas.TopFace.TopArea.CircularSpecified = false;
                }
            }

            //------------ CREATE C-0 FACE FROM LDT -----------------------------


            if (Convert.ToDecimal(EmitterC0Height.EmC0Height) != 0)
            {
                lsourcedata.EmissionAreas.C0Face                     = new UNI11733EmitterEmissionAreasC0Face();
                lsourcedata.EmissionAreas.C0Face.NumberC0            = Convert.ToInt32(NumEmitterC0Face.NumEmC0Face);
                lsourcedata.EmissionAreas.C0Face.C0Area              = new UNI11733EmitterEmissionAreasC0FaceC0Area();
                lsourcedata.EmissionAreas.C0Face.C0Area.Length       = Convert.ToDecimal(EmitterC0Width.EmC0Width);
                lsourcedata.EmissionAreas.C0Face.C0Area.Height       = Convert.ToDecimal(EmitterC0Height.EmC0Height);
                lsourcedata.EmissionAreas.C0Face.C0Area.LengthOffset = Convert.ToDecimal(EmitterC0WidthOffset.EmC0Widthoff);
                lsourcedata.EmissionAreas.C0Face.C0Area.HeightOffset = Convert.ToDecimal(EmitterC0HeightOffset.EmC0HeightOff);
                if (Convert.ToDecimal(EmitterC0Width.EmC0Width) == 0)
                {
                    lsourcedata.EmissionAreas.C0Face.C0Area.Circular          = true;
                    lsourcedata.EmissionAreas.C0Face.C0Area.CircularSpecified = true;
                }
                else
                {
                    lsourcedata.EmissionAreas.C0Face.C0Area.Circular          = false;
                    lsourcedata.EmissionAreas.C0Face.C0Area.CircularSpecified = false;
                }
            }

            //------------ CREATE C-90 FACE FROM LDT -----------------------------


            if (Convert.ToDecimal(EmitterC90Height.EmC90Height) != 0)
            {
                lsourcedata.EmissionAreas.C90Face                      = new UNI11733EmitterEmissionAreasC90Face();
                lsourcedata.EmissionAreas.C90Face.NumberC90            = Convert.ToInt32(NumEmitterC90Face.NumEmC90Face);
                lsourcedata.EmissionAreas.C90Face.C90Area              = new UNI11733EmitterEmissionAreasC90FaceC90Area();
                lsourcedata.EmissionAreas.C90Face.C90Area.Width        = Convert.ToDecimal(EmitterC90Length.EmC90Length);
                lsourcedata.EmissionAreas.C90Face.C90Area.Height       = Convert.ToDecimal(EmitterC0Height.EmC0Height);
                lsourcedata.EmissionAreas.C90Face.C90Area.WidthOffset  = Convert.ToDecimal(EmitterC90LengthOffset.EmC90LengthOff);
                lsourcedata.EmissionAreas.C90Face.C90Area.HeightOffset = Convert.ToDecimal(EmitterC90HeightOffset.EmC90HeightOff);
                if (Convert.ToDecimal(EmitterC90Length.EmC90Length) == 0)
                {
                    lsourcedata.EmissionAreas.C90Face.C90Area.Circular          = true;
                    lsourcedata.EmissionAreas.C90Face.C90Area.CircularSpecified = true;
                }
                else
                {
                    lsourcedata.EmissionAreas.C90Face.C90Area.Circular          = false;
                    lsourcedata.EmissionAreas.C90Face.C90Area.CircularSpecified = false;
                }
            }

            //------------ CREATE C-180 FACE FROM LDT -----------------------------


            if (Convert.ToDecimal(EmitterC180Height.EmC180Height) != 0)
            {
                lsourcedata.EmissionAreas.C180Face                       = new UNI11733EmitterEmissionAreasC180Face();
                lsourcedata.EmissionAreas.C180Face.NumberC180            = Convert.ToInt32(NumEmitterC180Face.NumEmC180Face);
                lsourcedata.EmissionAreas.C180Face.C180Area              = new UNI11733EmitterEmissionAreasC180FaceC180Area();
                lsourcedata.EmissionAreas.C180Face.C180Area.Length       = Convert.ToDecimal(EmitterC180Width.EmC180Width);
                lsourcedata.EmissionAreas.C180Face.C180Area.Height       = Convert.ToDecimal(EmitterC180Height.EmC180Height);
                lsourcedata.EmissionAreas.C180Face.C180Area.LengthOffset = Convert.ToDecimal(EmitterC180WidthOffset.EmC180WidthOff);
                lsourcedata.EmissionAreas.C180Face.C180Area.HeightOffset = Convert.ToDecimal(EmitterC180HeightOffset.EmC180HeightOff);
                if (Convert.ToDecimal(EmitterC180Width.EmC180Width) == 0)
                {
                    lsourcedata.EmissionAreas.C180Face.C180Area.Circular          = true;
                    lsourcedata.EmissionAreas.C180Face.C180Area.CircularSpecified = true;
                }
                else
                {
                    lsourcedata.EmissionAreas.C180Face.C180Area.Circular          = false;
                    lsourcedata.EmissionAreas.C180Face.C180Area.CircularSpecified = false;
                }
            }

            //------------ CREATE C-270 FACE FROM LDT -----------------------------


            if (Convert.ToDecimal(EmitterC270Height.EmC270Height) != 0)
            {
                lsourcedata.EmissionAreas.C270Face                       = new UNI11733EmitterEmissionAreasC270Face();
                lsourcedata.EmissionAreas.C270Face.NumberC270            = Convert.ToInt32(NumEmitterC270Face.NumEmC270Face);
                lsourcedata.EmissionAreas.C270Face.C270Area              = new UNI11733EmitterEmissionAreasC270FaceC270Area();
                lsourcedata.EmissionAreas.C270Face.C270Area.Width        = Convert.ToDecimal(EmitterC270Length.EmC270Length);
                lsourcedata.EmissionAreas.C270Face.C270Area.Height       = Convert.ToDecimal(EmitterC270Height.EmC270Height);
                lsourcedata.EmissionAreas.C270Face.C270Area.WidthOffset  = Convert.ToDecimal(EmitterC270LengthOffset.EmC270LengthOff);
                lsourcedata.EmissionAreas.C270Face.C270Area.HeightOffset = Convert.ToDecimal(EmitterC270HeightOffset.EmC270HeightOff);
                if (Convert.ToDecimal(EmitterC270Length.EmC270Length) == 0)
                {
                    lsourcedata.EmissionAreas.C270Face.C270Area.Circular          = true;
                    lsourcedata.EmissionAreas.C270Face.C270Area.CircularSpecified = true;
                }
                else
                {
                    lsourcedata.EmissionAreas.C270Face.C270Area.Circular          = false;
                    lsourcedata.EmissionAreas.C270Face.C270Area.CircularSpecified = false;
                }
            }

            //Decimal LDClengthoff = 0;
            //Decimal LDCwidthoff = 0;
            //Decimal LDCheightoff;
            //MessageBox.Show(DFF.ToString);

            LDClengthoff = Convert.ToDecimal(ECLengthOffset.ECLengthOff);
            LDCwidthoff  = Convert.ToDecimal(ECWidthOffset.ECWidthOff);

            if (DFF >= 40m && DFF < 60m)
            {
                LDCheightoff = 0;
            }
            else
            {
                LDCheightoff = -(Convert.ToDecimal(ECHeightOffset.ECHeightOff) / 2m);
                //MessageBox.Show(LDCheightoff.ToString());
            }

            lsourcedata.EmitterCenter = new UNI11733EmitterEmitterCenter();
            lsourcedata.EmitterCenter.LengthOffset = LDClengthoff;
            lsourcedata.EmitterCenter.WidthOffset  = LDCwidthoff;
            lsourcedata.EmitterCenter.HeightOffset = LDCheightoff;

            xml.Emitter = new[] { lsourcedata };
        }
        private void LoadLdt_Click(object sender, EventArgs e)
        {
            CleanForm();
            Create_UNI11733_Xml.Instance.Init();

            Photometric_management.Instance.SelectPhotometricFile();

            if (Photometric_management.Instance.ldtiesname != "no file selected")
            {
                UuidCreateSequential(out System.Guid guid);
                UUIDContainer.UUIDvalue = guid.ToString();

                LDTtextBox.Text = Photometric_management.Instance.FullFileName;
                //MessageBox.Show(Photometric_management.Instance.FileType);

                String Lampcodestr = "";
                if (Photometric_management.Instance.FileType == "ldt")
                {
                    Parse_LDT ldtparser = new Parse_LDT();

                    ldtparser.ParseLDT();
                    //MessageBox.Show("PARSE LDT Done: ");
                    LabTextBox.Text = "Unknown";
                    Lampcodestr     = "Not applicable";
                }

                if (Photometric_management.Instance.FileType == "ies")
                {
                    IES_Parse iesparser = new IES_Parse();

                    iesparser.ParseIES();
                    //MessageBox.Show("PARSE IES Done: ");
                    LabTextBox.Text = Create_UNI11733_Xml.Instance.MaesureLaboratory;
                    Lampcodestr     = Create_UNI11733_Xml.Instance.LampCatalogNumber; //modified by AW
                }

                // HEADER START
                // MessageBox.Show(Photometric_management.Instance.ldtiesname);

                ManuftextBox.Text         = Create_UNI11733_Xml.Instance.Manufacture;
                CatalogNumbertextBox.Text = Create_UNI11733_Xml.Instance.CatalogNumber;
                GTINtextBox.Text          = "Not assigned";
                ModeltextBox.Text         = Create_UNI11733_Xml.Instance.Model_Description;

                RepNumTextBox.Text           = Create_UNI11733_Xml.Instance.ReportNumber;
                RepDateTextBox.Text          = Create_UNI11733_Xml.Instance.ReportDate;
                DocCreatorTextBox.Text       = "Unknown";
                DocCreateDateTextBox.Text    = Create_UNI11733_Xml.Instance.DocCreateDate.ToString(); //DateTime.Now.ToString();
                UniqueIdentifierTextBox.Text = UUIDContainer.UUIDvalue.ToString();                    // guid.ToString();
                CommentTextBox.Text          = "lorem ipsum";
                ReferenceTextBox.Text        = Create_UNI11733_Xml.Instance.NameInFile;
                MoreInfoURITextBox.Text      = "Unknown";

                // HEADER end

                //Dimensions start
                LengthTextBox.Text = Create_UNI11733_Xml.Instance.Length.ToString();
                WidthTextBox.Text  = Create_UNI11733_Xml.Instance.Width.ToString();
                HeightTextBox.Text = Create_UNI11733_Xml.Instance.Height.ToString();

                ShapeComboBox.Text = Create_UNI11733_Xml.Instance.CircularShape;

                //Dimensions end

                //Emission Areas
                //Bottom Face

                NumBottomTextBox.Text = Create_UNI11733_Xml.Instance.NBtmFace.ToString();
                if (Create_UNI11733_Xml.Instance.NBtmFace == 0)
                {
                    BtmLengthTextBox.Text = "0";
                    BtmWidthTextBox.Text  = "0";
                }
                else
                {
                    BtmLengthTextBox.Text = Create_UNI11733_Xml.Instance.LumLength.ToString();
                    BtmWidthTextBox.Text  = Create_UNI11733_Xml.Instance.LumWidth.ToString();
                }
                BtmLengthOffTextBox.Text = "0";
                BtmWidthOffTextBox.Text  = "0";

                if (Create_UNI11733_Xml.Instance.CircularShapeBtm == true)
                {
                    CircularBtmTextBox.Text = "true";
                }
                else
                {
                    CircularBtmTextBox.Text = "false";
                }

                //Top Face

                NumTopTextBox.Text = Create_UNI11733_Xml.Instance.NTopFace.ToString();
                if (Create_UNI11733_Xml.Instance.NTopFace == 0)
                {
                    TopLengthTextBox.Text = "0";
                    TopWidthTextBox.Text  = "0";
                }
                else
                {
                    TopLengthTextBox.Text = Create_UNI11733_Xml.Instance.LumLength.ToString();
                    TopWidthTextBox.Text  = Create_UNI11733_Xml.Instance.LumWidth.ToString();
                }
                TopLengthOffTextBox.Text = "0";
                TopWidthOffTextBox.Text  = "0";

                if (Create_UNI11733_Xml.Instance.CircularShapeTop == true)
                {
                    CircularTopTextBox.Text = "true";
                }
                else
                {
                    CircularTopTextBox.Text = "false";
                }


                //C-0 Face
                //NumC0TextBox.Text = "1";
                NumC0TextBox.Text = Create_UNI11733_Xml.Instance.NC0Face.ToString();
                if (Create_UNI11733_Xml.Instance.NC0Face == 0)
                {
                    C0HeightTextBox.Text = "0";
                    C0WidthTextBox.Text  = "0";
                }
                else
                {
                    C0HeightTextBox.Text = Create_UNI11733_Xml.Instance.hC0.ToString();
                    C0WidthTextBox.Text  = Create_UNI11733_Xml.Instance.LumLength.ToString();
                }
                C0WidthOffTextBox.Text  = "0";
                C0HeightOffTextBox.Text = "0";

                if (Create_UNI11733_Xml.Instance.CircularShapeC0 == true)
                {
                    CircularC0TextBox.Text = "true";
                }
                else
                {
                    CircularC0TextBox.Text = "false";
                }

                //C-90 Face
                //NumC90TextBox.Text = "1";
                NumC90TextBox.Text = Create_UNI11733_Xml.Instance.NC90Face.ToString();
                if (Create_UNI11733_Xml.Instance.NC90Face == 0)
                {
                    C90HeightTextBox.Text = "0";
                    C90LengthTextBox.Text = "0";
                }
                else
                {
                    C90HeightTextBox.Text = Create_UNI11733_Xml.Instance.hC90.ToString();
                    C90LengthTextBox.Text = Create_UNI11733_Xml.Instance.LumWidth.ToString();
                }
                C90LengthOffTextBox.Text = "0";
                C90HeightOffTextBox.Text = "0";

                if (Create_UNI11733_Xml.Instance.CircularShapeC90 == true)
                {
                    CircularC90TextBox.Text = "true";
                }
                else
                {
                    CircularC90TextBox.Text = "false";
                }

                //C-180 Face
                //NumC180TextBox.Text = "1";
                NumC180TextBox.Text = Create_UNI11733_Xml.Instance.NC180Face.ToString();
                if (Create_UNI11733_Xml.Instance.NC90Face == 0)
                {
                    C180HeightTextBox.Text = "0";
                    C180WidthTextBox.Text  = "0";
                }
                else
                {
                    C180HeightTextBox.Text = Create_UNI11733_Xml.Instance.hC180.ToString();
                    C180WidthTextBox.Text  = Create_UNI11733_Xml.Instance.LumLength.ToString();
                }
                C180WidthOffTextBox.Text  = "0";
                C180HeightOffTextBox.Text = "0";

                if (Create_UNI11733_Xml.Instance.CircularShapeC180 == true)
                {
                    CircularC180TextBox.Text = "true";
                }
                else
                {
                    CircularC180TextBox.Text = "false";
                }

                //C-270 Face
                //NumC270TextBox.Text = "1";
                NumC270TextBox.Text = Create_UNI11733_Xml.Instance.NC270Face.ToString();
                if (Create_UNI11733_Xml.Instance.NC90Face == 0)
                {
                    C270HeightTextBox.Text = "0";
                    C270LengthTextBox.Text = "0";
                }
                else
                {
                    C270HeightTextBox.Text = Create_UNI11733_Xml.Instance.hC270.ToString();
                    C270LengthTextBox.Text = Create_UNI11733_Xml.Instance.LumWidth.ToString();
                }
                C270LengthOffTextBox.Text = "0";
                C270HeightOffTextBox.Text = "0";

                if (Create_UNI11733_Xml.Instance.CircularShapeC270 == true)
                {
                    CircularC270TextBox.Text = "true";
                }
                else
                {
                    CircularC270TextBox.Text = "false";
                }

                // emission areas end

                //emitter center start
                ECLengthTtextBox.Text = "0";
                ECWidthTextBox.Text   = "0";
                ECHeightTextBox.Text  = (-(Create_UNI11733_Xml.Instance.Height / 2m)).ToString();

                //emitter center end


                //----------------------- Image Fields --------------------------------------

                // Luminaire dimeansoins
                HeightTextBox1.Text = HeightTextBox.Text;
                WidthTextBox2.Text  = WidthTextBox.Text;
                LengthTextBox2.Text = LengthTextBox.Text;
                //Bottom Face
                NumBottomTextBox2.Text = NumBottomTextBox.Text;
                BtmLengthTextBox2.Text = BtmLengthTextBox.Text;
                BtmWidthTextBox2.Text  = BtmWidthTextBox.Text;
                //BtmLengthOffTextBox2.Text = BtmLengthOffTextBox.Text;
                //BtmWidthOffTextBox2.Text = BtmWidthOffTextBox.Text;
                //Top Face
                NumTopTextBox2.Text       = NumTopTextBox.Text;
                TopLengthTextBox2.Text    = TopLengthTextBox.Text;
                TopWidthTextBox2.Text     = TopWidthTextBox.Text;
                TopLengthOffTextBox2.Text = TopLengthOffTextBox.Text;
                TopWidthOffTextBox2.Text  = TopWidthOffTextBox.Text;
                //C-0 Face
                NumC0TextBox2.Text    = NumC0TextBox.Text;
                C0HeightTextBox3.Text = C0HeightTextBox.Text;
                C0WidthTextBox2.Text  = C0WidthTextBox.Text;
                //C0WidthOffTextBox2.Text = C0WidthOffTextBox.Text;
                //C0HeightOffTextBox2.Text = C0HeightOffTextBox.Text;
                //C-90 Face
                NumC90TextBox2.Text    = NumC90TextBox.Text;
                C90HeightTextBox2.Text = C90HeightTextBox.Text;
                C90LengthTextBox2.Text = C90LengthTextBox.Text;
                //C90LengthOffTextBox2.Text = C90LengthOffTextBox.Text;
                //C90HeightOffTextBox2.Text = C90HeightOffTextBox.Text;

                //C-180 Face
                NumC180TextBox2.Text    = NumC180TextBox.Text;
                C180HeightTextBox2.Text = C180HeightTextBox.Text;
                C180WidthTextBox2.Text  = C180WidthTextBox.Text;
                //C180HeightOffTextBox2.Text = C180HeightOffTextBox.Text;
                //C180HeightOffTextBox2.Text = C180HeightOffTextBox.Text;
                //C-270 Face
                NumC270TextBox2.Text    = NumC270TextBox.Text;
                C270HeightTextBox2.Text = C270HeightTextBox.Text;
                C270LengthTextBox2.Text = C270LengthTextBox.Text;
                //C270LengthOffTextBox2.Text = C270LengthOffTextBox.Text;
                //C270HeightOffTextBox2.Text = C270HeightOffTextBox.Text;
                // emission areas end
                // -------------------- END IMAGE FIELDS ------------------------------------------------


                //Dimensions end

                NumEmitterTextBox.Text = Create_UNI11733_Xml.Instance.NumberLightSource.ToString();
                //LUMINAIRE end

                //LuminousData start
                //LuminousIntensity start
                QuantityTextBox.Text = Create_UNI11733_Xml.Instance.NumberLightSource.ToString();
                DescTextBox.Text     = Create_UNI11733_Xml.Instance.LampDescription;
                //LampCodeTextBox.Text = "Not applicable";
                LampCodeTextBox.Text     = Lampcodestr; //modified by AW
                RatedLmTextBox.Text      = Create_UNI11733_Xml.Instance.RatedLumen.ToString();
                InputWattageTextBox.Text = Create_UNI11733_Xml.Instance.InputWattage;
                RaTextBox.Text           = Create_UNI11733_Xml.Instance.RaCRI;
                FixedCCTTextBox.Text     = Create_UNI11733_Xml.Instance.FixedCCT;

                ABSPhotomTextBox.Text = Create_UNI11733_Xml.Instance.ABSPhotom.ToString();

                if (Create_UNI11733_Xml.Instance.symm == 0)
                {
                    ASymmTextBox.Text = Create_UNI11733_Xml.Instance.symm.ToString() + " - None";
                }
                else if (Create_UNI11733_Xml.Instance.symm == 1)
                {
                    ASymmTextBox.Text = Create_UNI11733_Xml.Instance.symm.ToString() + " - Symmetric";
                }
                else if (Create_UNI11733_Xml.Instance.symm == 2)
                {
                    ASymmTextBox.Text = Create_UNI11733_Xml.Instance.symm.ToString() + " - Bilateral_X";
                }
                else if (Create_UNI11733_Xml.Instance.symm == 3)
                {
                    ASymmTextBox.Text = Create_UNI11733_Xml.Instance.symm.ToString() + " - Bilateral_Y";
                }
                else if (Create_UNI11733_Xml.Instance.symm == 4)
                {
                    ASymmTextBox.Text = Create_UNI11733_Xml.Instance.symm.ToString() + " - Quadrilateral";
                }
                else
                {
                    ASymmTextBox.Text = Create_UNI11733_Xml.Instance.symm.ToString() + " - None";
                }

                NumMeasuredTextBox.Text = "1";
                NumberHorzTextBox.Text  = Create_UNI11733_Xml.Instance.NumberHorizontal.ToString();
                NumberVertTextBox.Text  = Create_UNI11733_Xml.Instance.NumberVertical.ToString();


                Moreinfouri.MoreInfoURL      = MoreInfoURITextBox.Text;
                DocumentCreator.DocCreator   = DocCreatorTextBox.Text;
                DocumentComments.DocComments = CommentTextBox.Text;
                LampCode.LampCatNumber       = LampCodeTextBox.Text;
                Laboratory.Lab     = LabTextBox.Text;
                GTINnumber.GTINnum = GTINtextBox.Text;

                EmitterBoxLength.EmBoxLength       = LengthTextBox.Text;
                EmitterBoxWidth.EmBoxWidth         = WidthTextBox.Text;
                EmitterBoxHeight.EmBoxHeight       = HeightTextBox.Text;
                EmitterBoxShapeCirc.EmBoxShapeCirc = ShapeComboBox.Text;

                NumEmitterBottomFace.NumEmBtmFace        = NumBottomTextBox.Text;
                EmitterBottomLength.EmBtmLength          = BtmLengthTextBox.Text;
                EmitterBottomWidth.EmBtmWidth            = BtmWidthTextBox.Text;
                EmitterBottomLengthOffset.EmBtmLengthOff = BtmLengthOffTextBox.Text;
                EmitterBottomWidthOffset.EmBtmWidthoff   = BtmWidthOffTextBox.Text;
                EmBtmCirc.EmBtmCircular = CircularBtmTextBox.Text;

                NumEmitterTopFace.NumEmTopFace        = NumTopTextBox.Text;
                EmitterTopLength.EmTopLength          = TopLengthTextBox.Text;
                EmitterTopWidth.EmTopWidth            = TopWidthTextBox.Text;
                EmitterTopLengthOffset.EmTopLengthOff = TopLengthOffTextBox.Text;
                EmitterTopWidthOffset.EmTopWidthoff   = TopWidthOffTextBox.Text;
                EmTopCirc.EmTopCircular = CircularTopTextBox.Text;

                NumEmitterC0Face.NumEmC0Face        = NumC0TextBox.Text;
                EmitterC0Height.EmC0Height          = C0HeightTextBox.Text;
                EmitterC0Width.EmC0Width            = C0WidthTextBox.Text;
                EmitterC0HeightOffset.EmC0HeightOff = C0HeightOffTextBox.Text;
                EmitterC0WidthOffset.EmC0Widthoff   = C0WidthOffTextBox.Text;
                EmC0Circ.EmC0Circular = CircularC0TextBox.Text;

                NumEmitterC180Face.NumEmC180Face        = NumC180TextBox.Text;
                EmitterC180Height.EmC180Height          = C180HeightTextBox.Text;
                EmitterC180Width.EmC180Width            = C180WidthTextBox.Text;
                EmitterC180HeightOffset.EmC180HeightOff = C180HeightOffTextBox.Text;
                EmitterC180WidthOffset.EmC180WidthOff   = C180WidthOffTextBox.Text;
                EmC180Circ.EmC180Circular = CircularC180TextBox.Text;

                NumEmitterC90Face.NumEmC90Face        = NumC90TextBox.Text;
                EmitterC90Height.EmC90Height          = C90HeightTextBox.Text;
                EmitterC90Length.EmC90Length          = C90LengthTextBox.Text;
                EmitterC90HeightOffset.EmC90HeightOff = C90HeightOffTextBox.Text;
                EmitterC90LengthOffset.EmC90LengthOff = C90LengthOffTextBox.Text;
                EmC90Circ.EmC90Circular = CircularC90TextBox.Text;

                NumEmitterC270Face.NumEmC270Face        = NumC270TextBox.Text;
                EmitterC270Height.EmC270Height          = C270HeightTextBox.Text;
                EmitterC270Length.EmC270Length          = C270LengthTextBox.Text;
                EmitterC270HeightOffset.EmC270HeightOff = C270HeightOffTextBox.Text;
                EmitterC270LengthOffset.EmC270LengthOff = C270LengthOffTextBox.Text;
                EmC270Circ.EmC270Circular = CircularC270TextBox.Text;

                ECLengthOffset.ECLengthOff = ECLengthTtextBox.Text;
                ECWidthOffset.ECWidthOff   = ECWidthTextBox.Text;
                ECHeightOffset.ECHeightOff = ECHeightTextBox.Text;
            }
            else
            {
                CleanForm();
            }
        }