Revise candidatePort selection
This commit is contained in:
parent
1b6885255e
commit
97d4a21985
1 changed files with 2 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue