/// /// Copyright (c) 2020 Sensus Slovensko a.s. /// using System; using System.Windows.Forms; using Config.Entities; using TBF.BenchControl.Generic; using TBF.Resources; namespace TBF.BenchControl.DataEntry.S620 { public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl { public bool ShowMore { get { return false; } } EntryFormCfg config; public IComponentCfg Config { get { return config as IComponentCfg; } set { config = value as EntryFormCfg; Redraw(); } } public EntryFormCfgCtrl() { InitializeComponent(); } private void EntryFormCfgCtrl_Load(object sender, EventArgs e) { Localize(); Redraw(); } void Localize() { skipFailedMetersCheckBox.Text = "Preskočiť zlé vodomery pri skenovaní"; productionTracingCheckBox.Text = "Sledovanie výroby"; } 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; skipFailedMetersCheckBox.Checked = config.SkipFailedMeters; productionTracingCheckBox.Checked = config.ProductionTracing; } public void Unlock() { nameTextBox.Enabled = true; skipFailedMetersCheckBox.Enabled = true; productionTracingCheckBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) { CfgUpdateFlags flags = CfgUpdateFlags.None; return flags; } public CfgUpdateFlags UpdateCfg() { CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed config.Name = nameTextBox.Text; config.SkipFailedMeters = skipFailedMetersCheckBox.Checked; config.ProductionTracing = productionTracingCheckBox.Checked; return flags; } } }