Exemplo n.º 1
0
        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() + "]");
            }
        }
Exemplo n.º 2
0
        public FormWarmUpProgress(FormDeviceInit form)
        {
            this.myUart   = form.myUart;
            this.myConfig = form.myConfig;
            this.myApi    = form.myApi;

            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }
Exemplo n.º 3
0
        public FormMDIParent(FormDeviceInit form)
        {
            myFormInit = form;
            myUart     = form.myUart;
            myTCP      = form.myTCP;
            myConfig   = form.myConfig;
            myApi      = form.myApi;

            myCurveFit = new CurveFitting(myConfig);

            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }
Exemplo n.º 4
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            try
            {
                myConfig.UserName = textBoxUserName.Text;
                myConfig.UserPwd  = textBoxPwd.Text;

                // 校验用户名和密码是否填写
                //if (string.IsNullOrEmpty(textBoxUserName.Text) || string.IsNullOrEmpty(textBoxPwd.Text))
                //{
                //    MessageBox.Show("用户名和密码必须要输入!");
                //    return;
                //}

                // 校验密码是否正确
                if (!checkUser())
                {
                    MessageBox.Show("输入的密码有问题!");
                    myUart.Pack_Debug_out(null, "[UserLogin] login failed!user="******",pwd=" + myConfig.UserPwd);

                    return;
                }

                myUart.Pack_Debug_out(null, "[UserLogin] login succeed!user="******",pwd=" + myConfig.UserPwd);

                myConfig.SaveLogin();

                // 校验成功跳转页面
                if (SerialPort_Open())
                {
                    myConfig.SaveCommunication();
                }
                else
                {
                    //MessageBox.Show("串口打开错误,登录失败");
                }

                this.textBoxUserName.Text = string.Empty;
                this.textBoxPwd.Text      = string.Empty;
                this.Hide();

                FormDeviceInit dev = new FormDeviceInit(this);
                dev.StartPosition = FormStartPosition.CenterScreen;
                //dev.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 5
0
        private void buttonShortInit_Click(object sender, EventArgs e)
        {
            myUart.Pack_Debug_out(null, "[Parent] Shortcut Init");

            if ((myFormInit == null) || (myFormInit.IsDisposed))
            {
                myFormInit = new FormDeviceInit(this);
                myFormInit.StartPosition = FormStartPosition.CenterScreen;
                myFormInit.Show();
            }
            else
            {
                this.Hide();
                myFormInit.BringToFront();
                myFormInit.Show();
                myUart.DeviceState = DEVICE_STATE.DEVICE_INIT;
            }
        }
Exemplo n.º 6
0
 public FormZeroPointConfirm(FormDeviceInit form)
 {
     InitializeComponent();
     Control.CheckForIllegalCrossThreadCalls = false;
 }