From 75fb57b80576d981f1fac024c49a4ebcd2cdd07e Mon Sep 17 00:00:00 2001 From: jlewin Date: Mon, 6 May 2019 15:11:05 -0700 Subject: [PATCH] Hook connection fail/success and update accordingly - Issue MatterHackers/MCCentral#3457 Setup Wizard does not show error if connection fails --- .../PrinterConnections/SetupStepComPortManual.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs b/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs index 18df92b5d..908c53a65 100644 --- a/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs +++ b/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs @@ -76,6 +76,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections printerComPortError.Text = "Attempting to connect".Localize() + "..."; printerComPortError.TextColor = theme.TextColor; + printer.Connection.ConnectionFailed += Connection_CommunicationStateChanged; + printer.Connection.ConnectionSucceeded += Connection_CommunicationStateChanged; + printer.Settings.Helpers.SetComPort(GetSelectedSerialPort()); printer.Connection.Connect(); @@ -114,6 +117,8 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections { // Unregister listeners printer.Connection.CommunicationStateChanged -= Connection_CommunicationStateChanged; + printer.Connection.ConnectionFailed -= Connection_CommunicationStateChanged; + printer.Connection.ConnectionSucceeded -= Connection_CommunicationStateChanged; base.OnClosed(e); }