// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using System.Drawing;
using CUE.NET.Helper;
namespace CUE.NET.Devices.Generic
{
///
/// Represents a single LED of a CUE-device.
///
public class CorsairLed
{
#region Properties & Fields
///
/// Indicates whether the LED has changed an internal state.
///
public bool IsDirty => RequestedColor != _color;
///
/// Indicate whether the Color of the LED was set since the last update.
///
public bool IsUpdated { get; private set; }
///
/// Gets the Color the LED should be set to on the next update.
///
public Color RequestedColor { get; private set; } = Color.Transparent;
private Color _color = Color.Transparent;
///
/// Gets the current color of the LED. Sets the for the next update and mark the LED as .
///
public Color Color
{
get { return _color; }
set
{
if (!IsLocked)
{
RequestedColor = RequestedColor.Blend(value);
IsUpdated = true;
}
}
}
///
/// Gets or sets if the color of this LED can be changed.
///
public bool IsLocked { get; set; } = false;
#endregion
#region Constructors
internal CorsairLed() { }
#endregion
#region Methods
///
/// Updates the LED to the requested color.
///
internal void Update()
{
_color = RequestedColor;
IsUpdated = false;
}
///
/// Resets the LED back to default
///
internal void Reset()
{
_color = Color.Transparent;
RequestedColor = Color.Transparent;
IsUpdated = false;
IsLocked = false;
}
#endregion
}
}