コード例 #1
0
        //------------------------------------------------------------------------------
        //Callback Name: update_cb
        //------------------------------------------------------------------------------
        public int update_cb(NXOpen.BlockStyler.UIBlock block)
        {
            try
            {
                if (block == LB_Solutions)
                {
                    // ...
                }
                else if (block == button_SelectAll)
                {
                    if (!allSelected)
                    {
                        // SELECT ALL
                        LB_Solutions.SetSelectedItems(Enumerable.Range(0, mySolutions.Count).ToArray());

                        // Adjust button label
                        button_SelectAll.Label = "Deselect all";
                        allSelected            = true;
                    }
                    else
                    {
                        // DESELECT ALL
                        LB_Solutions.SetSelectedItems(new List <int>().ToArray());

                        // Adjust button label
                        button_SelectAll.Label = "Select all";
                        allSelected            = false;
                    }
                }
                else if (block == separator0)
                {
                    //---------Enter your code here-----------
                }
                else if (block == BTN_Generate)
                {
                    // GET SELECTED SOLUTIONS
                    mySelectedSolutions.Clear();

                    foreach (int index in LB_Solutions.GetSelectedItems())
                    {
                        mySelectedSolutions.Add(mySolutions[index]);
                    }

                    // GENERATE CPP RESULT PROBES
                    ProbeGenerator myProbeGenerator = new ProbeGenerator();
                    myProbeGenerator.GenerateCPPResultProbes(mySelectedSolutions, mySIM);

                    Logger.Show();
                }
            }
            catch (Exception ex)
            {
                //---- Enter your exception handling code here -----
                theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
            }
            return(0);
        }