1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Artemis/src/Artemis.UI/Screens/ProfileEditor/Dialogs/LayerBrushPresetViewModel.cs
Robert 60df649eb0 Brush presets - Reset properties to default before applying preset
Layer properties - Disable keyframes when resetting to default
Device dialogs - Only dim unselected LEDs if a LED is selected
Migrations - Renamed to stay in order 
Migrations - Added migration for color gradients
2021-04-06 20:56:18 +02:00

43 lines
1.2 KiB
C#

using System.Threading.Tasks;
using Artemis.Core.LayerBrushes;
using Artemis.UI.Shared.Services;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.Dialogs
{
public class LayerBrushPresetViewModel : DialogViewModelBase
{
private readonly BaseLayerBrush _layerBrush;
private ILayerBrushPreset _selectedPreset;
public LayerBrushPresetViewModel(BaseLayerBrush layerBrush)
{
_layerBrush = layerBrush;
Presets = new BindableCollection<ILayerBrushPreset>();
Presets.AddRange(layerBrush.Presets);
}
public BindableCollection<ILayerBrushPreset> Presets { get; }
public ILayerBrushPreset SelectedPreset
{
get => _selectedPreset;
set
{
SetAndNotify(ref _selectedPreset, value);
SelectPreset(value);
}
}
public void SelectPreset(ILayerBrushPreset preset)
{
_layerBrush.BaseProperties?.ResetAllLayerProperties();
preset.Apply();
Execute.OnUIThreadAsync(async () =>
{
await Task.Delay(250);
Session?.Close(true);
});
}
}
}