mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 00:54:26 +08:00
settings_re5
This commit is contained in:
@@ -13,6 +13,7 @@ using FluentAvalonia.UI.Controls;
|
||||
using LanMountainDesktop.Models;
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.Services;
|
||||
using LanMountainDesktop.Theme;
|
||||
using LanMountainDesktop.Views.Components;
|
||||
|
||||
namespace LanMountainDesktop.Views;
|
||||
@@ -193,6 +194,30 @@ public partial class MainWindow
|
||||
return false;
|
||||
}
|
||||
|
||||
private ThemeColorContext BuildAdaptiveThemeContext()
|
||||
{
|
||||
return new ThemeColorContext(
|
||||
_selectedThemeColor,
|
||||
IsLightBackground: !_isNightMode,
|
||||
IsLightNavBackground: !_isNightMode,
|
||||
IsNightMode: _isNightMode);
|
||||
}
|
||||
|
||||
private void ApplyAdaptiveThemeResources()
|
||||
{
|
||||
var context = BuildAdaptiveThemeContext();
|
||||
ThemeColorSystemService.ApplyThemeResources(Resources, context);
|
||||
GlassEffectService.ApplyGlassResources(Resources, context);
|
||||
|
||||
if (Application.Current?.Resources is { } applicationResources)
|
||||
{
|
||||
ThemeColorSystemService.ApplyThemeResources(applicationResources, context);
|
||||
GlassEffectService.ApplyGlassResources(applicationResources, context);
|
||||
}
|
||||
|
||||
_defaultDesktopBackground = GetThemeBrush("AdaptiveSurfaceBaseBrush");
|
||||
}
|
||||
|
||||
private void TryRestoreWallpaper(string? savedWallpaperPath)
|
||||
{
|
||||
_wallpaperPath = string.IsNullOrWhiteSpace(savedWallpaperPath) ? null : savedWallpaperPath;
|
||||
@@ -285,6 +310,9 @@ public partial class MainWindow
|
||||
Application.Current.RequestedThemeVariant = requestedThemeVariant;
|
||||
}
|
||||
|
||||
ApplyAdaptiveThemeResources();
|
||||
ApplyWallpaperBrush();
|
||||
|
||||
if (!refreshPalettes)
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user