示例#1
0
        /** *********************************************** */
        /** *** All about setting up serial connection. *** */
        /** *********************************************** */

        private void buttonConnect_Click(object sender, EventArgs e)
        {
            /** Connect/disconnect to DMM via RS232. */

            if (this.comPort.IsOpen)
            {
                this.comPort.Close();
                /* Disable buttons that writes to serial port. */
                if (IS_WORK_MODE)
                {
                    this.buttonRunSequence.Enabled = false;
                    this.buttonRunSequenceOnce.Enabled = false;
                    this.buttonStopSequence.Enabled = false;
                }
            }
            else
            {
                if (this.connectForm.IsDisposed)
                {
                    this.connectForm = new ConnectForm(this);
                    this.connectForm.Show();
                }
            }
            this.UpdateConnectionDisplay();
        }
示例#2
0
        private int outputCounter; // Count number of outputs in a single measurement. 

        public MainForm()
        {
            InitializeComponent();
            this.connectForm = new ConnectForm(this);
            this.connectForm.Dispose();
            this.comPort = new ComPort();
            this.sequence = new Sequence();

            this.checkBoxStop.Checked = false;
            this.ifAbort = false;

            /* Disable buttons that writes to serial port. */
            if (IS_WORK_MODE)
            {
                this.buttonRunSequence.Enabled = false;
                this.buttonRunSequenceOnce.Enabled = false;
                this.buttonStopSequence.Enabled = false;
            }
        }