blob: 9af18357f141661c7440014dea572ad0879ad1e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using MaterialDesignColors.WpfExample.Domain;
using MaterialDesignThemes.Wpf;
namespace MaterialDesignColors.WpfExample
{
public class PaletteSelectorViewModel
{
public PaletteSelectorViewModel()
{
Swatches = new SwatchesProvider().Swatches;
}
public ICommand ToggleBaseCommand { get; } = new AnotherCommandImplementation(o => ApplyBase((bool)o));
private static void ApplyBase(bool isDark)
{
new PaletteHelper().SetLightDark(isDark);
}
public IEnumerable<Swatch> Swatches { get; }
public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o));
private static void ApplyPrimary(Swatch swatch)
{
new PaletteHelper().ReplacePrimaryColor(swatch);
}
public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o));
private static void ApplyAccent(Swatch swatch)
{
new PaletteHelper().ReplaceAccentColor(swatch);
}
}
}
|