public void SetDryingMaterial(DryingMaterialCache dryingMaterialCache, INumericFormat iNumericFormat) { this.textBoxDMName.Text = dryingMaterialCache.Name; this.textBoxUserDef.Text = UI.GetBoolAsYesNo(dryingMaterialCache.IsUserDefined); this.textBoxMaterialType.Text = DryingMaterialsControl.GetDryingMaterialTypeAsString(dryingMaterialCache.MaterialType); this.textBoxMoisture.Text = dryingMaterialCache.MoistureSubstance.ToString(); this.SetMaterialComponents(dryingMaterialCache, iNumericFormat); this.readOnlyDuhringLinesControl.SetDuhringLinesCache(dryingMaterialCache, iNumericFormat); if (dryingMaterialCache.GetDuhringLinesCache() == null) { this.HideDuhringLinesUI(); } }
private void PopulateIt(IList list) { IEnumerator en = list.GetEnumerator(); while (en.MoveNext()) { DryingMaterial dm = (DryingMaterial)en.Current; ListViewItem lvi = new ListViewItem(); ListViewItem.ListViewSubItem lvsi = new ListViewItem.ListViewSubItem(lvi, dm.Name); lvi.SubItems.Insert(0, lvsi); string userDefStr = UI.GetBoolAsYesNo(dm.IsUserDefined); lvsi = new ListViewItem.ListViewSubItem(lvi, userDefStr); lvi.SubItems.Insert(1, lvsi); string typeStr = DryingMaterialsControl.GetDryingMaterialTypeAsString(dm.MaterialType); lvsi = new ListViewItem.ListViewSubItem(lvi, typeStr); lvi.SubItems.Insert(2, lvsi); this.listViewMaterials.Items.Add(lvi); } }
public AddOrEditDryingMaterialForm(DryingMaterial dryingMaterial, INumericFormat numericFormat) { // // Required for Windows Form Designer support // InitializeComponent(); this.inConstruction = true; this.iNumericFormat = numericFormat; // populate the moisture substance combobox IEnumerator en = SubstanceCatalog.GetInstance().GetMoistureSubstanceList().GetEnumerator(); while (en.MoveNext()) { Substance substance = (Substance)en.Current; this.comboBoxMoistureSubstance.Items.Add(substance); } this.comboBoxMoistureSubstance.SelectedIndex = 0; if (dryingMaterial == null) { // new this.isNew = true; this.Text = "New Drying Material"; this.dryingMaterialCache = new DryingMaterialCache(DryingMaterialCatalog.GetInstance()); this.textBoxName.Text = "New Drying Material"; // populate the material type combobox this.comboBoxType.Items.Add(DryingMaterialsControl.STR_MAT_TYPE_GENERIC_MATERIAL); this.comboBoxType.Items.Add(DryingMaterialsControl.STR_MAT_TYPE_GENERIC_FOOD); // this.comboBoxType.Items.Add(DryingMaterialsControl.STR_MAT_TYPE_SPECIAL_FOOD); this.comboBoxType.SelectedIndex = 0; string matTypeStr = this.comboBoxType.SelectedItem as string; MaterialType matTypeEnum = DryingMaterialsControl.GetDryingMaterialTypeAsEnum(matTypeStr); this.dryingMaterialCache.SetMaterialType(matTypeEnum); Substance subst = this.comboBoxMoistureSubstance.SelectedItem as Substance; this.dryingMaterialCache.MoistureSubstance = subst; } else { // edit this.isNew = false; this.Text = "Edit Drying Material"; this.dryingMaterialCache = new DryingMaterialCache(dryingMaterial, DryingMaterialCatalog.GetInstance()); this.textBoxName.Text = this.dryingMaterialCache.Name; // populate the material type combobox this.comboBoxType.Items.Add(DryingMaterialsControl.GetDryingMaterialTypeAsString(this.dryingMaterialCache.MaterialType)); this.comboBoxType.SelectedIndex = 0; this.comboBoxMoistureSubstance.SelectedItem = this.dryingMaterialCache.MoistureSubstance; } this.labelSpecificHeat.InitializeVariable(this.dryingMaterialCache.SpecificHeatOfAbsoluteDryMaterial); this.textBoxSpecificHeat.InitializeVariable(numericFormat, this.dryingMaterialCache.SpecificHeatOfAbsoluteDryMaterial); this.substancesControl.SubstancesToShow = SubstancesToShow.Material; this.dmComponentsControl.SetMaterialComponents(this.dryingMaterialCache, numericFormat); this.UpdateTheUI(this.dryingMaterialCache.MaterialType); this.dryingMaterialCache.MaterialTypeChanged += new MaterialTypeChangedEventHandler(dryingMaterialCache_MaterialTypeChanged); this.dryingMaterialCache.MoistureSubstanceChanged += new MoistureSubstanceChangedEventHandler(dryingMaterialCache_MoistureSubstanceChanged); this.substancesControl.ListViewSubstances.SelectedIndexChanged += new EventHandler(ListViewSubstances_SelectedIndexChanged); this.inConstruction = false; }