Only fire OnConnectionSucceeded if connected

This commit is contained in:
John Lewin 2014-10-31 13:31:38 -07:00
parent 2436f0257e
commit 3685877ab7

View file

@ -1339,15 +1339,17 @@ namespace MatterHackers.MatterControl.PrinterCommunication
return true; return true;
} }
} }
else if (CommunicationState == CommunicationStates.FailedToConnect)
{
connectThread.Join(JoinThreadTimeoutMs);
return false;
}
else else
{ {
connectThread.Join(JoinThreadTimeoutMs); //Halt connection thread // If we're no longer in the .AttemptingToConnect state, shutdown the connection thread and fire the
OnConnectionSucceeded(null); // OnConnectonSuccess event if we're connected
connectThread.Join(JoinThreadTimeoutMs);
if(PrinterIsConnected)
{
OnConnectionSucceeded(null);
}
return false; return false;
} }
} }