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 FormVent(CPVent data) : this() { cbSignalLevel.SelectedIndex = data.SignalLevelIndex; cbNoiseType.SelectedIndex = data.NoiseTypeIndex; tbDistance.Text = data.Distance.ToString(); cbSignalPlace.SelectedIndex = data.SignalPlace; tbAbsorbersNumber.Text = data.absorbersList.Count.ToString(); dgvAbsorber.Rows.Clear(); foreach (CPOutside.Reflector r in data.absorbersList) { int new_row = dgvAbsorber.Rows.Add(); dgvAbsorber.Rows[new_row].Cells[0].Value = r.square.ToString(); dgvAbsorber.Rows[new_row].Cells[1].Value = ((DataGridViewComboBoxCell)dgvAbsorber.Rows[new_row].Cells[1]).Items[r.MaterialIndex]; } tbConsumersNumber.Text = data.consumersList.Count.ToString(); dgvConsumers.Rows.Clear(); foreach (int index in data.consumersList) { int new_row = dgvConsumers.Rows.Add(); dgvConsumers.Rows[new_row].Cells[0].Value = ((DataGridViewComboBoxCell)dgvConsumers.Rows[new_row].Cells[0]).Items[index]; } tbNeighborVolume.Text = data.Volume.ToString(); cbRoomType.SelectedIndex = data.RoomTypeIndex; switch (data.NoiseReduction) { case 0: rbNone.Checked = true; break; case 1: rbStrongNoiseReduction.Checked = true; break; case 2: rbWeakNoiseReduction.Checked = true; break; } foreach (Sector s in data.Sectors) { lstSegments.Items.Add(s); } tbSoundprofLevel125.Text = data.Results.SoundproofLefel[0].ToString(); tbSoundprofLevel250.Text = data.Results.SoundproofLefel[1].ToString(); tbSoundprofLevel500.Text = data.Results.SoundproofLefel[2].ToString(); tbSoundprofLevel1000.Text = data.Results.SoundproofLefel[3].ToString(); tbSoundprofLevel2000.Text = data.Results.SoundproofLefel[4].ToString(); tbSoundprofLevel4000.Text = data.Results.SoundproofLefel[5].ToString(); tbSoundprofLevel8000.Text = data.Results.SoundproofLefel[6].ToString(); tbRatio125.Text = data.Results.Ratio[0].ToString(); tbRatio250.Text = data.Results.Ratio[1].ToString(); tbRatio500.Text = data.Results.Ratio[2].ToString(); tbRatio1000.Text = data.Results.Ratio[3].ToString(); tbRatio2000.Text = data.Results.Ratio[4].ToString(); tbRatio4000.Text = data.Results.Ratio[5].ToString(); tbRatio8000.Text = data.Results.Ratio[6].ToString(); tbReadability.Text = data.Results.W.ToString(); }
private CPVent loadVent(XmlNode cp) { CPVent vent = new CPVent(cp.SelectSingleNode("name").FirstChild.Value); vent.SignalLevelIndex = Int32.Parse(cp.SelectSingleNode("signal_level").FirstChild.Value); vent.NoiseTypeIndex = Int32.Parse(cp.SelectSingleNode("noise_type").FirstChild.Value); vent.Distance = getDoubleValue(cp, "distance"); vent.SignalPlace = getIntValue(cp, "signal_place"); foreach (XmlNode absorber_node in cp.SelectNodes("absorbers/*")) { CPOutside.Reflector absorber = new CPOutside.Reflector(); absorber.square = Double.Parse(absorber_node.SelectSingleNode("square").FirstChild.Value); absorber.MaterialIndex = Int32.Parse(absorber_node.SelectSingleNode("ratio").FirstChild.Value); vent.absorbersList.Add(absorber); } foreach (XmlNode consumer_node in cp.SelectNodes("consumers/*")) { int consumer; consumer = Int32.Parse(consumer_node.FirstChild.Value); vent.consumersList.Add(consumer); } vent.Volume = getDoubleValue(cp, "volume"); vent.RoomTypeIndex = getIntValue(cp, "room_type"); vent.NoiseReduction = getIntValue(cp, "noise_reduction"); foreach (XmlNode sector_node in cp.SelectNodes("sectors/*")) { switch(sector_node.Name) { case "beton": FormVent.SectorBeton beton = new FormVent.SectorBeton(); beton.Length = getDoubleValue(sector_node, "length"); beton.Perimetr = getDoubleValue(sector_node, "perimetr"); beton.Square = getDoubleValue(sector_node, "square"); beton.RatioIndex = getIntValue(sector_node, "ratio"); vent.Sectors.Add(beton); break; case "metal": FormVent.SectorMetal metal = new FormVent.SectorMetal(); metal.Length = getDoubleValue(sector_node, "length"); metal.FadingIndex = getIntValue(sector_node, "fading"); vent.Sectors.Add(metal); break; case "turn": FormVent.SectorTurn turn = new FormVent.SectorTurn(); turn.AngleIndex = getIntValue(sector_node, "angle"); vent.Sectors.Add(turn); break; case "extension": FormVent.SectorExtension extension = new FormVent.SectorExtension(); extension.SquareBefore = getDoubleValue(sector_node, "square_before"); extension.SquareAfter = getDoubleValue(sector_node, "square_after"); vent.Sectors.Add(extension); break; } // } vent.Results = ResearchResults.FromXml(cp.SelectSingleNode("results")); return vent; }
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; }