Exemplo n.º 1
0
        private void PopulateDryingMaterialList()
        {
            this.listViewMaterials.Items.Clear();
            string typeFilterStr    = this.comboBoxTypes.SelectedItem.ToString();
            string userDefFilterStr = this.comboBoxUserDef.SelectedItem.ToString();

            if (typeFilterStr.Equals(UI.STR_ALL) && userDefFilterStr.Equals(UI.STR_ALL))
            {
                this.PopulateIt(DryingMaterialCatalog.GetInstance().GetDryingMaterialList());
            }
            else if (typeFilterStr.Equals(UI.STR_ALL) && !userDefFilterStr.Equals(UI.STR_ALL))
            {
                bool userDef = UI.GetUserDefinedAsBool(userDefFilterStr);
                this.PopulateIt(DryingMaterialCatalog.GetInstance().GetDryingMaterialList(userDef));
            }
            else if (!typeFilterStr.Equals(UI.STR_ALL) && userDefFilterStr.Equals(UI.STR_ALL))
            {
                MaterialType type = DryingMaterialsControl.GetDryingMaterialTypeAsEnum(typeFilterStr);
                this.PopulateIt(DryingMaterialCatalog.GetInstance().GetDryingMaterialList(type));
            }
            else
            {
                bool         userDef = UI.GetUserDefinedAsBool(userDefFilterStr);
                MaterialType type    = DryingMaterialsControl.GetDryingMaterialTypeAsEnum(typeFilterStr);
                this.PopulateIt(DryingMaterialCatalog.GetInstance().GetDryingMaterialList(userDef, type));
            }
        }
Exemplo n.º 2
0
 private void comboBoxType_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (!this.inConstruction)
     {
         string       matTypeStr  = this.comboBoxType.SelectedItem as string;
         MaterialType matTypeEnum = DryingMaterialsControl.GetDryingMaterialTypeAsEnum(matTypeStr);
         this.dryingMaterialCache.SetMaterialType(matTypeEnum);
     }
 }
Exemplo n.º 3
0
        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;
        }