Moved to EventHandler

Connection Failed
DestinationChanged
This commit is contained in:
Lars Brubaker 2018-11-09 13:50:43 -08:00
parent 82a7eb2587
commit 5d6be0c4bf
8 changed files with 33 additions and 26 deletions

View file

@ -154,7 +154,8 @@ namespace MatterHackers.MatterControl.ActionBar
this.Closed += (s, e) => printer.Connection.CommunicationStateChanged -= CommunicationStateChanged;
printer.Connection.EnableChanged.RegisterEvent((s, e) => SetVisibleStates(), ref unregisterEvents);
printer.Connection.ConnectionFailed.RegisterEvent((s, e) =>
void ConnectionFailed(object s, EventArgs e)
{
#if !__ANDROID__
// TODO: Someday this functionality should be revised to an awaitable Connect() call in the Connect button that
@ -171,7 +172,9 @@ namespace MatterHackers.MatterControl.ActionBar
}
#endif
listenForConnectFailed = false;
}, ref unregisterEvents);
}
printer.Connection.ConnectionFailed += ConnectionFailed;
this.Closed += (s, e) => printer.Connection.ConnectionFailed -= ConnectionFailed;
this.SetVisibleStates();
}