private void OnRefreshingAvailablePorts() { string selectedPort = SelectedPort; AvailablePorts.Clear(); AvailablePorts.AddCollection(_connectionManager.GetSerialPortNames()); SelectedPort = !AvailablePorts.Contains(selectedPort) ? null : selectedPort; }