示例#1
0
        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       = "Открыть порт";
            }
        }
示例#2
0
 public bool IsPortOpen(sPort port)
 {
     return(port.IsPortOpen());
 }