private void newUnitEmergyValueMenuItem_Click(object sender, EventArgs e) { UEV newUEV = new UEV(); Global.UEVDatabase.Add(newUEV); InitializeNewNode(newUEV.Name, newUEV, treeView.Nodes["Unit Emergy Values"]); }
private void RefreshUEVPanel(UEV UEV) { tabControl.SelectedTab = tabControl.TabPages[3]; uev_nameTextBox.Text = UEV.Name; uev_valueTextBox.Text = UEV.Value.ToString("0.0##E+00"); uev_unitsComboBox.SelectedIndex = (int)UEV.Unit; uev_gebTextBox.Text = UEV.GeobiosphereEmergyBaseline.ToString("0.0##E+00"); uev_referenceTextBox.Text = UEV.Reference; }
//TODO: Potentially clean up + Add ratio textbox for material instances private void UpdateSelectedTagProperties() { TreeNode node = treeView.SelectedNode; if (node != null && node.Tag != null) { Type T = node.Tag.GetType(); if (T == typeof(MaterialFamily)) { MaterialFamily materialFamily = node.Tag as MaterialFamily; materialFamily.Name = mf_nameTextBox.Text; node.Text = mf_nameTextBox.Text; node.Name = mf_nameTextBox.Text; double density = materialFamily.Density; ParseTextBoxNumber(mf_densityTextBox, ref density); materialFamily.Density = density; } else if (node.Tag is IMaterialInstance) { IMaterialInstance materialInstance = node.Tag as IMaterialInstance; materialInstance.Name = mi_nameTextBox.Text; node.Text = mi_nameTextBox.Text; node.Name = mi_nameTextBox.Text; if (T == typeof(MaterialSurface)) { MaterialSurface materialSurface = materialInstance as MaterialSurface; double thickness = materialSurface.Thickness; ParseTextBoxNumber(mi_thicknessTextBox, ref thickness); materialSurface.Thickness = thickness; } } else if (T == typeof(UEV)) { UEV UEV = node.Tag as UEV; UEV.Name = uev_nameTextBox.Text; node.Text = uev_nameTextBox.Text; node.Name = uev_nameTextBox.Text; double value = UEV.Value; ParseTextBoxNumber(uev_valueTextBox, ref value); UEV.Value = value; UEV.Unit = (Units)Enum.Parse(typeof(Units), uev_unitsComboBox.Text); //TODO: Check and potentially make cleaner double geb = UEV.GeobiosphereEmergyBaseline; ParseTextBoxNumber(uev_gebTextBox, ref geb); UEV.GeobiosphereEmergyBaseline = geb; UEV.Reference = uev_referenceTextBox.Text; } treeView.Sort(); } }