diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index f4105d4e6..8669ddccd 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -90,7 +90,7 @@ namespace MatterHackers.MatterControl { private Dictionary> objectEditorsByType; - public ThemeConfig Theme { get; set; } = new ThemeConfig(); + public ThemeConfig Theme { get; set; } public RunningTasksConfig Tasks { get; set; } = new RunningTasksConfig(); @@ -689,6 +689,16 @@ namespace MatterHackers.MatterControl public ApplicationController() { + // Initialize the AppContext theme object which will sync its content with Agg ActiveTheme changes + this.Theme = new ThemeConfig(); + + ActiveTheme.ThemeChanged.RegisterEvent((s, e) => + { + this.Theme.RebuildTheme(ActiveTheme.Instance); + }, ref unregisterEvents); + + this.Theme.RebuildTheme(ActiveTheme.Instance); + Object3D.AssetsPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, "Assets"); ScrollBar.DefaultMargin = new BorderDouble(right: 1); diff --git a/ApplicationView/ThemeConfig.cs b/ApplicationView/ThemeConfig.cs index 2fb5e43de..bb722cc71 100644 --- a/ApplicationView/ThemeConfig.cs +++ b/ApplicationView/ThemeConfig.cs @@ -138,13 +138,11 @@ namespace MatterHackers.MatterControl public ThemeConfig() { - ActiveTheme.ThemeChanged.RegisterEvent((s, e) => RebuildTheme(), ref unregisterEvents); - RebuildTheme(); } - public void RebuildTheme() + public void RebuildTheme(IThemeColors colors) { - var colors = this.Colors = ActiveTheme.Instance; + this.Colors = colors; DefaultThumbView.ThumbColor = new Color(colors.PrimaryTextColor, 30);