using System; using System.Windows.Forms; using TBF.BenchControl.Generic; using TBF.Resources; namespace TBF.BenchControl.BenchId { public partial class ComponentCfgCtrl : UserControl, IComponentCfgCtrl { ComponentCfg config; public IComponentCfg Config { get { return config as IComponentCfg; } set { config = value as ComponentCfg; Redraw(); } } public ComponentCfgCtrl() { InitializeComponent(); } private void EntryFormCfgCtrl_Load(object sender, EventArgs e) { nameLabel.Text = Strings.Name; numberLabel.Text = Strings.Test_bench_number; Redraw(); } void Redraw() { if (config == null) return; /// Control was not loaded, settings were not changed classNameLabel.Text = config.Factory.ClassName; nameTextBox.Text = config.Name; numberTextBox.Text = config.TestBenchNr.ToString(); } public void Unlock() { nameTextBox.Enabled = true; numberTextBox.Enabled = true; } public CfgVerifyFlags VerifyCfg(ref string message) { CfgVerifyFlags flags = CfgVerifyFlags.None; return flags; } public void UpdateCfg() { if (config == null) return; /// Control was not loaded, settings were not changed config.Name = nameTextBox.Text; try { config.TestBenchNr = int.Parse(numberTextBox.Text); } catch { config.TestBenchNr = 1; } } } }