示例#1
0
        public static void Load(XmlNode valueDescNode,
                                Dictionary <string, VdfValueDesc> valueDescTable)
        {
            VdfBcdValueDesc valueDesc = VdfValueDesc.Load <VdfBcdValueDesc>(valueDescNode,
                                                                            valueDescTable);

            if (valueDesc == null)
            {
                return;
            }
            valueDescTable.Add(valueDesc.Name, valueDesc);

            int ival;

            if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.FactorAttrName, out ival))
            {
                valueDesc.Factor = ival;
            }
            if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.OffsetAttrName, out ival))
            {
                valueDesc.Offset = ival;
            }

            bool bval;

            if (XmlUtils.TryGetBoolAttrValue(valueDescNode, VdfTag.FillAttrName, out bval))
            {
                valueDesc.Fill = bval;
            }
            if (XmlUtils.TryGetBoolAttrValue(valueDescNode, VdfTag.CanFillAlphaAttrName, out bval))
            {
                valueDesc.CanFillAlpha = bval;
            }

            if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.MaximumAttrName, out ival))
            {
                valueDesc.Maximum = ival;
            }
            if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.MinimumAttrName, out ival))
            {
                valueDesc.Minimum = ival;
            }

            if (XmlUtils.TryGetStringAttrValue(valueDescNode, VdfTag.SeparatorAttrName, out string sval))
            {
                valueDesc.Separator = sval;
            }
        }
示例#2
0
        protected override void UpdateUI()
        {
            base.UpdateUI();

            valDesc = Entity <VdfBcdValueDesc>();
            if (valDesc != null)
            {
                textBoxName.Text = valDesc.Name;
                OldName          = textBoxName.Text;

                checkBoxFill.Checked         = valDesc.Fill;
                checkBoxCanFillAlpha.Checked = valDesc.CanFillAlpha;

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

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

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

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

                if (valDesc.Separator != null)
                {
                    textBoxSeperator.Text = valDesc.Separator.ToString();
                    oldSeperator          = valDesc.Separator;
                }
                else
                {
                    textBoxSeperator.Text = string.Empty;
                    oldSeperator          = string.Empty;
                }

                EnableAllUIByCanFillAlpha(checkBoxCanFillAlpha.Checked);

                textBoxName.Enabled = (valDesc.Owners.Count == 0);
            }
        }