Esempio n. 1
0
 /// <summary>
 /// methods to load rotary valve serial
 /// port option values
 /// </summary>
 private void LoadValveValues()
 {
     ValveComm.DisplayWindow = rtbValveDisplay;
     ValveComm.SetPortNameValues(cboValvePort);
     ValveComm.SetParityValues(cboValveParity);
     ValveComm.SetStopBitValues(cboValveStop);
 }
Esempio n. 2
0
 private void SendValveData()
 {
     ValveComm.WriteData(txtValveSend.Text);
     if (!ValveComm.DataReadyEvent.WaitOne(5000))
     {
         ValveComm.DisplayData(ComPortManager.MessageType.Error, "Data was not received in 5 seconds!\n");
     }
     ValveComm.DataReadyEvent.Reset();
     txtValveSend.SelectAll();
 }
Esempio n. 3
0
 private void btnValveClose_Click(object sender, EventArgs e)
 {
     ValveComm.ClosePort();
     if (false == ValveComm.IsPortOpen)
     {
         btnValveOpen.Enabled  = true;
         btnValveClose.Enabled = false;
         btnValveSend.Enabled  = false;
         txtValveSend.Enabled  = false;
     }
 }
Esempio n. 4
0
        private void btnValveOpen_Click(object sender, EventArgs e)
        {
            ValveComm.PortName = cboValvePort.Text;
            ValveComm.Parity   = cboValveParity.Text;
            ValveComm.StopBits = cboValveStop.Text;
            ValveComm.DataBits = cboValveData.Text;
            ValveComm.BaudRate = cboValveBaud.Text;
            ValveComm.OpenPort();

            if (true == ValveComm.IsPortOpen)
            {
                ValveComm.NewLine     = "\r";
                btnValveOpen.Enabled  = false;
                btnValveClose.Enabled = true;
                btnValveSend.Enabled  = true;
                txtValveSend.Enabled  = true;
            }
        }