changed CommunicationStateChanged to EventHandler

This commit is contained in:
Lars Brubaker 2018-11-09 13:19:14 -08:00
parent 75cec79256
commit 4bb93fcc19
18 changed files with 64 additions and 39 deletions

View file

@ -53,10 +53,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.HoverColor = theme.ToolbarButtonHover;
this.MouseDownColor = theme.ToolbarButtonDown;
printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) =>
void CommunicationStateChanged(object s, EventArgs e)
{
UiThread.RunOnIdle(SetButtonStates);
}, ref unregisterEvents);
}
printer.Connection.CommunicationStateChanged += CommunicationStateChanged;
this.Closed += (s, e) => printer.Connection.CommunicationStateChanged -= CommunicationStateChanged;
SetButtonStates();
}