private void btn_WriteCV_Click(object sender, RoutedEventArgs e)
        {
            bool validate = validateInput(txtBox_WriteVal.Text);

            if (validate)
            {
                int i     = combo_CVN.SelectedIndex;
                int value = Convert.ToInt32(txtBox_WriteVal.Text);

                try
                {
                    if (RadioBtnMC.IsChecked == true)
                    {
                        objMVariables.SetCommonVariableValue(i, value);
                    }
                    else if (RadioBtnLathe.IsChecked == true)
                    {
                        objLVariables.SetCommonVariableValue(i, value);
                    }
                }
                catch (Exception ex)
                {
                    DoError(new Exception("Error initializing API: If API is installed, there should be a round" +
                                          " green icon in the task-bar that tells API version when clicked. If version is less than" +
                                          " 1.9.1, contact your distributor to request a free API upgrade.", ex));
                    Environment.Exit(0);
                }
            }
            else
            {
                MessageBox.Show("Input Error! " + Environment.NewLine + "Blank or non-numerical input detected.");
            }
        }
Exemple #2
0
        private void btn_WriteCV_Click(object sender, RoutedEventArgs e)
        {
            bool validate = validateInput(txtBox_WriteVal.Text);

            if (validate)
            {
                int i     = combo_CVN.SelectedIndex;
                int value = Convert.ToInt32(txtBox_WriteVal.Text);

                try
                {
                    if (RadioBtnMC.IsChecked == true)
                    {
                        objMVariables.SetCommonVariableValue(i, value);
                    }
                    else if (RadioBtnLathe.IsChecked == true)
                    {
                        objLVariables.SetCommonVariableValue(i, value);
                    }
                }
                catch (Exception ex)
                {
                    DoError(new Exception(String.Format("Error Reading Common Variable {0}.", i), ex));
                }
            }
            else
            {
                MessageBox.Show("Input Error! " + Environment.NewLine + "Blank or non-numerical input detected.");
            }
        }
Exemple #3
0
 public bool SetCommonVariable(int Index, double Value)
 {
     try
     {
         Console.WriteLine("Received SetCommonVariable(Index:{0}, Value:{1})", Index, Value);
         THINC_VariablesLathe.SetCommonVariableValue(Index, Value);
         return(true);
     }
     catch (Exception ex)
     {
         HandleEx(MethodBase.GetCurrentMethod().Name, ex);
         return(false);
     }
 }