95 lines
2.1 KiB
C#
95 lines
2.1 KiB
C#
///
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
///
|
|
using System;
|
|
using System.Windows.Forms;
|
|
using log4net;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.ResultsWriters.Basic
|
|
{
|
|
public partial class WriterCfgCtrl : UserControl, IComponentCfgCtrl
|
|
{
|
|
static readonly ILog log = LogManager.GetLogger(typeof(WriterCfgCtrl));
|
|
|
|
public bool ShowMore { get { return false; } }
|
|
|
|
WriterCfg config;
|
|
public IComponentCfg Config
|
|
{
|
|
get { return config as IComponentCfg; }
|
|
set
|
|
{
|
|
config = value as WriterCfg;
|
|
Redraw();
|
|
}
|
|
}
|
|
|
|
public WriterCfgCtrl()
|
|
{
|
|
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;
|
|
destinationTextBox.Text = config.DestinationPath;
|
|
dayFoldersCheckBox.Checked = config.DayFolders;
|
|
}
|
|
|
|
public void Unlock()
|
|
{
|
|
nameTextBox.Enabled = true;
|
|
destinationTextBox.Enabled = true;
|
|
destinationButton.Enabled = true;
|
|
dayFoldersCheckBox.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; }
|
|
|
|
if (config.DestinationPath != destinationTextBox.Text)
|
|
{
|
|
config.DestinationPath = destinationTextBox.Text;
|
|
if (!config.DestinationPath.EndsWith("\\")) config.DestinationPath += "\\";
|
|
flags = CfgUpdateFlags.RestartRqrd;
|
|
}
|
|
|
|
if (dayFoldersCheckBox.Checked != config.DayFolders)
|
|
{
|
|
config.DayFolders = dayFoldersCheckBox.Checked;
|
|
flags = CfgUpdateFlags.RestartRqrd;
|
|
}
|
|
|
|
return flags;
|
|
}
|
|
|
|
private void destinationButton_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|