/// <summary> /// Creates a new object with the specified get and set minimum and maximum value delegate functions and optional intial value. /// </summary> /// <param name="getMinFunc">The get minimum delegate.</param> /// <param name="setMinFunc">The set minimum delegate.</param> /// <param name="getMaxFunc">The get maximum delegate.</param> /// <param name="setMaxFunc">The set maximum delegate.</param> /// <param name="value">The optional initial value.</param> /// <remarks></remarks> public LoadBarPropertyHandler(GetMinimumValue getMinFunc, SetMinimumValue setMinFunc, GetMaximumValue getMaxFunc, SetMaximumValue setMaxFunc, double value = 0d) { setMax = setMaxFunc; getMax = getMaxFunc; setMin = setMinFunc; getMin = getMinFunc; this.value = value; }
/// <summary> /// Creates a new object with the specified minimum, maximum and initial values. /// </summary> /// <param name="minVal">Minimum value.</param> /// <param name="maxVal">Maximum value.</param> /// <param name="value">Default value.</param> /// <remarks></remarks> public LoadBarPropertyHandler(double minVal, double maxVal, double value) { getMin = new GetMinimumValue(() => min); getMax = new GetMaximumValue(() => max); setMin = new SetMinimumValue((v) => min = v); setMax = new SetMaximumValue((v) => max = v); MinValue = minVal; MaxValue = maxVal; if (value < minVal || value > maxVal) { throw new ArgumentOutOfRangeException("Value cannot be less than minVal or greater than maxVal"); } this.value = value; }