Files
ClientServerProject/软件系统客户端Wpf/Views/PaletteSelectorViewModel.cs

43 lines
1.2 KiB
C#

using MaterialDesignColors;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Wpf.Views
{
public class PaletteSelectorViewModel
{
public PaletteSelectorViewModel()
{
Swatches = new SwatchesProvider().Swatches;
}
public ICommand ToggleBaseCommand { get; } = new AnotherCommandImplementation(o => ApplyBase((bool)o));
public static void ApplyBase(bool isDark)
{
new PaletteHelper().SetLightDark(isDark);
}
public IEnumerable<Swatch> Swatches { get; }
public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o));
public static void ApplyPrimary(Swatch swatch)
{
new PaletteHelper().ReplacePrimaryColor(swatch);
}
public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o));
public static void ApplyAccent(Swatch swatch)
{
new PaletteHelper().ReplaceAccentColor(swatch);
}
}
}