Revise candidatePort selection

This commit is contained in:
John Lewin 2015-02-04 19:51:36 -08:00
parent 1b6885255e
commit 97d4a21985

View file

@ -140,16 +140,8 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void ConnectButton_Click(object sender, EventArgs mouseEvent)
{
string candidatePort = null;
currentPortNames = FrostedSerialPort.GetPortNames();
foreach (string portName in currentPortNames)
{
if (!startingPortNames.Any(portName.Contains))
{
candidatePort = portName;
}
}
// Select the first port that's in GetPortNames() but not in startingPortNames
string candidatePort = FrostedSerialPort.GetPortNames().Except(startingPortNames).FirstOrDefault();
if (candidatePort == null)
{
printerErrorMessage.TextColor = RGBA_Bytes.Red;