Move event bindings to constructor bottom

This commit is contained in:
John Lewin 2018-04-17 08:14:08 -07:00
parent ce6c9d10fa
commit f160f7e5ab

View file

@ -63,18 +63,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.BackgroundColor = theme.MinimalShade;
this.Padding = theme.DefaultContainerPadding;
ActiveSliceSettings.MaterialPresetChanged += ActiveSliceSettings_MaterialPresetChanged;
ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) =>
{
if (e is StringEventArgs stringEvent
&& (stringEvent.Data == SettingsKey.default_material_presets
|| stringEvent.Data == SettingsKey.layer_name))
{
RebuildDropDownList();
}
}, ref unregisterEvents);
// Section Label
this.AddChild(new TextWidget(label, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor)
{
@ -93,6 +81,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
};
pullDownContainer.AddChild(GetPulldownContainer());
this.AddChild(pullDownContainer);
ActiveSliceSettings.MaterialPresetChanged += ActiveSliceSettings_MaterialPresetChanged;
ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) =>
{
if (e is StringEventArgs stringEvent
&& (stringEvent.Data == SettingsKey.default_material_presets
|| stringEvent.Data == SettingsKey.layer_name))
{
RebuildDropDownList();
}
}, ref unregisterEvents);
}
public FlowLayoutWidget GetPulldownContainer()