protected override void UpdateUI()
        {
            base.UpdateUI();

            VdfPhyValueDesc valDesc = Entity <VdfPhyValueDesc>();

            if (valDesc != null)
            {
                textBoxName.Text = valDesc.Name;
                OldName          = valDesc.Name;

                textBoxFactor.Text = valDesc.Factor.ToString();
                oldFactor          = valDesc.Factor;

                textBoxOffset.Text = valDesc.Offset.ToString();
                oldOffset          = valDesc.Offset;

                textBoxUnit.Text = valDesc.Unit;
                oldUnit          = valDesc.Unit;

                textBoxMaxValue.Text = valDesc.Maximum.ToString();
                oldMaxValue          = valDesc.Maximum;

                textBoxMinValue.Text = valDesc.Minimum.ToString();
                oldMinValue          = valDesc.Minimum;

                textBoxName.Enabled = (valDesc.Owners.Count == 0);
            }
        }
Exemple #2
0
        public static void Load(XmlNode valueDescNode,
                                Dictionary <string, VdfValueDesc> valueDescTable)
        {
            VdfPhyValueDesc valueDesc = VdfValueDesc.Load <VdfPhyValueDesc>(valueDescNode,
                                                                            valueDescTable);

            if (valueDesc == null)
            {
                return;
            }

            double dval;

            if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.FactorAttrName, out dval))
            {
                valueDesc.Factor = dval;
            }

            if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.OffsetAttrName, out dval))
            {
                valueDesc.Offset = dval;
            }

            if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.MaximumAttrName, out dval))
            {
                valueDesc.Maximum = dval;
            }

            if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.MinimumAttrName, out dval))
            {
                valueDesc.Minimum = dval;
            }

            string sval;

            if (XmlUtils.TryGetStringAttrValue(valueDescNode, VdfTag.UnitAttrName, out sval))
            {
                valueDesc.Unit = sval;
            }

            valueDescTable.Add(valueDesc.Name, valueDesc);
        }