From e0f66cd901c8a68f7eca95d698d9852f8d665d96 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 8 Jul 2016 07:28:00 -0700 Subject: [PATCH] Support for in-memory profile refresh without ActivePrinterChanged event - Issue MatterHackers/MCCentral#178 --- .../Settings/ActiveSliceSettings.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SlicerConfiguration/Settings/ActiveSliceSettings.cs b/SlicerConfiguration/Settings/ActiveSliceSettings.cs index f6f6fc4f4..37a460e12 100644 --- a/SlicerConfiguration/Settings/ActiveSliceSettings.cs +++ b/SlicerConfiguration/Settings/ActiveSliceSettings.cs @@ -80,6 +80,20 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } + public static void RefreshActiveInstance(SettingsProfile updatedProfile) + { + bool themeChanged = activeInstance.GetValue("active_theme_index") != updatedProfile.GetValue("active_theme_index"); + + activeInstance = updatedProfile; + + if (themeChanged) + { + SwitchToPrinterTheme(true); + } + + UiThread.RunOnIdle(ApplicationController.Instance.ReloadAdvancedControlsPanel); + } + /// /// Switches to the ActivePrinter theme without firing the ThemeChanged event. This is useful when changing printers and /// allows the theme state to be updated before the ActivePrinterChanged event fires, resulting in a single ReloadAll