private void newMaterialFamilyMenuItem_Click(object sender, EventArgs e)
        {
            MaterialFamily newMaterialFamily = new MaterialFamily();

            Global.MaterialDatabase.Add(newMaterialFamily);
            InitializeNewNode(newMaterialFamily.Name, newMaterialFamily, treeView.Nodes["Materials"]);
        }
        private void newMaterialVolumeMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView.SelectedNode;

            if (node != null && node.Parent == treeView.Nodes["Materials"])
            {
                MaterialVolume newMaterialVolume = new MaterialVolume();
                MaterialFamily materialFamily    = node.Tag as MaterialFamily;
                newMaterialVolume.Family = materialFamily;
                materialFamily.MaterialInstances.Add(newMaterialVolume);
                InitializeNewNode(newMaterialVolume.Name, newMaterialVolume, node);
            }
        }
        //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();
            }
        }
 private void RefreshMaterialFamilyPanel(MaterialFamily materialFamily)
 {
     tabControl.SelectedTab = tabControl.TabPages[1];
     mf_nameTextBox.Text    = materialFamily.Name;
     mf_densityTextBox.Text = materialFamily.Density.ToString();
 }
Beispiel #5
0
 public MaterialVolume(MaterialFamily family)
 {
     SetToDefault();
     Family = family;
     family.MaterialInstances.Add(this);
 }