using System;
namespace DesktopMagic.Api.Settings;
///
/// Represents a button control.
///
public class Button : Setting
{
///
/// Occurs when the button gets clicked.
///
public event Action? OnClick;
private string _value = string.Empty;
///
/// Gets or sets the text caption displayed in the element.
///
public string Value
{
get => _value;
set
{
if (_value != value)
{
_value = value;
ValueChanged();
}
}
}
///
/// Initializes a new instance of the class with the provided .
///
/// The text caption displayed in the control.
public Button(string value)
{
Value = value;
}
///
/// Triggers the event.
///
public void Click()
{
OnClick?.Invoke();
}
}