Propagate changes to SetSettingsOnChange values on ClearValue

- Issue MatterHackers/MCCentral#3754
Network printing is not disabled when clearing the setting using
the X button.
This commit is contained in:
John Lewin 2018-07-17 16:01:12 -07:00
parent 7274ebdbab
commit 475a5b3af8

View file

@ -1296,6 +1296,26 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
RestoreUserOverride(layer, settingsKey);
}
if (SettingsOrganizer.SettingsData.TryGetValue(settingsKey, out SliceSettingData settingData))
{
if (settingData.DataEditType == SliceSettingData.DataEditTypes.CHECK_BOX)
{
string checkedKey = this.GetValue<bool>(settingsKey) ? "OnValue" : "OffValue";
// Linked settings should be updated in all cases (user clicked checkbox, user clicked clear)
foreach (var setSettingsData in settingData.SetSettingsOnChange)
{
if (setSettingsData.TryGetValue(checkedKey, out string targetValue))
{
if (this.GetValue(setSettingsData["TargetSetting"]) != targetValue)
{
this.SetValue(setSettingsData["TargetSetting"], targetValue);
}
}
}
}
}
Save();
ActiveSliceSettings.OnSettingChanged(settingsKey);