Beispiel #1
0
        private void SearchForPortAndAddOrRemove(object sender, EventArgs e)
        {
            List <string> portlist = SerialPort.GetPortNames().ToList();

            var oldports = PortList.Except(portlist).ToList();
            var newports = portlist.Except(PortList).ToList();

            if (oldports.Count == 0 && newports.Count == 0)
            {
                return;
            }

            PortList = portlist;
            OnPropertyChanged(nameof(PortList));
        }