Esempio n. 1
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            if (!serialPort.IsOpen)
            {
                return;
            }

            string st = txtSend.Text.Trim();

            if (st.Length <= 0)
            {
                return;
            }

            TComm.SendText(serialPort, st);
            txtDialog.Text += "[Me] " + st + "\r\n";
            txtSend.Text    = "";
        }
Esempio n. 2
0
        private void timCommMon_Tick(object sender, EventArgs e)
        {
            if (!serialPort.IsOpen)
            {
                return;
            }

            //---------------------------------------------
            // Digital Input & AD
            //---------------------------------------------
            setCommLamp(true);

            string answer  = "";
            bool   success = TComm.RecieveText(serialPort, ref answer);

            if (success)
            {
                txtDialog.Text += "" + answer + "\r\n";
            }
        }