示例#1
0
        public bool Connect(string comPortName)
        {
            if (client == null)
            {
                client = new CommunicationProtocolClient();
                client.Open();
            }

            return(client.Connect(comPortName));
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (client.IsConnected())
            {
                client.Disconnect();
            }
            else
            {
                client.Connect(textBoxCom.Text);
            }


            updateView();
        }
示例#3
0
        private void buttonPort_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                string portName = Activesheet.Range["A2"].Value2;
                client.Connect(portName);
            }
            catch (Exception ex)
            {
                showMessage(ex.ToString());
            }

            updateView();
        }