public bool Connect(string comPortName) { if (client == null) { client = new CommunicationProtocolClient(); client.Open(); } return(client.Connect(comPortName)); }
private void button1_Click(object sender, EventArgs e) { if (client.IsConnected()) { client.Disconnect(); } else { client.Connect(textBoxCom.Text); } updateView(); }
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(); }