private void btnDelete_Click(object sender, EventArgs e) { GEMSMaterial selectedMaterial = GetSelectedMaterial(); if (selectedMaterial == null) { return; } if (selectedMaterial.Status != GEMSMaterial.MaterialStatus.Unused && selectedMaterial != single.SingleMaterial) { MessageBox.Show("This materil is used by other singles!"); } else { currentMaterialList.Remove(selectedMaterial); if (selectedMaterial == single.SingleMaterial) { single.SingleMaterial = null; } } //Refresh the DataGridView control this.geometryMaterialListBindingSource.ResetBindings(false); }
private void btnAdd_Click(object sender, EventArgs e) { //Create a new material GEMSMaterial newMaterial = single.Parent.CreateNewMaterial(); //Show the edit form MaterialDetailsForm mdf = new MaterialDetailsForm(newMaterial); if (mdf.ShowDialog() == DialogResult.OK) { //Add this new material into the list of current project currentMaterialList.Add(newMaterial); //Refresh the DataGridView control this.geometryMaterialListBindingSource.ResetBindings(false); } }
private void btnEdit_Click(object sender, EventArgs e) { GEMSMaterial selectedMaterial = GetSelectedMaterial(); if (selectedMaterial == null) { return; } //Show the edit form MaterialDetailsForm mdf = new MaterialDetailsForm(selectedMaterial); if (mdf.ShowDialog() == DialogResult.OK) { //Refresh the DataGridView control this.geometryMaterialListBindingSource.ResetBindings(false); } }
private void btnOk_Click(object sender, EventArgs e) { GEMSMaterial selectedMaterial = GetSelectedMaterial(); if (selectedMaterial == null) { return; } //Save the current material list to project single.Parent.Materials = currentMaterialList; single.Parent.IsUpdated = true; ////Set the selected material to the currentMaterial single.SingleMaterial = selectedMaterial; this.DialogResult = DialogResult.OK; this.Close(); }
public MaterialDetailsForm(GEMSMaterial currentMaterial) { InitializeComponent(); this.currentMaterial = currentMaterial; }