Esempio n. 1
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(2, ElementPropertyDialog.INST_ATCH);
         *  dialog.ShowLine3("EVENT:", IDValue);
         *  dialog.ShowLine5("FUNC:");
         *  dialog.ValueString5 = FuncName;
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = IDValue.ValueString;
            var  oldvaluestring2 = FuncName;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });
            bool check2 = true;

            if (check1)
            {
                IDValue = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                int id = int.Parse(IDValue.GetValue());
                if (id < 0 || id > 7)
                {
                    throw new ValueParseException("ID超出范围(0-7)");
                }
            }
            if (check1 && check2)
            {
                FuncName = valueStrings[2];
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, IDValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, FuncName);
                //ValueCommentManager.UpdateComment(InputValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(IDValue, valueStrings[1]);
            }
            else if (!check2)
            {
                throw new ValueParseException(String.Format("找不到函数{0:s}", valueStrings[2]));
            }
            else if (!check1)
            {
                throw new ValueParseException("EVENT格式非法!");
            }
        }
Esempio n. 2
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(1);
         *  //dialog.ShowLine3("FUNC:", FuncName);
         *  dialog.ShowLine4("EVENT:", IDValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = IDValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });

            if (check1)
            {
                IDValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                int id = int.Parse(IDValue.GetValue());
                if (id < 0 || id > 7)
                {
                    throw new ValueParseException("EV超出范围(0-7)");
                }
            }
            else
            {
                throw new ValueParseException("EV格式非法!");
            }
        }