public void LoadPorts()
        {
            IEnumerable <string> ports    = SerialReader.GetAvailablePorts();
            List <string>        toChange = new List <string>();

            //Search not non-existent
            foreach (var port in ComPorts)
            {
                if (!ports.Contains(port))
                {
                    toChange.Add(port);
                }
            }
            //Delete not non-existent
            ComPorts.RemoveRange(toChange);
            toChange.Clear();
            //Search New
            foreach (var port in ports)
            {
                if (!ComPorts.Contains(port))
                {
                    toChange.Add(port);
                }
            }
            //Add New
            ComPorts.AddRange(toChange);
            //Select One if needed
            if (SelectedComPort == null || !ComPorts.Contains(SelectedComPort))
            {
                SelectedComPort = ComPorts.FirstOrDefault();
            }
        }
        private void BindValues()
        {
            BaudRates = new BindableCollection <int>()
            {
                1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
            };
            SelectedBaudRate = 115200;

            DataBits = new BindableCollection <int>()
            {
                5, 6, 7, 8, 9
            };
            SelectedDataBits = 8;

            Parities = new BindableCollection <Parity>();
            foreach (Parity p in Enum.GetValues(typeof(Parity)))
            {
                Parities.Add(p);
            }
            SelectedParity = Parity.None;

            StopBits = new BindableCollection <StopBits>();
            foreach (StopBits s in Enum.GetValues(typeof(StopBits)))
            {
                StopBits.Add(s);
            }
            SelectedStopBits = System.IO.Ports.StopBits.One;


            IEnumerable <string> ports = SerialReader.GetAvailablePorts();

            ComPorts = new BindableCollection <string>();
            ComPorts.AddRange(ports);

            SelectedComPort = ports.FirstOrDefault();
        }
 private void BindPortNameList()
 {
     serialPortDefinitions = SerialReader.GetAvailablePorts().ToArray();
     ComPorts        = new BindableCollection <string>(serialPortDefinitions.Select(x => x.PortName));
     SelectedComPort = serialPortDefinitions.FirstOrDefault()?.PortName;
 }