private static void ReadPromotableConstants(ModelDraft modelDraft, XElement promotableConstantCollectionElement)
        {
            IEnumerable <XElement> promotableConstantElements = promotableConstantCollectionElement.Descendants(Elements.PromotableConstant);

            foreach (XElement promotableConstantElement in promotableConstantElements)
            {
                TId    id   = TId.Parse(promotableConstantElement.Attribute(Attributes.Id).Value);
                string name = promotableConstantElement.Attribute(Attributes.Name).Value;
                string variableIdentifier = promotableConstantElement.Attribute(Attributes.VariableIdentifier).Value;
                bool   isPromoted         = Convert.ToBoolean(promotableConstantElement.Attribute(Attributes.IsPromoted).Value);
                double value    = ConvertExtensions.ToDoubleInvariant(promotableConstantElement.Attribute(Attributes.Value).Value);
                double minValue = ConvertExtensions.ToDoubleInvariant(promotableConstantElement.Attribute(Attributes.MinValue).Value);
                double maxValue = ConvertExtensions.ToDoubleInvariant(promotableConstantElement.Attribute(Attributes.MaxValue).Value);

                PromotableConstant promotableConstant = new PromotableConstant(id, name, variableIdentifier, value)
                {
                    IsPromoted = isPromoted,
                    MaxValue   = maxValue,
                    MinValue   = minValue
                };

                modelDraft.PromotableConstants.Add(promotableConstant);
            }
        }
示例#2
0
 public void Downgrade(PromotableConstant constant)
 {
     constant.IsPromoted = false;
     IsChanged           = true;
 }
示例#3
0
 public void Promote(PromotableConstant constant)
 {
     constant.IsPromoted = true;
     IsChanged           = true;
 }