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 FormVibro(CPVibro data) : this() { cbSignalLevel.SelectedIndex = data.SignalLevelIndex; 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; tbDistance.Text = data.Distance.ToString(); cbSignalPlace.SelectedIndex = data.SignalPlaceIndex; cbMaterial.SelectedIndex = data.MaterialIndex; 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(); 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(); tbReadability.Text = data.Results.W.ToString(); }
private CPVibro loadVibro(XmlNode cp) { CPVibro vibro = new CPVibro(cp.SelectSingleNode("name").FirstChild.Value); vibro.SignalLevelIndex = getIntValue(cp, "signal_level"); foreach (XmlNode absorber_node in cp.SelectNodes("absorbers/*")) { CPOutside.Reflector absorber = new CPOutside.Reflector(); absorber.square = getDoubleValue(absorber_node, "square"); absorber.MaterialIndex = getIntValue(absorber_node, "ratio"); vibro.absorbersList.Add(absorber); } foreach (XmlNode consumer_node in cp.SelectNodes("consumers/*")) { int consumer; consumer = Int32.Parse(consumer_node.FirstChild.Value); vibro.consumersList.Add(consumer); } vibro.Volume = getDoubleValue(cp, "volume"); vibro.RoomTypeIndex = getIntValue(cp, "room_type"); vibro.Distance = getDoubleValue(cp, "distance"); vibro.MaterialIndex = getIntValue(cp, "material"); vibro.SignalPlaceIndex = getIntValue(cp, "signal_place"); vibro.Results = ResearchResults.FromXml(cp.SelectSingleNode("results")); return vibro; }
private void getDataFromVibro(CPVibro cp, FormVibro outside) { cp.SignalLevelIndex = outside.SignalLevel; cp.absorbersList = outside.Absorbers; cp.consumersList = outside.Consumers; cp.Volume = outside.Volume; cp.RoomTypeIndex = outside.RoomType; cp.Distance = outside.Distance; cp.MaterialIndex = outside.Material; cp.SignalPlaceIndex = outside.SignalPlace; cp.Results = outside.Result; }