Merge branch 'development' of https://github.com/MatterHackers/MatterControl into development

This commit is contained in:
larsbrubaker 2014-12-31 18:08:50 -08:00
commit 2db0d9ea0b

View file

@ -1922,11 +1922,14 @@ namespace MatterHackers.MatterControl.PrinterCommunication
serialPort.Write(lineToWrite);
//Debug.Write("w: " + lineToWrite);
}
catch (IOException)
catch (IOException ex)
{
OnConnectionFailed(null);
Trace.WriteLine("Error writing to printer: " + ex.Message);
// Handle hardware disconnects by relaying the failure reason and shutting down open resources
AbortConnectionAttempt("Connection Lost - " + ex.Message);
}
catch (TimeoutException)
catch (TimeoutException ex)
{
}
}
@ -1977,6 +1980,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
/// <param name="shutdownReadLoop">Shutdown/join the readFromPrinterThread</param>
public void AbortConnectionAttempt(string abortReason, bool shutdownReadLoop = true)
{
// Set .Disconnecting to allow the readloop to exit gracefully before a forced thread join (and extended timeout)
CommunicationState = CommunicationStates.Disconnecting;
// Shudown the connectionAttempt thread