Beispiel #1
0
        private void buttonMenuMea_Click(object sender, EventArgs e)
        {
            try
            {
                myUart.Pack_Debug_out(null, "[Parent] Menu Measure");

                if (!HaveOpened(this, "FormChildMeasure"))
                {
                    //return;
                }

                myFormMeasure                 = new FormChildMeasure(this);
                myFormMeasure.MdiParent       = this;
                myFormMeasure.WindowState     = FormWindowState.Maximized;
                myFormMeasure.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                myFormMeasure.Text            = "";
                myFormMeasure.ControlBox      = false;
                myFormMeasure.Dock            = DockStyle.Fill;
                //myFormMeasure.Show();
            }
            catch (Exception ex)
            {
                myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]");
            }
        }
        private void buttonMoveStart_Click(object sender, EventArgs e)
        {
            bool checkResult = false;

            double[] angle = new double[5];

            try
            {
                myUart.Pack_Debug_out(null, "[5 Axis] Move Start");

                angle[0] = Convert.ToDouble(textBoxAxisA.Text);
                angle[1] = Convert.ToDouble(textBoxAxisB.Text);
                angle[2] = Convert.ToDouble(textBoxAxisX.Text);
                angle[3] = Convert.ToDouble(textBoxAxisY.Text);
                angle[4] = Convert.ToDouble(textBoxAxisZ.Text);

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[0], -30, 75);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("α轴数据范围错误!(-30~75)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[1], 0, 360);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("β轴数据范围错误!(0~360)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[2], -30, 30);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("X轴数据范围错误!(-30~+30)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[3], -30, 30);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("Y轴数据范围错误!(-30~+30)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[4], -2, 48);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("Z轴数据范围错误!(-2~48)");
                    return;
                }

                myApi.SendAngleABXYZ(angle);
                timerUartRecv.Interval = 1000 * 60;
                timerUartRecv.Enabled  = true;
            }
            catch (Exception ex)
            {
                myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]");
            }
        }
Beispiel #3
0
        public FormShowSettings(FormChildMeasure form)
        {
            myParentForm = form;
            myConfig     = form.myConfig;

            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }
Beispiel #4
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            try
            {
                sendVoltage = Convert.ToDouble(textBoxHighVoltage.Text);
                sendCurrent = Convert.ToDouble(textBoxCurrent.Text);

                myUart.Pack_Debug_out(null, "[HighVoltage] voltage open,v=" + sendVoltage.ToString() + "c=" + sendCurrent.ToString());

                bool checkResult = FormChildMeasure.checkHighVoltageRange(myApi.TargetType, sendVoltage, sendCurrent);
                if (checkResult)
                {
                    myApi.SendHighVoltageUp(sendVoltage, sendCurrent);
                    timerUartRecv.Interval = 1000 * 40;
                    timerUartRecv.Enabled  = true;
                }

                //string pattern = @"^[0-9]*$";
                //Match m1 = Regex.Match(textBoxHighVoltage.Text, pattern);   // 匹配正则表达式
                //Match m2 = Regex.Match(textBoxCurrent.Text, pattern);
                //if ((!m1.Success) || (!m2.Success))
                //{
                //    FormDeviceInit.showErrorMessageBox("只能输入整数");

                //    return;
                //}

                //int voltageMin = 10;
                //int voltageMax = 25;
                //int currentMin = 5;
                //int currentMax = 40;

                //if (myParent.myConfig.TargetType == 0)
                //{
                //    voltageMin = 10;
                //    voltageMax = 25;
                //    currentMin = 5;
                //    currentMax = 40;
                //}
                //else if (myParent.myConfig.TargetType == 1)
                //{
                //    voltageMin = 10;
                //    voltageMax = 40;
                //    currentMin = 5;
                //    currentMax = 40;
                //}
                //else
                //{

                //}

                //int voltage = Convert.ToInt32(textBoxHighVoltage.Text);
                //int current = Convert.ToInt32(textBoxCurrent.Text);
                //if ((voltage >= voltageMin) && (voltage <= voltageMax)
                //    && (current >= currentMin) && (current <= currentMax))
                //{
                //    myParent.ShortcutHighVoltage_SetValue[0] = voltage;
                //    myParent.ShortcutHighVoltage_SetValue[1] = current;

                //    this.DialogResult = DialogResult.OK;
                //    this.Close();
                //}
                //else
                //{
                //    string str = "输入范围错误!电压:";
                //    str += voltageMin.ToString();
                //    str += "~";
                //    str += voltageMax.ToString();
                //    str += "  电流:";
                //    str += currentMin.ToString();
                //    str += "~";
                //    str += currentMax.ToString();

                //    FormDeviceInit.showErrorMessageBox(str);
                //}
            }
            catch (Exception ex)
            {
                myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]");
            }
        }