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

@ -452,25 +452,15 @@ namespace MatterHackers.MatterControl
static void LoadUITheme()
{
if (string.IsNullOrEmpty(UserSettings.Instance.get(UserSettingsKey.ActiveThemeName)))
string oemColor = OemSettings.Instance.ThemeColor;
if (string.IsNullOrEmpty(oemColor))
{
string oemColor = OemSettings.Instance.ThemeColor;
if (string.IsNullOrEmpty(oemColor))
{
string mCDefaultColor = "Blue - Light";
ActiveTheme.Instance = ActiveTheme.GetThemeColors(mCDefaultColor);
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, mCDefaultColor);
}
else
{
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, oemColor);
ActiveTheme.Instance = ActiveTheme.GetThemeColors(oemColor);
}
ActiveTheme.Instance = ActiveTheme.GetThemeColors("Blue - Light");
}
else
{
string name = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
ActiveTheme.Instance = ActiveTheme.GetThemeColors(name);
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, oemColor);
ActiveTheme.Instance = ActiveTheme.GetThemeColors(oemColor);
}
}

View file

@ -91,7 +91,6 @@ namespace MatterHackers.MatterControl
// save it for this printer
ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, themeName);
//Set new user selected Default
UserSettings.Instance.set(UserSettingsKey.ActiveThemeName, themeName);
ActiveTheme.Instance = ActiveTheme.GetThemeColors(themeName);
};

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();
}
}
}