I'm writing a Visual Studio extension in C# that I hope will change the color theme depending on the time of day (After sunset the dark theme will be applied - at sunrise either the blue/light theme will be applied depending on the users preference).
I'm able to change the color theme using the WriteableSettingsStore
exposed by a ShellSettingsManager
object. When I execute the following code, the theme changes after restarting Visual Studio.
var settingsManager = new ShellSettingsManager(this);
var writeableUserStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
writeableUserStore.SetString("General", "CurrentTheme", GuidList.guidDarkTheme);
What I'd prefer is to have the theme update automatically - I've tried making use of the UpdateWindow
and RedrawWindow
functions of the User32 API, but the window doesn't reload.
So the question is - How do I "redraw" Visual Studio after changing the CurrentTheme property in the registry?