//Runs when form loads
        private void Form1_Load(object sender, EventArgs e)
        {
            gclib             = new gclib();                                                         //constructor can throw, so SHOULD keep it in a Try block
            movementVariables = new MovementVariables();
            movementType      = new MovementType(analyzer, this, gclib /*, ref movementVariables*/); // declaring here for the sole purpose of allowing "general relative movement"

            // UPDATE 30/4/20: Set up persistent variables (used in movementVariables):
            myMmToStepper_unitAxisAB = movementVariables.mmToStepper_unitAxisAB;
            myMmToStepper_unitAxisC  = movementVariables.mmToStepper_unitAxisC;


            PrintOutput(textBox1, "Enter a FULL GOpen() address above and press Enter", PrintStyle.Instruction);
            PrintOutput(textBox1, "NOTE: This demo will attempt to move Axis A", PrintStyle.Instruction);

            //this block here to list out available connections
            //make it easier for user to refer to when typing out address
            PrintOutput(textBox1, "Available connections:");
            string[] addrs = gclib.GAddresses();
            if (addrs.Length == 0)
            {
                PrintOutput(textBox1, "None");
            }
            else
            {
                foreach (string a in addrs)
                {
                    PrintOutput(textBox1, a, PrintStyle.GclibData);
                }
            }
            //disable ability to move before a connection with controller has been established
            DisconnectStripButton.Enabled = false; groupBox1.Enabled = false;
            GeneralGroup.Enabled          = false; configBox.Enabled = false;
            originButton.Enabled          = false; returnOriginButton.Enabled = false;
        }
        // run PNA VNA scanning when position has been reached by controller:
        public void PNA_scan(int[] coor, MovementVariables movementVariables)
        {
            DataPoint dbpt = new DataPoint(Points);

            // Let the probe settle
            System.Threading.Thread.Sleep(200);
            dbpt.Data = Measure();
            // Landing point to do PNA scan:
            dbpt.Location  = new Point(coor[0], coor[1]);
            dbpt.LocationZ = movementVariables.Axis_c_rest_position + movementVariables.Axis_c_drop_by;
            //dbpt.Index = i;
            dataPoints.Add(dbpt);
        }
        // Handler when "unit of measure" buttons events fire:
        private void unitChangeHandler()
        {
            if (mmButton.Checked || stepperButton.Checked)
            {
                on_unitSelected();
                if (mmButton.Checked)
                {
                    movementVariables = new MovementVariables_mmUnit();
                }
                else if (stepperButton.Checked)
                {
                    movementVariables = new MovementVariables_stepperUnit();
                }

                // UPDATE 30/4/20:
                movementVariables.mmToStepper_unitAxisAB = myMmToStepper_unitAxisAB;
                movementVariables.mmToStepper_unitAxisC  = myMmToStepper_unitAxisC;
            }
        }