Creating a new printer maintains the current color

- The color is also set as the printer's active theme
This commit is contained in:
Matt Moening 2016-10-18 11:19:04 -07:00
parent eba3ef5fc2
commit a23b66e966
3 changed files with 11 additions and 26 deletions

View file

@ -124,26 +124,22 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
if (ActiveSliceSettings.Instance.PrinterSelected)
{
//Attempt to load userSetting theme as default
string activeThemeName = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
if(string.IsNullOrEmpty(activeThemeName))
{
activeThemeName = "Blue - Light";
}
if (ActiveSliceSettings.Instance.Contains(SettingsKey.active_theme_name))
{
activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
string activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
if (!doReloadEvent)
{
ActiveTheme.SuspendEvents();
}
ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);
ActiveTheme.ResumeEvents();
}
else
{
//If the active printer has no theme we set it to the default so that it does not suddenly change colors later when another printer's color is changed
ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, activeThemeName);
//If the active printer has no theme we set it to the current theme color
ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, ActiveTheme.Instance.Name);
}
ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);
ActiveTheme.ResumeEvents();
}
}
}