mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-10-08 06:26:45 +00:00
Add settings UI for theme and language (#780)
This commit is contained in:
@@ -113,6 +113,7 @@ function Set-WindowThemeResources {
|
||||
}
|
||||
|
||||
$Theme = if ($usesDarkMode) { 'Dark' } else { 'Light' }
|
||||
$window.Resources['AppUsesDarkMode'] = $usesDarkMode
|
||||
|
||||
foreach ($Group in $ThemeColor.GetEnumerator()) {
|
||||
foreach ($Resource in $Group.Value.GetEnumerator()) {
|
||||
@@ -130,12 +131,13 @@ function Set-WindowThemeResources {
|
||||
$window.Resources['AppIconFontFamily'] = [System.Windows.Media.FontFamily]::new($iconFontName)
|
||||
|
||||
# Load and merge shared styles
|
||||
if ($script:SharedStylesSchema -and (Test-Path $script:SharedStylesSchema)) {
|
||||
if (-not $window.Resources.Contains('AppSharedStylesLoaded') -and $script:SharedStylesSchema -and (Test-Path $script:SharedStylesSchema)) {
|
||||
$sharedXaml = Get-Content -Path $script:SharedStylesSchema -Raw
|
||||
$sharedReader = [System.Xml.XmlReader]::Create([System.IO.StringReader]::new($sharedXaml))
|
||||
try {
|
||||
$sharedDict = [System.Windows.Markup.XamlReader]::Load($sharedReader)
|
||||
$window.Resources.MergedDictionaries.Add($sharedDict)
|
||||
$window.Resources['AppSharedStylesLoaded'] = $true
|
||||
}
|
||||
finally {
|
||||
$sharedReader.Close()
|
||||
|
||||
Reference in New Issue
Block a user