public void OpenPort(string portName, int baudRate, string parity, int dataBits, int stopBits) { /** Open serial port that talks to the DMM. */ this.comPort = new ComPort(portName, baudRate, parity, dataBits, stopBits); this.comPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); try { this.comPort.Open(); } catch { // Do nothing. } }
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; } }