/// <summary> /// methos to load our serial /// port option values /// </summary> private void LoadValues() { PumpComm.DisplayWindow = rtbDisplay; PumpComm.SetPortNameValues(cboPort); PumpComm.SetParityValues(cboParity); PumpComm.SetStopBitValues(cboStop); }
private void SendData() { PumpComm.WriteData(txtSend.Text); if (!PumpComm.DataReadyEvent.WaitOne(1000)) { PumpComm.DisplayData(ComPortManager.MessageType.Error, "Data was not received in 1 second!\n"); } PumpComm.DataReadyEvent.Reset(); txtSend.SelectAll(); }
private void btnClose_Click(object sender, EventArgs e) { PumpComm.ClosePort(); if (false == PumpComm.IsPortOpen) { btnOpen.Enabled = true; btnClose.Enabled = false; btnSend.Enabled = false; txtSend.Enabled = false; } }
private void btnOpen_Click(object sender, EventArgs e) { PumpComm.PortName = cboPort.Text; PumpComm.Parity = cboParity.Text; PumpComm.StopBits = cboStop.Text; PumpComm.DataBits = cboData.Text; PumpComm.BaudRate = cboBaud.Text; PumpComm.OpenPort(); if (true == PumpComm.IsPortOpen) { btnOpen.Enabled = false; btnClose.Enabled = true; btnSend.Enabled = true; txtSend.Enabled = true; } }