void ButtonTestClick(object sender, EventArgs e) { sPort port = null; port = spe.GetPortInstance(comboBoxPorts.Text); if (port == null) { return; } if (!port._IsAvailabel) { return; } if (!port.IsPortOpen()) { port.Subscribe(packetDetector); port.Subscribe(byteLogger); port.OpenPort(); comboBoxPorts.Enabled = false; buttonTest.Text = "Закрыть порт"; } else { port.ClosePort(); comboBoxPorts.Enabled = true; buttonTest.Text = "Открыть порт"; } }
public bool IsPortOpen(sPort port) { return(port.IsPortOpen()); }