Exemplo n.º 1
0
        /// <summary>
        /// Set the parameters property from a data table.
        /// </summary>
        /// <param name="data">The data table.</param>
        private void SetParametersFromGrid(DataTable data)
        {
            Parameters = new List <ForageMaterialParameters>();
            foreach (DataRow row in data.Rows)
            {
                var fullName = row[0].ToString();
                if (!string.IsNullOrEmpty(fullName)) // can be empty at bottom of grid because grid.CanGrow=true
                {
                    Parameters?.RemoveAll(p => p.Name.Equals(fullName, StringComparison.InvariantCultureIgnoreCase));
                    var live = new ForageMaterialParameters(this, fullName, live: true, row[1].ToString(), Convert.ToDouble(row[3]), Convert.ToDouble(row[5]));
                    Parameters.Add(live);

                    var dead = new ForageMaterialParameters(this, fullName, live: false, row[2].ToString(), Convert.ToDouble(row[4]), 0.0);
                    Parameters.Add(dead);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="material">Biomass.</param>
 /// <param name="parameters">Parameters.</param>
 public DigestibleBiomass(DamageableBiomass material, ForageMaterialParameters parameters)
 {
     this.material   = material;
     this.parameters = parameters;
 }