Hook connection fail/success and update accordingly
- Issue MatterHackers/MCCentral#3457 Setup Wizard does not show error if connection fails
This commit is contained in:
parent
e6ca25e43b
commit
75fb57b805
1 changed files with 5 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue