2026-04-12 13:52:52 +08:00
|
|
|
namespace LanMountainDesktop.PluginSdk;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-05-06 16:02:55 +08:00
|
|
|
/// Provides the latest read-only appearance snapshot when host appearance values change.
|
2026-04-12 13:52:52 +08:00
|
|
|
/// </summary>
|
|
|
|
|
public sealed class AppearanceChangedEvent : EventArgs
|
|
|
|
|
{
|
|
|
|
|
public AppearanceChangedEvent(
|
|
|
|
|
PluginAppearanceSnapshot snapshot,
|
|
|
|
|
IReadOnlyCollection<AppearanceProperty> changedProperties)
|
|
|
|
|
{
|
|
|
|
|
ArgumentNullException.ThrowIfNull(snapshot);
|
|
|
|
|
ArgumentNullException.ThrowIfNull(changedProperties);
|
|
|
|
|
|
|
|
|
|
Snapshot = snapshot;
|
|
|
|
|
ChangedProperties = changedProperties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PluginAppearanceSnapshot Snapshot { get; }
|
|
|
|
|
|
|
|
|
|
public IReadOnlyCollection<AppearanceProperty> ChangedProperties { get; }
|
|
|
|
|
|
2026-05-06 16:02:55 +08:00
|
|
|
public bool CornerRadiusChanged => HasChanged(AppearanceProperty.CornerRadius);
|
|
|
|
|
|
|
|
|
|
public bool ThemeVariantChanged => HasChanged(AppearanceProperty.ThemeVariant);
|
|
|
|
|
|
|
|
|
|
public bool AccentColorChanged => HasChanged(AppearanceProperty.AccentColor);
|
|
|
|
|
|
|
|
|
|
public bool CornerRadiusStyleChanged => HasChanged(AppearanceProperty.CornerRadiusStyle);
|
|
|
|
|
|
|
|
|
|
public bool WallpaperChanged => HasChanged(AppearanceProperty.Wallpaper);
|
|
|
|
|
|
|
|
|
|
public bool SystemMaterialModeChanged => HasChanged(AppearanceProperty.SystemMaterialMode);
|
|
|
|
|
|
|
|
|
|
public bool ColorSourceChanged => HasChanged(AppearanceProperty.ColorSource);
|
|
|
|
|
|
|
|
|
|
public bool ColorRolesChanged => HasChanged(AppearanceProperty.ColorRoles);
|
|
|
|
|
|
|
|
|
|
public bool MaterialSurfacesChanged => HasChanged(AppearanceProperty.MaterialSurfaces);
|
|
|
|
|
|
|
|
|
|
public bool WallpaperSeedCandidatesChanged => HasChanged(AppearanceProperty.WallpaperSeedCandidates);
|
|
|
|
|
|
2026-04-12 13:52:52 +08:00
|
|
|
public bool HasChanged(AppearanceProperty property)
|
|
|
|
|
{
|
2026-05-06 16:02:55 +08:00
|
|
|
return ChangedProperties.Contains(AppearanceProperty.All) ||
|
|
|
|
|
ChangedProperties.Contains(property);
|
2026-04-12 13:52:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool HasAnyChanges => ChangedProperties.Count > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum AppearanceProperty
|
|
|
|
|
{
|
|
|
|
|
CornerRadius,
|
|
|
|
|
ThemeVariant,
|
|
|
|
|
AccentColor,
|
|
|
|
|
CornerRadiusStyle,
|
|
|
|
|
Wallpaper,
|
|
|
|
|
SystemMaterialMode,
|
2026-05-06 16:02:55 +08:00
|
|
|
ColorSource,
|
|
|
|
|
ColorRoles,
|
|
|
|
|
MaterialSurfaces,
|
|
|
|
|
WallpaperSeedCandidates,
|
2026-04-12 13:52:52 +08:00
|
|
|
All
|
|
|
|
|
}
|