DataEntryForm can be displayed in transition before a test (FixedStartStopMassCollAdvanced only), ver. 3.1.1473

This commit is contained in:
Milan Hanajik
2020-05-29 13:09:13 +02:00
parent 19b23ea212
commit 2c100c7150
29 changed files with 352 additions and 409 deletions
@@ -25,24 +25,9 @@ namespace TBF.BenchControl.DataContainers.Buoyancy
public double Buoyancy;
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
{
get { return calibCertificateNr; }
set { calibCertificateNr = value; }
}
public DateTime CalibDate
{
get { return calibDate; }
set { calibDate = value; }
}
public DateTime CalibValidDate
{
get { return calibValidDate; }
set { calibValidDate = value; }
}
public string CalibCertificateNr { get; set; }
public DateTime CalibDate { get; set; }
public DateTime CalibValidDate { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
@@ -26,24 +26,9 @@ namespace TBF.BenchControl.DataContainers.Density
public double AtTemperature;
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
{
get { return calibCertificateNr; }
set { calibCertificateNr = value; }
}
public DateTime CalibDate
{
get { return calibDate; }
set { calibDate = value; }
}
public DateTime CalibValidDate
{
get { return calibValidDate; }
set { calibValidDate = value; }
}
public string CalibCertificateNr { get; set; }
public DateTime CalibDate { get; set; }
public DateTime CalibValidDate { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Combined
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -125,7 +125,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -125,7 +125,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -112,7 +112,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Single
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -33,8 +33,9 @@ namespace TBF.BenchControl.DataEntry.Standard24
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmEndStateStr;
public string WMEndStateStr(int wmNr) { return (wmNr >= 0 && wmNr < wmEndStateStr.Length) ? wmEndStateStr[wmNr] : string.Empty; }
bool isConditionOp; /// true when the form is displayed inside transition sequence before a test
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
@@ -42,7 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
bool resultSaved; /// Set in Run() when results are saved
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
@@ -82,8 +83,9 @@ namespace TBF.BenchControl.DataEntry.Standard24
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
this.currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.isConditionOp = false;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
return this;
}
@@ -91,8 +93,9 @@ namespace TBF.BenchControl.DataEntry.Standard24
public IOperation ShowCycleEndFormOp(IList<Results.Entities.WaterMeter> waterMeters)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters;
this.currentOp = CurrentOp.ShowFormAtCycleEnd;
this.isConditionOp = false;
this.waterMeters = waterMeters;
return this;
}
@@ -100,16 +103,18 @@ namespace TBF.BenchControl.DataEntry.Standard24
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
this.regReaders = regReaders;
this.currentOp = CurrentOp.EnterTestStartStates;
this.isConditionOp = false;
this.regReaders = regReaders;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters)
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isConditionOp = false)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterAdvancedTestStartStates;
this.currentOp = CurrentOp.EnterAdvancedTestStartStates;
this.isConditionOp = isConditionOp;
this.regReaders = regReaders;
this.waterMeters = waterMeters;
return this;
@@ -119,8 +124,9 @@ namespace TBF.BenchControl.DataEntry.Standard24
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.regReaders = regReaders;
this.currentOp = CurrentOp.EnterTestEndStates;
this.isConditionOp = false;
this.regReaders = regReaders;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
@@ -203,7 +209,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
return isConditionOp ? Event.ConditionNotMet : Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
@@ -277,7 +283,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
return isConditionOp ? Event.ConditionMet : Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -103,7 +103,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -157,7 +157,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -33,7 +33,7 @@ namespace TBF.BenchControl.GenericDevices
/// Displays form at the beginning of the test to enter water meter start start.
/// </summary>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<WaterMeter> waterMeters);
IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<WaterMeter> waterMeters, bool isCondOp = false);
/// <summary>
/// Displays form at the end of the test to enter water meter start start.
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters) { return null; }
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
@@ -5,10 +5,12 @@ using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.Compound
{
public class Component : ComponentBase, GenericDevices.ITestMethod
public class Component : ComponentBase, GenericDevices.ITestMethod, ISequenceCondition
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
@@ -23,17 +25,32 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.Compound
return FixedStartMassCollAdvancedSeq.CheckDeviceCaps(test, devices, out message);
}
readonly TestMethodCfg testMethodCfg;
public Component() { }
///
public Component(Generic.IComponentCfg cfg)
: base(cfg)
public Component(Generic.IComponentCfg cfg) : base(cfg)
{
log.Debug(this.ToString());
testMethodCfg = cfg as TestMethodCfg;
log.Debug(this.ToString());
}
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel);
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, !testMethodCfg.DataEntryInTransBefore, true, null, DebugLevel);
}
}
public int ConditionsCount { get { return 1; } }
public string ConditionName(int i) { return (i == 0) ? "Data Entry Form" : string.Empty; }
public IOperation ConditionOp(int i)
{
GenericDevices.IHasWMStatesForm wmStatesForm =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if ((i == 0) && (wmStatesForm != null))
{
return wmStatesForm.ShowAdvancedTestStartFormOp(ProcessData.RegisterReaders, ProcessData.BatchRslts.Batch.WaterMeters, true);
}
return null;
}
}
}
@@ -3,7 +3,6 @@
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.Compound
{
@@ -75,7 +75,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
bool compound,
bool showDataEntryBeforeTest, bool compound,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel)
{
@@ -337,18 +337,22 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).StartImages = startImages;
}
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowAdvancedTestStartFormOp(sensPath.RegisterReaders, BatchRslts.Batch.WaterMeters))
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ModelessFormClosed));
if (showDataEntryBeforeTest)
{
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowAdvancedTestStartFormOp(sensPath.RegisterReaders, BatchRslts.Batch.WaterMeters, false))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ModelessFormClosed));
}
if (heatMetersTestParams != null)
{
@@ -5,10 +5,12 @@ using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.HeatMeters
{
public class Component : ComponentBase, GenericDevices.ITestMethod
public class Component : ComponentBase, GenericDevices.ITestMethod, ISequenceCondition
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
@@ -25,11 +27,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.HeatMeters
readonly TestMethodCfg testMethodCfg;
public Component() { }
///
public Component(Generic.IComponentCfg cfg)
: base(cfg)
public Component(Generic.IComponentCfg cfg) : base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
log.Debug(this.ToString());
@@ -37,7 +36,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.HeatMeters
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel);
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, !testMethodCfg.DataEntryInTransBefore, false, testMethodCfg.TestParams, DebugLevel);
}
}
public int ConditionsCount { get { return 1; } }
public string ConditionName(int i) { return (i == 0) ? "Data Entry Form" : string.Empty; }
public IOperation ConditionOp(int i)
{
GenericDevices.IHasWMStatesForm wmStatesForm =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if ((i == 0) && (wmStatesForm != null))
{
return wmStatesForm.ShowAdvancedTestStartFormOp(ProcessData.RegisterReaders, ProcessData.BatchRslts.Batch.WaterMeters, true);
}
return null;
}
}
}
@@ -3,47 +3,129 @@
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.HeatMeters
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
/// <summary>
/// Holds backup and security options - serializable configuration.
/// </summary>
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
/// <summary> Test parameters </summary>
[XmlIgnore]
public TestParams TestParams;
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
/// <summary> Test parameters </summary>
[XmlIgnore]
public TestParams TestParams;
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(true); }
public override IParamsProvider GetUITestParamsProvider(Test test)
{
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
TestParams = new TestParams(true);
}
public TestMethodCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
}
///
/// Serialized parameters
///
public bool DataEntryInTransBefore;
public string ToString(int i)
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() { }
public TestMethodCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
DataEntryInTransBefore = false;
}
string[] paramNames = new string[]
{
return string.Format("Name={0}", Name);
}
}
"Data entry form is displayed in transition before test",
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public string ToString(int i)
{
if (i == -1)
{
return string.Format("{0}: DataEntryInTransitionBefore = {1}", Name, DataEntryInTransBefore);
}
switch (i)
{
case 0: return DataEntryInTransBefore ? Strings.yes : Strings.no;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: DataEntryInTransBefore = (strValue == Strings.yes); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
/// Real number between 0.8 and 1.2 expected
if (strValue == Strings.yes || strValue == Strings.no) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(TestMethodCfg prms)
{
prms.DataEntryInTransBefore = this.DataEntryInTransBefore;
}
public Config.Entities.IParamsProvider Clone()
{
TestMethodCfg pars = new TestMethodCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}
@@ -1,69 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.HeatMeters
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
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.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;
return flags;
}
}
}
@@ -1,86 +0,0 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.HeatMeters
{
partial class TestMethodCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// BasicPrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "BasicPrinterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -5,10 +5,12 @@ using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.Single
{
public class Component : ComponentBase, GenericDevices.ITestMethod
public class Component : ComponentBase, GenericDevices.ITestMethod, ISequenceCondition
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString()
@@ -23,17 +25,32 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.Single
return FixedStartMassCollAdvancedSeq.CheckDeviceCaps(test, devices, out message);
}
readonly TestMethodCfg testMethodCfg;
public Component() { }
///
public Component(Generic.IComponentCfg cfg)
: base(cfg)
public Component(Generic.IComponentCfg cfg) : base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
log.Debug(this.ToString());
}
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel);
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, !testMethodCfg.DataEntryInTransBefore, false, null, DebugLevel);
}
}
public int ConditionsCount { get { return 1; } }
public string ConditionName(int i) { return (i == 0) ? "Data Entry Form" : string.Empty; }
public IOperation ConditionOp(int i)
{
GenericDevices.IHasWMStatesForm wmStatesForm =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if ((i == 0) && (wmStatesForm != null))
{
return wmStatesForm.ShowAdvancedTestStartFormOp(ProcessData.RegisterReaders, ProcessData.BatchRslts.Batch.WaterMeters, true);
}
return null;
}
}
}
@@ -3,7 +3,6 @@
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs.NameOnly;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced.Single
{
@@ -0,0 +1,119 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
{
/// <summary>
/// Holds backup and security options - serializable configuration.
/// </summary>
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
///
/// Serialized parameters
///
public bool DataEntryInTransBefore;
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg() {}
public TestMethodCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
DataEntryInTransBefore = false;
}
string[] paramNames = new string[]
{
"Data entry form is displayed in transition before test",
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public string ToString(int i)
{
if (i == -1)
{
return string.Format("{0}: DataEntryInTransitionBefore = {1}", Name, DataEntryInTransBefore);
}
switch (i)
{
case 0: return DataEntryInTransBefore ? Strings.yes : Strings.no;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: DataEntryInTransBefore = (strValue == Strings.yes); return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
/// Real number between 0.8 and 1.2 expected
if (strValue == Strings.yes || strValue == Strings.no) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(TestMethodCfg prms)
{
prms.DataEntryInTransBefore = this.DataEntryInTransBefore;
}
public Config.Entities.IParamsProvider Clone()
{
TestMethodCfg pars = new TestMethodCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}