Refactor step 1

This commit is contained in:
Stone_Red
2023-11-19 16:19:07 +01:00
parent 3eae8bcdfc
commit 74bf7c2fb8
30 changed files with 595 additions and 412 deletions
@@ -0,0 +1,49 @@
using System;
namespace DesktopMagicPluginAPI.Settings;
/// <summary>
/// Represents a button control.
/// </summary>
public class Button : Setting
{
/// <summary>
/// Occurs when the button gets clicked.
/// </summary>
public event Action OnClick;
private string _value;
/// <summary>
/// Gets or sets the text caption displayed in the <see cref="Button"/> element.
/// </summary>
public string Value
{
get => _value;
set
{
if (_value != value)
{
_value = value;
ValueChanged();
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="Button"/> class with the provided <paramref name="value"/>.
/// </summary>
/// <param name="value">The text caption displayed in the <see cref="Button"/> control.</param>
public Button(string value)
{
Value = value;
}
/// <summary>
/// Triggers the <see cref="OnClick"/> event.
/// </summary>
public void Click()
{
OnClick?.Invoke();
}
}