private void btnInit_Click(object sender, RoutedEventArgs e)
        {
            if (RadioBtnMC.IsChecked == true)
            {
                try
                {
                    // Create an instance of CMachine class
                    objMMachine = new Okuma.CMDATAPI.DataAPI.CMachine();

                    // 'Init()' must be called exactly once on the main
                    //   thread from an instance of CMachine before any
                    //   API operations can take place.
                    // Note that the instance of CMachine need not remain
                    //   after 'Init()' is called as that part of CMachine
                    //   is actually static.
                    objMMachine.Init();

                    // Create an instance of CVariables class
                    objMVariables = new Okuma.CMDATAPI.DataAPI.CVariables();

                    doneInit();
                }
                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 if (RadioBtnLathe.IsChecked == true)
            {
                try
                {
                    // Create an instance of CMachine class
                    objLMachine = new Okuma.CLDATAPI.DataAPI.CMachine();

                    // Call the Init method of CMachine class to initialize the
                    // library once for the entire application.
                    objLMachine.Init();

                    // Create an instance of CVariables class
                    objLVariables = new Okuma.CLDATAPI.DataAPI.CVariables();

                    doneInit();
                }
                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);
                }
            }
        }
Esempio n. 2
0
 public Mill()
 {
     THINC_VariablesMill = new CMDATAPI.DataAPI.CVariables();
 }