mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-05 07:46:15 +02:00
Added documentation to the DesktopMagicPluginAPI
This commit is contained in:
@@ -6,12 +6,21 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a button control.
|
||||
/// </summary>
|
||||
public class Button : Element
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when the button is 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;
|
||||
@@ -25,11 +34,18 @@ namespace DesktopMagicPluginAPI.Inputs
|
||||
}
|
||||
}
|
||||
|
||||
/// <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();
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a check box control.
|
||||
/// </summary>
|
||||
public class CheckBox : Element
|
||||
{
|
||||
private bool _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or set a value indicating whether the <see cref="CheckBox"/> is in the checked state.
|
||||
/// </summary>
|
||||
public bool Value
|
||||
{
|
||||
get => _value;
|
||||
@@ -17,6 +23,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckBox"/> class with the provided <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">A value indicating whether the <see cref="CheckBox"/> is in the checked state.</param>
|
||||
public CheckBox(bool value)
|
||||
{
|
||||
Value = value;
|
||||
|
||||
@@ -2,10 +2,19 @@
|
||||
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// The element base class
|
||||
/// </summary>
|
||||
public abstract class Element
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when the value has been changed
|
||||
/// </summary>
|
||||
public event Action OnValueChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the <see cref="OnValueChanged"/> event
|
||||
/// </summary>
|
||||
protected void ValueChanged()
|
||||
{
|
||||
OnValueChanged?.Invoke();
|
||||
|
||||
@@ -2,24 +2,43 @@
|
||||
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field)
|
||||
]
|
||||
/// <summary>
|
||||
/// Marks a Property as element.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ElementAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the element.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The order index of the element.
|
||||
/// </summary>
|
||||
public int OrderIndex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Marks a Property as element with the provided <paramref name="name"/> and <paramref name="orderIndex"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the element.</param>
|
||||
/// <param name="orderIndex">The order index of the element.</param>
|
||||
public ElementAttribute(string name = "", int orderIndex = 0)
|
||||
{
|
||||
Name = name;
|
||||
OrderIndex = orderIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a Property as element with the provided <paramref name="orderIndex"/>.
|
||||
/// </summary>
|
||||
/// <param name="orderIndex">The order index of the element.</param>
|
||||
public ElementAttribute(int orderIndex = 0)
|
||||
{
|
||||
OrderIndex = orderIndex;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ElementAttribute"/>
|
||||
public ElementAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,12 +2,26 @@
|
||||
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a up-down control.
|
||||
/// </summary>
|
||||
public class IntegerUpDown : Element
|
||||
{
|
||||
private int _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum value for the <see cref="IntegerUpDown"/> element.
|
||||
/// </summary>
|
||||
public int Maximum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum value for the <see cref="IntegerUpDown"/> element.
|
||||
/// </summary>
|
||||
public int Minimum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value assigned to the <see cref="IntegerUpDown"/> element.
|
||||
/// </summary>
|
||||
public int Value
|
||||
{
|
||||
get => _value;
|
||||
@@ -21,6 +35,13 @@ namespace DesktopMagicPluginAPI.Inputs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IntegerUpDown"/> class with the provided <paramref name="min"/> value, <paramref name="max"/> value and <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="min">The maximum value for the <see cref="IntegerUpDown"/> element.</param>
|
||||
/// <param name="max">The minimum value for the <see cref="IntegerUpDown"/> element.</param>
|
||||
/// <param name="value">The value assigned to the <see cref="IntegerUpDown"/> element.</param>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public IntegerUpDown(int min, int max, int value = 0)
|
||||
{
|
||||
if (min < 0)
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a label control.
|
||||
/// </summary>
|
||||
public class Label : Element
|
||||
{
|
||||
private string _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the text associated with this control.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get => _value;
|
||||
@@ -17,8 +23,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or set a value indicating whether the content of the <see cref="Label"/> is bold or not.
|
||||
/// </summary>
|
||||
public bool Bold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Label"/> class with the provided <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="bold"></param>
|
||||
public Label(string value, bool bold = false)
|
||||
{
|
||||
Value = value;
|
||||
|
||||
@@ -2,12 +2,26 @@
|
||||
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a slider control.
|
||||
/// </summary>
|
||||
public sealed class Slider : Element
|
||||
{
|
||||
private double _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum value for the <see cref="Slider"/> element.
|
||||
/// </summary>
|
||||
public double Maximum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum value for the <see cref="Slider"/> element.
|
||||
/// </summary>
|
||||
public double Minimum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value assigned to the <see cref="Slider"/> element.
|
||||
/// </summary>
|
||||
public double Value
|
||||
{
|
||||
get => _value;
|
||||
@@ -21,6 +35,12 @@ namespace DesktopMagicPluginAPI.Inputs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Slider"/> class with the provided <paramref name="min"/> value, <paramref name="max"/> value and <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="min">The maximum value for the <see cref="Slider"/> element.</param>
|
||||
/// <param name="max">The minimum value for the <see cref="Slider"/> element.</param>
|
||||
/// <param name="value">The value assigned to the <see cref="Slider"/> element.</param>
|
||||
public Slider(double min, double max, double value = 0)
|
||||
{
|
||||
if (min < 0)
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
namespace DesktopMagicPluginAPI.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a text box control.
|
||||
/// </summary>
|
||||
public class TextBox : Element
|
||||
{
|
||||
private string _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the text associated with this control.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get => _value;
|
||||
@@ -17,6 +23,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TextBox"/> class with the provided <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public TextBox(string value)
|
||||
{
|
||||
Value = value;
|
||||
|
||||
Reference in New Issue
Block a user