Improved plugin settings support

This commit is contained in:
Stone-Red-Code
2021-07-14 22:43:01 +02:00
parent aaced7a569
commit 23a31ae5d0
133 changed files with 856 additions and 379 deletions
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DesktopMagicPluginAPI.Inputs
{
public class IntegerUpDown : Element
{
private int _value;
public int Maximum { get; }
public int Minimum { get; }
public int Value
{
get => _value;
set
{
if (_value != value)
{
_value = value;
ValueChanged();
}
}
}
public IntegerUpDown(int min, int max, int value = 0)
{
if (min < 0)
{
throw new ArgumentException("Value can not be negative!", nameof(min));
}
if (max < 0)
{
throw new ArgumentException("Value can not be negative!", nameof(max));
}
if (min > max)
{
throw new ArgumentException($"{nameof(min)} is greater than or equal to {nameof(max)}!");
}
if (value > max)
{
throw new ArgumentException($"{nameof(value)} is greater than {nameof(max)}!");
}
if (value < min)
{
throw new ArgumentException($"{nameof(value)} is less than {nameof(min)}!");
}
Minimum = min;
Maximum = max;
Value = value;
}
}
}