private void quantity_ConfValueChanged(object sender, EventArgs e)
 {
     if (_errorLimit == null)
     {
         _errorLimit = new ErrorLimit();
     }
     _errorLimit.Confidence = edtConfidence.Quantity;
     edtErrorLimit.Text     = _errorLimit.ToString();
 }
 private void quantity_ResValueChanged(object sender, EventArgs e)
 {
     if (_errorLimit == null)
     {
         _errorLimit = new ErrorLimit();
     }
     _errorLimit.Resolution = edtResolution.Quantity;
     edtErrorLimit.Text     = _errorLimit.ToString();
 }
 private void quantity_ULValueChanged(object sender, EventArgs e)
 {
     if (_errorLimit == null)
     {
         _errorLimit = new ErrorLimit();
     }
     _errorLimit.PlusQuantity = edtULValue.Quantity;
     edtErrorLimit.Text       = _errorLimit.ToString();
 }
 protected void ControlsToData()
 {
     if (_errorLimit == null)
     {
         _errorLimit = new ErrorLimit();
     }
     _errorLimit.MinusQuantity = edtLLValue.Quantity;
     _errorLimit.PlusQuantity  = edtULValue.Quantity;
     _errorLimit.Confidence    = edtConfidence.Quantity;
     _errorLimit.Resolution    = edtResolution.Quantity;
     edtErrorLimit.Text        = _errorLimit.ToString();
 }
Exemple #5
0
        private void btnLimit_Click(object sender, EventArgs e)
        {
            PhysicalTypeErrorLimitForm form = new PhysicalTypeErrorLimitForm();

            if (_rangingInformation != null)
            {
                form.ErrorLimit = _rangingInformation.ErrorLimit;
            }
            if (DialogResult.OK == form.ShowDialog())
            {
                ErrorLimit limit = form.ErrorLimit;
                edtErrorLimit.Text = limit.ToString();
                edtErrorLimit.Tag  = limit;
            }
        }
Exemple #6
0
        private static void SetRowData(DataGridViewRow row, ErrorLimit errorLimit)
        {
            int idx = 0;

            row.Tag = errorLimit;
            row.Cells[idx + 1].Value = Quantity.MINUS;
            if (errorLimit.MinusQuantity != null)
            {
                row.Cells[idx + 2].Value = Math.Abs(errorLimit.MinusQuantity.Value);
                if (errorLimit.MinusQuantity.Unit.HasPrefix())
                {
                    row.Cells[idx + 3].Value = errorLimit.MinusQuantity.Unit.Prefix;
                }
                if (errorLimit.MinusQuantity.Unit.HasUnit())
                {
                    row.Cells[idx + 4].Value = errorLimit.MinusQuantity.Unit.Unit;
                }
            }
            if (errorLimit.PlusQuantity != null)
            {
                row.Cells[idx + 5].Value = Quantity.PLUS;
                row.Cells[idx + 6].Value = Math.Abs(errorLimit.PlusQuantity.Value);
                if (errorLimit.PlusQuantity.Unit.HasPrefix())
                {
                    row.Cells[idx + 7].Value = errorLimit.PlusQuantity.Unit.Prefix;
                }
                if (errorLimit.PlusQuantity.Unit.HasUnit())
                {
                    row.Cells[idx + 8].Value = errorLimit.PlusQuantity.Unit.Unit;
                }
            }

            if (errorLimit.Confidence != null)
            {
                row.Cells[idx + 9].Value = errorLimit.Confidence.Value;
            }

            if (errorLimit.Resolution != null)
            {
                row.Cells[idx + 10].Value = errorLimit.Resolution.Value;
                row.Cells[idx + 11].Value = errorLimit.Resolution.Unit.Prefix;
                row.Cells[idx + 12].Value = errorLimit.Resolution.Unit.Unit;
            }
        }
Exemple #7
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string input1 = edtQuickEntry.Text;
            string input2 = null;
            int    idx    = input1.IndexOf(" to ", System.StringComparison.Ordinal);

            if (idx != -1)
            {
                input2 = input1.Substring(idx + " to ".Length);
                input1 = input1.Substring(0, idx);
            }

            bool         useLimitPair = false;
            List <Value> values1      = ElectricalUtils.ParseExpression(input1);
            List <Value> values2      = null;

            if (input2 != null)
            {
                values2      = ElectricalUtils.ParseExpression(input2);
                useLimitPair = true;
            }

            if (values1.Count > 0)
            {
                Value      value1      = values1[0];
                ErrorLimit errorLimit1 = value1.errorLimit;
                Value      resolution1 = value1.resoluion;
                string     unit1       = value1.unit;
                string     val1        = value1.value;
                @double    datum1      = value1.@double;
                _limit = new Limit();
                if (!useLimitPair)
                {
                    cmbLimitType.SelectedIndex = LIMIT_EXPECTED;
                    var le = new LimitExpected {
                        Item = datum1
                    };
                    _limit.Item = le;
                    //20msV errlmt 0.01% res 1mV range 50mV to 10V  range 100mV to 20V
                }
                else
                {
                    cmbLimitType.SelectedIndex = LIMIT_PAIR;
                    SingleLimit limit1 = new SingleLimit();
                    SingleLimit limit2 = new SingleLimit();
                    limit1.comparator = ComparisonOperator.GE;
                    limit2.comparator = ComparisonOperator.LE;
                    var lp = new LimitPair {
                        Limit = new List <SingleLimit> {
                            limit1, limit2
                        }
                    };
                    limit1.Item = datum1;
                    if (values2.Count > 0)
                    {
                        Value      value2      = values2[0];
                        ErrorLimit errorLimit2 = value2.errorLimit;
                        Value      resolution2 = value2.resoluion;
                        string     unit2       = value2.unit;
                        string     val2        = value2.value;
                        @double    datum2      = value2.@double;
                        limit2.Item = datum2;
                        //20mV errlmt 0.01% res 1mV range 50mV to 10V  range 100mV to 20V
                    }
                    _limit.Item = lp;
                }
                DataToControls();
            }
        }