From a4367fb29faf7ee987b937e2397359a6020f25b9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Sat, 30 Oct 2021 19:38:50 +0200 Subject: update readme --- Samples/common/src/MyNumericControl.cs | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Samples/common/src/MyNumericControl.cs (limited to 'Samples/common/src/MyNumericControl.cs') diff --git a/Samples/common/src/MyNumericControl.cs b/Samples/common/src/MyNumericControl.cs new file mode 100644 index 00000000..38e162a3 --- /dev/null +++ b/Samples/common/src/MyNumericControl.cs @@ -0,0 +1,46 @@ +//Tutorial +using Crow; + +namespace MyNumericControl { + public class MyNumericControl : TemplatedControl { + protected double actualValue, minValue, maxValue; + public double Minimum { + get => minValue; + set { + if (minValue == value) + return; + minValue = value; + if (Value < minValue) + Value = minValue; + NotifyValueChangedAuto (minValue); + } + } + public double Maximum { + get => maxValue; + set { + if (maxValue == value) + return; + maxValue = value; + NotifyValueChangedAuto (maxValue); + + if (Value > maxValue) + Value = maxValue; + + } + } + public virtual double Value { + get => actualValue; + set { + if (actualValue == value) + return; + if (value < minValue) + actualValue = minValue; + else if (value > maxValue) + actualValue = maxValue; + else + actualValue = value; + NotifyValueChangedAuto (actualValue); + } + } + } +} \ No newline at end of file -- cgit v1.3.1-4-g156e