private void btn_ReadCV_Click(object sender, RoutedEventArgs e)
        {
            // Do not try to get common variable 0.
            // Doing so will cause a 'not supported' exception
            // because there is no common variable 0.
            int    i     = combo_CVN.SelectedIndex;
            double value = 1;

            try
            {
                if (RadioBtnMC.IsChecked == true)
                {
                    value = objMVariables.GetCommonVariableValue(i);
                }
                else if (RadioBtnLathe.IsChecked == true)
                {
                    value = objLVariables.GetCommonVariableValue(i);
                }
            }
            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);
            }

            txtBlockReadResult.Text = value.ToString();
        }
Esempio n. 2
0
        private void btn_ReadCV_Click(object sender, RoutedEventArgs e)
        {
            // Do not try to get common variable 0.
            // Doing so will cause a 'not supported' exception
            // because there is no common variable 0.
            int    i     = combo_CVN.SelectedIndex;
            double value = 1;

            try
            {
                if (RadioBtnMC.IsChecked == true)
                {
                    value = objMVariables.GetCommonVariableValue(i);
                }
                else if (RadioBtnLathe.IsChecked == true)
                {
                    value = objLVariables.GetCommonVariableValue(i);
                }
            }
            catch (Exception ex)
            {
                DoError(new Exception(String.Format("Error Reading Common Variable {0}.", i), ex));
            }

            txtBlockReadResult.Text = value.ToString();
        }
Esempio n. 3
0
 public double GetCommonVariable(int Index)
 {
     try
     {
         Console.WriteLine("Received GetCommonVariable(Index:{0})", Index);
         return(THINC_VariablesLathe.GetCommonVariableValue(Index));
     }
     catch (Exception ex)
     {
         HandleEx(MethodBase.GetCurrentMethod().Name, ex);
         return(-99999999.999);
     }
 }