using System.Reflection; using Inspectron.Settings.WindowsWizard.Interfaces; namespace Inspectron.Settings.WindowsWizard.Controls { public partial class NumberEditor : UserControl, ISetupItem { private PropertyInfo _prp; private object _obj; private int _number; public NumberEditor() { InitializeComponent(); } public int Number { get { return _number; } set { if (_obj == null) return; _number = value; _prp.SetValue(_obj, value); } } public int Min { get => (int)numericUpDown1.Minimum; set => numericUpDown1.Minimum = value; } public int Max { get => (int) numericUpDown1.Maximum; set => numericUpDown1.Maximum = value; } public void SetProperty(object obj, string propertyName) { label1.Text = PropHelper.SplitCamelCase(propertyName); _prp = PropHelper.GetPrp(obj, propertyName); _obj = obj; numericUpDown1.Value =_number = ((int)_prp.GetValue(obj)