public void Check(CodeGeneratorContext context, Guid ParentID)
        {
            if (EEPStore)
            {
                context.RegiterEEPVariable(_MinEAddr, string.Format("{0:N}_{1}_MIN", ParentID, _Channel));
                context.RegiterEEPVariable(_CenterEAddr, string.Format("{0:N}_{1}_CEN", ParentID, _Channel));
                context.RegiterEEPVariable(_MaxEAddr, string.Format("{0:N}_{1}_MAX", ParentID, _Channel));

                if (!ValidateControl(tbName, () => ValidateName(tbName.Text)))
                {
                    throw new CompilationCheckException("Varialble value is not valid", CompilationCheckException.CompileIteration.PreCheck);
                }
            }

            if (!ValidateControl(tbMin, () => ValidateAxis(tbMin.Text)))
            {
                throw new CompilationCheckException("Wrong minimum axis value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbMiddle, () => ValidateAxis(tbMiddle.Text)))
            {
                throw new CompilationCheckException("Wrong center axis value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbMax, () => ValidateAxis(tbMax.Text)))
            {
                throw new CompilationCheckException("Wrong max axis value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (lnkIn.LinkedTo == null)
            {
                throw new CompilationCheckException("Input axis is not linked", CompilationCheckException.CompileIteration.PreCheck);
            }
        }
        public override void Check(CodeGeneratorContext context)
        {
            if (!ValidateControl(tbInitVal, () => ValidateInt(tbInitVal.Text)))
            {
                throw new CompilationCheckException("Wrong init value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbStep, () => ValidateInt(tbStep.Text)))
            {
                throw new CompilationCheckException("Wrong step value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbCName, () => string.IsNullOrWhiteSpace(tbCName.Text) || ValidateCName(tbCName.Text)))
            {
                throw new CompilationCheckException("Wrong LCD text header", CompilationCheckException.CompileIteration.PreCheck);
            }

            context.RegiterEEPVariable(_Addr, ID.ToString("N"));

            if (lnkAxis.LinkedTo == null)
            {
                throw new CompilationCheckException("Input axis is not linked for the trimmer modifier",
                                                    CompilationCheckException.CompileIteration.PreCheck);
            }

            if (lnkInc.LinkedTo == null)
            {
                throw new CompilationCheckException("Increment click is not defined", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (lnkDec.LinkedTo == null)
            {
                throw new CompilationCheckException("Decrement click is not defined", CompilationCheckException.CompileIteration.PreCheck);
            }
        }
Exemplo n.º 3
0
        public override void Check(CodeGeneratorContext context)
        {
            if (!ValidateControl(tbInitVal, () => ValidateInt(tbInitVal.Text)))
            {
                throw new CompilationCheckException("Wrong init value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbStep, () => ValidateInt(tbStep.Text)))
            {
                throw new CompilationCheckException("Wrong step value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbInitVal, () =>
            {
                int dummy;
                return
                (int.TryParse(tbAddr.Text, out dummy) && dummy > 0 && (dummy % 2 == 0));
            }))
            {
                throw new CompilationCheckException("Wrong eeprom address value", CompilationCheckException.CompileIteration.PreCheck);
            }

            context.RegiterEEPVariable(uint.Parse(tbAddr.Text), ID.ToString("N"));

            if (lnkInc.LinkedTo == null)
            {
                throw new CompilationCheckException("Increment click is not defined", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (lnkDec.LinkedTo == null)
            {
                throw new CompilationCheckException("Decrement click is not defined", CompilationCheckException.CompileIteration.PreCheck);
            }
        }
Exemplo n.º 4
0
        public override void Check(CodeGeneratorContext context)
        {
            if (!ValidateControl(tbValue, () => ValidateInt(tbValue.Text)))
            {
                throw new CompilationCheckException("Wrong value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbMin, () => ValidateInt(tbMin.Text)))
            {
                throw new CompilationCheckException("Wrong min value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbMax, () => ValidateInt(tbMax.Text)))
            {
                throw new CompilationCheckException("Wrong max value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbChangeStep, () => ValidateInt(tbChangeStep.Text) && (int.Parse(tbChangeStep.Text) != 0)))
            {
                throw new CompilationCheckException("Wrong inc/dec step", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbName, () => ValidateCName(tbName.Text)))
            {
                throw new CompilationCheckException("Wrong or empy constant name", CompilationCheckException.CompileIteration.PreCheck);
            }

            context.RegiterEEPVariable(_Addr, ID.ToString("N"));
        }
Exemplo n.º 5
0
        public override void Check(CodeGeneratorContext context)
        {
            if (!ValidateControl(tbValue, () => ValidateInt(tbValue.Text)))
            {
                throw new CompilationCheckException("Wrong value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbMin, () => ValidateInt(tbMin.Text)))
            {
                throw new CompilationCheckException("Wrong min value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (!ValidateControl(tbMax, () => ValidateInt(tbMax.Text)))
            {
                throw new CompilationCheckException("Wrong max value", CompilationCheckException.CompileIteration.PreCheck);
            }

            if (_UseFRAM)
            {
                context.RegiterEEPVariable(_Addr, ID.ToString("N"));
            }
        }