/// /// Copyright (c) 2015-2020 Sensus Slovensko a.s. /// using System; using System.Windows.Forms; using Config.Entities; using TBF.BenchControl.Generic; namespace TBF.BenchControl.Output.DB.SensusOracle { public partial class DatabaseCfgCtrl : Configs.ConfigCtrlUtils, IComponentCfgCtrl { public bool ShowMore { get { return false; } } DatabaseCfg config; public IComponentCfg Config { get { return config as IComponentCfg; } set { config = value as DatabaseCfg; Redraw(); } } public DatabaseCfgCtrl() { InitializeComponent(); } private void WriterCfgCtrl_Load(object sender, EventArgs e) { 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; testModeCheckBox.Checked = config.TestMode; } public void Unlock() { nameTextBox.Enabled = true; testModeCheckBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) { return CfgUpdateFlags.None; } public CfgUpdateFlags UpdateCfg() { if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed CfgUpdateFlags flags = CfgUpdateFlags.None; if (config.Name != nameTextBox.Text) { config.Name = nameTextBox.Text; flags |= CfgUpdateFlags.RestartRqrd; } flags |= UpdateDifferent(ref config.TestMode, testModeCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd); return flags; } } }