Symphonary.SerialPortSelector.getPortList C# (CSharp) Method

getPortList() private method

private getPortList ( ) : void
return void
        private void getPortList()
        {
            _SerialPorts.Clear();
            a_SerialPorts = SerialPort.GetPortNames();

            SerialPort testPort;
            foreach (string port in a_SerialPorts) {
                try {
                    testPort = new SerialPort(port);
                    testPort.Open();
                    _SerialPorts.Add(new SerialPortEntry
                    {
                        s_PortName = port,
                        s_Status = "ON"
                    });
                    testPort.Close();
                }
                catch (IOException e) {
                    _SerialPorts.Add(new SerialPortEntry
                    {
                        s_PortName = port,
                        s_Status = "OFF"
                    });
                }
            }

            for (int i = 0; i < listView.Items.Count; i++) {
                if (s_PrevSelectedSerialPort == ((SerialPortEntry)listView.Items[i]).s_PortName) {
                    listView.SelectedIndex = i;
                    break;
                }
            }
        }

Same methods

SerialPortSelector::getPortList ( NWGUI Browser ) : void