private void btnAddAcousticKT_Click(object sender, EventArgs e)
        {
            FormAddAcoustickKT form = new FormAddAcoustickKT();
            DialogResult res = form.ShowDialog();
            if (res == System.Windows.Forms.DialogResult.OK)
            {
                //lstAcousticList.Items.Add(form.KTName);
                switch (form.Type)
                {
                    case KTType.Outside:
                        Outside outside = new Outside();
                        outside.ShowDialog();
                        CPOutside cp = new CPOutside(form.KTName);
                        getDataFromOutside(cp, outside);

                        currentResearch.CheckPoints.Add(cp);
                        researchUpdated();
                        break;
                    case KTType.Neighbor:

                        FormNeigborRooms neighbor = new FormNeigborRooms();
                        neighbor.ShowDialog();
                        CPNeighbor cpn = new CPNeighbor(form.KTName);

                        getDataFromNeighbor(cpn, neighbor);
                        currentResearch.CheckPoints.Add(cpn);
                        researchUpdated();
                        break;
                    case KTType.Vent:
                        FormVent vent = new FormVent();
                        vent.ShowDialog();
                        CPVent cpVent = new CPVent(form.KTName);
                        getDataFromVent(cpVent, vent);
                        currentResearch.CheckPoints.Add(cpVent);
                        researchUpdated();
                        break;
                    case KTType.Vibro:
                        FormVibro vibro = new FormVibro();
                        vibro.ShowDialog();
                        CPVibro cpVibro = new CPVibro(form.KTName);
                        getDataFromVibro(cpVibro, vibro);
                        currentResearch.CheckPoints.Add(cpVibro);
                        researchUpdated();
                        break;
                }
            }
        }
 public FormAddSegment(FormVent.Sector sector)
     : this()
 {
     Type type = sector.GetType();
     if (type == Type.GetType("Diplom.FormVent+SectorMetal"))
     {
         AddSegment((FormVent.SectorMetal)sector);
     }
     else if (type == Type.GetType("Diplom.FormVent+SectorBeton"))
     {
         AddSegment((FormVent.SectorBeton)sector);
     }
     else if (type == Type.GetType("Diplom.FormVent+SectorExtension"))
     {
         AddSegment((FormVent.SectorExtension)sector);
     }
     else if (type == Type.GetType("Diplom.FormVent+SectorTurn"))
     {
         AddSegment((FormVent.SectorTurn)sector);
     }
 }
        private void lstAcousticList_DoubleClick(object sender, EventArgs e)
        {
            if (lstAcousticList.SelectedIndex == -1)
                return;
            Type type = currentResearch.CheckPoints[lstAcousticList.SelectedIndex].GetType();
            if (type == Type.GetType("Diplom.Data.CPOutside"))
            {
                CPOutside cp = (CPOutside)currentResearch.CheckPoints[lstAcousticList.SelectedIndex];
                Outside outside = new Outside(cp);
                outside.ShowDialog();
                getDataFromOutside(cp, outside);
            }
            else if (type == Type.GetType("Diplom.Data.CPVibro"))
            {
                CPVibro cp = (CPVibro)currentResearch.CheckPoints[lstAcousticList.SelectedIndex];
                FormVibro outside = new FormVibro(cp);
                outside.ShowDialog();

                getDataFromVibro(cp, outside);
            }
            else if (type == Type.GetType("Diplom.Data.CPVent"))
            {
                CPVent cp = (CPVent)currentResearch.CheckPoints[lstAcousticList.SelectedIndex];
                FormVent vent = new FormVent(cp);
                vent.ShowDialog();

                getDataFromVent(cp, vent);
            }
            else if (type == Type.GetType("Diplom.Data.CPNeighbor"))
            {
                CPNeighbor cp = (CPNeighbor)currentResearch.CheckPoints[lstAcousticList.SelectedIndex];
                FormNeigborRooms outside = new FormNeigborRooms(cp);
                outside.ShowDialog();

                getDataFromNeighbor(cp, outside);
            }
        }
        private void getDataFromVent(CPVent cp, FormVent outside)
        {
            cp.SignalLevelIndex = outside.SignalLevel;
            cp.NoiseTypeIndex = outside.NoiseType;
            cp.Volume = outside.Volume;
            cp.RoomTypeIndex = outside.RoomType;
            cp.NoiseReduction = outside.NoiseReduction;

            cp.SignalPlace = outside.SignalPlace;
            cp.Distance = outside.Distance;

            cp.absorbersList = outside.Absorbers;
            cp.consumersList = outside.Consumers;

            cp.Results = outside.Result;
            cp.Sectors = outside.Sectors;
        }
        public void AddSegment(FormVent.SectorTurn sector)
        {
            rbTurn.Checked = true;

            panelStraight.Visible = false;
            panelTurn.Visible = true;
            panelExtention.Visible = false;

            cbTurnAngleAndSize.SelectedIndex = sector.AngleIndex;
        }
        public void AddSegment(FormVent.SectorExtension sector)
        {
            rbExtension.Checked = true;

            panelStraight.Visible = false;
            panelTurn.Visible = false;
            panelExtention.Visible = true;

            tbSquareBeforeExt.Text = sector.SquareBefore.ToString();
            tbSquareAfterExt.Text = sector.SquareAfter.ToString();
        }
        public void AddSegment(FormVent.SectorBeton sector)
        {
            rbStraight.Checked = true;

            panelStraight.Visible = true;
            panelTurn.Visible = false;
            panelExtention.Visible = false;

            cbStreightMaterial.SelectedIndex = 0;

            tbSegmentLength.Text = sector.Length.ToString();
            tbSectorSquare.Text = sector.Square.ToString();
            tbSectorPerimetr.Text = sector.Perimetr.ToString();
            cbFadeRatio.SelectedIndex = sector.RatioIndex;
        }
        public void AddSegment(FormVent.SectorMetal sector)
        {
            rbStraight.Checked = true;

            panelStraight.Visible = true;
            panelTurn.Visible = false;
            panelExtention.Visible = false;

            cbStreightMaterial.SelectedIndex = 1;

            tbSegmentLength.Text = sector.Length.ToString();
            cbSignalFading.SelectedIndex = sector.FadingIndex;
        }