Exemplo n.º 1
0
        /// <summary>
        /// 檢查料號與料盤參數是否在範圍內
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void TextChangedForPartNoAndTray(object sender, EventArgs e)
        {
            TextBox textBox   = (TextBox)sender;
            string  result    = string.Empty;
            double  parameter = 99999;

            try
            {
                if (!string.IsNullOrEmpty(textBox.Text))
                {
                    switch (textBox.Name)
                    {
                    case "txtPieceX":
                    case "txtPieceY":
                        parameter = Convert.ToDouble(textBox.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 80.100, 10.000);
                        break;

                    case "txt2DPositionX":
                    case "txt2DPositionY":
                    case "txtTrayOffsetX":
                    case "txtTrayOffsetY":
                        parameter = Convert.ToDouble(textBox.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 100.000, -100.000);
                        break;

                    case "txtTrayCenter":
                    case "txtTrayLength":
                        parameter = Convert.ToDouble(textBox.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 1000.000, 0.000);
                        break;

                    case "txtThickness":
                    case "txtDividePitchX":
                    case "txtDividePitchY":
                    case "txtPieceCenterX":
                    case "txtPieceCenterY":
                        parameter = Convert.ToDouble(textBox.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 100.000, 0.000);
                        break;

                    default:
                        result = "錯誤: 無元件代碼。";
                        break;
                    }

                    if (!string.IsNullOrEmpty(result))
                    {
                        MessageBox.Show("錯誤:" + result);
                        textBox.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤:" + ex.Message);
                textBox.Clear();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 檢查雷射參數是否在範圍內
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void TextChangedForLaser(object sender, EventArgs e)
        {
            TextBox textBox      = (TextBox)sender;
            string  result       = string.Empty;
            int     intParameter = 99999;
            double  parameter    = 99999;

            try
            {
                if (!string.IsNullOrEmpty(textBox.Text))
                {
                    switch (textBox.Name)
                    {
                    case "txtFNO":
                        intParameter = Convert.ToInt32(textBox.Text);
                        result       = ValidateUtility.CheckParameter(intParameter, 2000, 0000);
                        break;

                    case "txtPower":
                        intParameter = Convert.ToInt32(textBox.Text);
                        result       = ValidateUtility.CheckParameter(intParameter, 100, 10);
                        break;

                    case "txtSpeed":
                        intParameter = Convert.ToInt32(textBox.Text);
                        result       = ValidateUtility.CheckParameter(intParameter, 2000, 1);
                        break;

                    case "txtXOffset":
                    case "txtYOffset":
                        parameter = Convert.ToDouble(textBox.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 55.000, -55.000);
                        break;

                    case "txtHeight":
                    case "txtWidth":
                        parameter = Convert.ToDouble(textBox.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 80.000, 5.000);
                        break;

                    default:
                        result = "錯誤: 無元件代碼。";
                        break;
                    }

                    if (!string.IsNullOrEmpty(result))
                    {
                        MessageBox.Show("錯誤:" + result);
                        textBox.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤:" + ex.Message);
                textBox.Clear();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 檢查參數是否在範圍內
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void TextChangedForLaser(object sender, EventArgs e)
        {
            Label  label     = (Label)sender;
            string result    = string.Empty;
            double parameter = 999999;

            try
            {
                if (!string.IsNullOrEmpty(label.Text))
                {
                    switch (label.Name)
                    {
                    case "lblXoffset":
                    case "lblYoffset":
                        parameter = Convert.ToDouble(label.Text);
                        result    = ValidateUtility.CheckParameter(parameter, 55.000, -55.000);
                        break;

                    default:
                        result     = "檢查參數範圍,無元件代碼。";
                        label.Text = "0.000";
                        break;
                    }

                    if (!string.IsNullOrEmpty(result))
                    {
                        MessageBox.Show("錯誤:" + result);
                        label.Text = "0.000";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤:" + ex.Message);
                label.Text = "0.000";
            }
        }