Files
2025-07-14 12:03:59 +02:00

42 lines
1.1 KiB
C#

using System.Reflection;
using Inspectron.Settings.WindowsWizard.Interfaces;
namespace Inspectron.Settings.WindowsWizard.Controls
{
public partial class StringEditor : UserControl, ISetupItem
{
private PropertyInfo _prp;
private object _obj;
private bool _password;
public StringEditor()
{
InitializeComponent();
}
public bool Password
{
get { return _password; }
set
{
if (value) textBox1.PasswordChar = '*';
_password = value;
}
}
public void SetProperty(object obj, string propertyName)
{
_prp = PropHelper.GetPrp(obj, propertyName);
_obj = obj;
textBox1.Text = (string) _prp.GetValue(obj);
label1.Text = PropHelper.SplitCamelCase(propertyName);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (_obj == null) return;
_prp.SetValue(_obj, textBox1.Text);
}
}
}