private static void ChangeComPortName(string comPort) { ReadPortList(); if (PortList.Count != 0) { ComPortName = PortList.Contains(comPort) ? comPort : PortList[0]; } else { ComPortName = ""; } }