changed CommunicationStateChanged to EventHandler
This commit is contained in:
parent
75cec79256
commit
4bb93fcc19
18 changed files with 64 additions and 39 deletions
|
|
@ -79,10 +79,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Margin = theme.ButtonSpacing
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
PrinterSettings.SettingChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,8 +146,14 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
child.Margin = theme.ButtonSpacing;
|
||||
}
|
||||
|
||||
void CommunicationStateChanged(object s, EventArgs e)
|
||||
{
|
||||
this.SetVisibleStates();
|
||||
}
|
||||
printer.Connection.CommunicationStateChanged += CommunicationStateChanged;
|
||||
this.Closed += (s, e) => printer.Connection.CommunicationStateChanged -= CommunicationStateChanged;
|
||||
|
||||
printer.Connection.EnableChanged.RegisterEvent((s, e) => SetVisibleStates(), ref unregisterEvents);
|
||||
printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) => SetVisibleStates(), ref unregisterEvents);
|
||||
printer.Connection.ConnectionFailed.RegisterEvent((s, e) =>
|
||||
{
|
||||
#if !__ANDROID__
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue