Move event registration and overrides into EditPrinterSettingsPage type
- Remove unused GetSystemWindow helper function - Remove used member, resolve compiler warning - Rename runningAttentions variable
This commit is contained in:
parent
636df059ec
commit
3a5073a8fc
3 changed files with 23 additions and 40 deletions
|
|
@ -40,6 +40,8 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
public class EditPrinterSettingsPage : WizardPage
|
||||
{
|
||||
private EventHandler unregisterEvents = null;
|
||||
|
||||
public EditPrinterSettingsPage()
|
||||
: base("Done")
|
||||
{
|
||||
|
|
@ -60,6 +62,15 @@ namespace MatterHackers.MatterControl
|
|||
footerRow.AddChild(cancelButton);
|
||||
|
||||
cancelButton.Text = "Back".Localize();
|
||||
|
||||
// Close this form if the active printer changes
|
||||
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
if (!WizardWindow.HasBeenClosed)
|
||||
{
|
||||
WizardWindow.Close();
|
||||
}
|
||||
}, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void AddNameSetting(string sliceSettingsKey, FlowLayoutWidget contentRow, ref int tabIndex)
|
||||
|
|
@ -70,5 +81,11 @@ namespace MatterHackers.MatterControl
|
|||
contentRow.AddChild(control);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
base.OnClosed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue