using System.Collections.Generic; using Artemis.Core; namespace Artemis.UI.Shared.Services.ProfileEditor.Commands; /// /// Represents a profile editor command that can be used to apply adaption hints to a layer. /// public class ApplyAdaptionHints : IProfileEditorCommand { private readonly Layer _layer; private readonly List _devices; private readonly List _originalLeds; /// /// Creates a new instance of the class. /// public ApplyAdaptionHints(Layer layer, List devices) { _layer = layer; _devices = devices; _originalLeds = new List(_layer.Leds); } #region Implementation of IProfileEditorCommand /// public string DisplayName => "Apply adaption hints"; /// public void Execute() { _layer.ClearLeds(); _layer.Adapter.Adapt(_devices); } /// public void Undo() { _layer.ClearLeds(); _layer.AddLeds(_originalLeds); } #endregion }