/// /// Copyright (c) 2017 Sensus Metering Systems /// using System; using System.Windows.Forms; using log4net; using TBF.BenchControl.Generic; namespace TBF.BenchControl.Network.Camera.Display { public partial class DisplayCfgCtrl : UserControl, IComponentCfgCtrl { static readonly ILog log = LogManager.GetLogger(typeof(DisplayCfgCtrl)); ComponentParametersDlg parent; public bool ShowMore { get { return false; } } DisplayCfg config; public IComponentCfg Config { get { return config as IComponentCfg; } set { config = value as DisplayCfg; Redraw(); } } public DisplayCfgCtrl() { InitializeComponent(); } private void PumpCfgCtrl_Load(object sender, EventArgs e) { parent = ParentForm as ComponentParametersDlg; if (parent == null) return; Redraw(); } public void Closing() { } void Redraw() { if (config == null) return; /// Control was not loaded, settings were not changed classNameLabel.Text = config.Factory.ClassName; nameTextBox.Text = config.Name; } public void Unlock() { nameTextBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) { CfgUpdateFlags flags = CfgUpdateFlags.None; return flags; } public CfgUpdateFlags UpdateCfg() { CfgUpdateFlags flags = CfgUpdateFlags.None; if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed if (config.Name != nameTextBox.Text) { config.Name = nameTextBox.Text; flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange); } return flags; } } }