[Settings]React on OS theme change fix (#29944)

* [Settings] React on OS theme change fix

* Fix new OobeWindow call after merge
This commit is contained in:
Stefan Markovic
2023-11-23 18:19:57 +01:00
committed by GitHub
parent 5439f9499a
commit faea17b612
6 changed files with 52 additions and 78 deletions

View File

@@ -73,7 +73,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
loader.GetString("GeneralSettings_RunningAsUserText"),
ShellPage.IsElevated,
ShellPage.IsUserAnAdmin,
UpdateUIThemeMethod,
App.UpdateUIThemeMethod,
ShellPage.SendDefaultIPCMessage,
ShellPage.SendRestartAdminIPCMessage,
ShellPage.SendCheckForUpdatesIPCMessage,
@@ -89,31 +89,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
doRefreshBackupRestoreStatus(100);
}
public static int UpdateUIThemeMethod(string themeName)
{
switch (themeName?.ToUpperInvariant())
{
case "LIGHT":
// OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Light;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
break;
case "DARK":
// OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Dark;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
break;
case "SYSTEM":
// OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Default;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
break;
default:
Logger.LogError($"Unexpected theme name: {themeName}");
break;
}
App.HandleThemeChange();
return 0;
}
private void OpenColorsSettings_Click(object sender, RoutedEventArgs e)
{
try