Exemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (tbA.Text.Length == 0 || tbB.Text.Length == 0)
            {
                return;
            }

            try
            {
                float a = float.Parse(tbA.Text);
                float b = float.Parse(tbB.Text);
                if (a <= 0 || b <= 0)
                {
                    return;
                }

                SizeF size = new SizeF(b, a);

                drawingPlane.UpdateMapping(size);

                calibrationHelper.SetCalibratorFromType(CalibratorType.Plane);
                calibrationHelper.CalibrationByPlane_Initialize(size, drawingPlane.QuadImage);
                calibrationHelper.LengthUnit = (LengthUnit)cbUnit.SelectedIndex;
            }
            catch
            {
                // Failed : do nothing.
                log.Error(String.Format("Error while parsing size. ({0}x{1}).", tbA.Text, tbB.Text));
            }
        }