tbf/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfgCtrl.cs
Milan Hanajik 0160dc965d - RegulValve ADC Open/Close values calibration implemented
- 'More' button added to ComponentCfgCtrl-s
- Dataflow from ComponentParametersDlg to components: CfgChangeHandler
- Dataflow from components to ComponentParametersDlg: CmdResponseHandler
- Detection of parameter changes and appropriate MesssageBox display:
  1.warning message when component configuration change requires program restart
  2.confirmation message box when any configuration changes would be lost
2015-01-03 14:45:58 +01:00

69 lines
1.3 KiB
C#

using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
public bool ShowMore { get { return false; } }
TestMethodCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as TestMethodCfg;
Redraw();
}
}
public TestMethodCfgCtrl()
{
InitializeComponent();
}
private void EntryFormCfgCtrl_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;
}
public void Unlock()
{
nameTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
return flags;
}
}
}