Compare commits

..
Author SHA1 Message Date
Milan Hanajik 28a1132bf9 Reconfigured for iPerl 2019-01-11 18:05:25 +01:00
197 changed files with 4020 additions and 27167 deletions
-8
View File
@@ -25,14 +25,6 @@ namespace Config.Entities
Count
}
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState
{
Disabled,
+16 -50
View File
@@ -25,8 +25,8 @@ namespace Config.Entities
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
@@ -310,88 +310,54 @@ namespace Config.Entities
return null;
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
public virtual float GetErrLimLo(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimLo; /// Error limit of a water meter
return ErrLimLo; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual double GetErrLimHi(double volumeCTV, double testTime)
public virtual float GetErrLimHi(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimHi; /// Error limit of a water meter
return ErrLimHi; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual bool IsPartCompatible(int waterMeterPartNr)
{
if ((this.Part == 0) || (waterMeterPartNr == 0)) return true;
if ((this.Part % 10) == waterMeterPartNr) return true;
if (((this.Part / 10) % 10) == waterMeterPartNr) return true;
if (((this.Part / 100) % 10) == waterMeterPartNr) return true;
if (((this.Part / 1000) % 10) == waterMeterPartNr) return true;
return false;
}
/// <summary>
/// Determines whether tests part number is OK.
/// Examples of correct part number are:
/// 1, 2, 12, 21 in case of max. part nr.== 2
/// 1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234 in case of max. part nr.== 4
/// </summary>
/// <param name="partNr">Tests par tnumber</param>
/// <returns>true when Part number is OK</returns>
public static bool IsGoodPartNr(int partNr)
{
bool firstDigitIsOK = ((partNr % 10) > 0) && ((partNr % 10) <= Config.Data.MaxPartNr);
bool secondDigitIsOK = (((partNr/10) % 10) > 0) && (((partNr/10) % 10) <= Config.Data.MaxPartNr);
bool thirdDigitIsOK = (((partNr/100) % 10) > 0) && (((partNr/100) % 10) <= Config.Data.MaxPartNr);
bool fourthDigitIsOK = (((partNr/1000) % 10) > 0) && (((partNr/1000) % 10) <= Config.Data.MaxPartNr);
if (firstDigitIsOK && (partNr / 10 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && (partNr / 100 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && (partNr / 1000 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && fourthDigitIsOK && (partNr / 10000 == 0)) return true;
return false;
}
public override string ToString()
{
+2 -56
View File
@@ -1,10 +1,7 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -40,56 +37,5 @@ namespace Config.Entities
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
foreach (var step in TransitionSteps) { step.Export(output); }
output.WriteLine();
output.Close();
}
public static TransitionSequence Import(StreamReader input)
{
TransitionSequence result = new TransitionSequence();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
while (true)
{
TransitionStep step = TransitionStep.Import(input, result);
if (step == null)
break;
else
result.TransitionSteps.Add(step);
}
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
ln = inp.ReadLine(); /// skip ItemNr
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
//foreach (var step in TransitionSteps)
//{
// string testDiff = step.Compare(inp);
// if (testDiff.Contains(
//}
return diff.ToString();
}
}
}
}
+1 -62
View File
@@ -1,10 +1,8 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015, 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -63,64 +61,5 @@ namespace Config.Entities
result += indent + "PumpsWithFMPct = " + PumpWithFMPcts + Environment.NewLine;
return result;
}
public virtual void Export(StreamWriter output)
{
CultureInfo ci = CultureInfo.InvariantCulture;
output.WriteLine(ItemNr.ToString(ci));
output.WriteLine(Duration.ToString(ci));
output.WriteLine(Message);
output.WriteLine(EndCondition);
output.WriteLine(ValvesOpen);
output.WriteLine(ValvesClose);
output.WriteLine(RegulValvesPct);
output.WriteLine(PumpWithFMPcts);
}
public static TransitionStep Import(StreamReader input, TransitionSequence newSequence)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine))
{
return null;
}
CultureInfo ci = CultureInfo.InvariantCulture;
int itemNr = int.Parse(firstLine, ci);
TransitionStep tst = new TransitionStep(itemNr, newSequence);
tst.Duration = int.Parse(input.ReadLine(), ci);
tst.Message = input.ReadLine();
tst.EndCondition = input.ReadLine();
tst.ValvesOpen = input.ReadLine();
tst.ValvesClose = input.ReadLine();
tst.RegulValvesPct = input.ReadLine();
tst.PumpWithFMPcts = input.ReadLine();
return tst;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
string fmt = string.Format("Step {0} : ", ItemNr) + "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
CultureInfo ci = CultureInfo.InvariantCulture;
string firstLine = inp.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return string.Format("TransitionStep {0} is missing in the compared file\r\n", ItemNr);
if (ItemNr.ToString() != firstLine) { diff.AppendFormat(fmt, "ItemNr", ItemNr, firstLine); };
ln = inp.ReadLine(); if (ln != Duration.ToString(ci)) { diff.AppendFormat(fmt, "Duration", Duration.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Message) { diff.AppendFormat(fmt, "Message", Message, ln); };
ln = inp.ReadLine(); if (ln != EndCondition) { diff.AppendFormat(fmt, "EndCondition", EndCondition, ln); };
ln = inp.ReadLine(); if (ln != ValvesOpen) { diff.AppendFormat(fmt, "ValvesOpen", ValvesOpen, ln); };
ln = inp.ReadLine(); if (ln != ValvesClose) { diff.AppendFormat(fmt, "ValvesClose", ValvesClose, ln); };
ln = inp.ReadLine(); if (ln != RegulValvesPct) { diff.AppendFormat(fmt, "RegulValvesPct", RegulValvesPct, ln); };
ln = inp.ReadLine(); if (ln != PumpWithFMPcts) { diff.AppendFormat(fmt, "PumpWithFMPcts", PumpWithFMPcts, ln); };
return diff.ToString();
}
}
}
+1 -21
View File
@@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
namespace Config.Entities
{
@@ -36,24 +35,5 @@ namespace Config.Entities
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
/// TODO
}
public static VirtualBenchSequence Import(StreamReader input)
{
VirtualBenchSequence result = new VirtualBenchSequence();
/// TODO
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
/// TODO
return diff.ToString();
}
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1122.0")]
[assembly: AssemblyFileVersion("2.18.1122.0")]
[assembly: AssemblyVersion("2.18.1102.0")]
[assembly: AssemblyFileVersion("2.18.1102.0")]
+3 -45
View File
@@ -276,14 +276,7 @@ namespace DeviceTest
radioButton3.Text = "SelectTank 3";
radioButton4.Text = "SelectTank -";
}
else if (className == "Modbus.QuidoRS")
{
radioButton1.Text = "Close relay 1";
radioButton2.Text = "Close relay 2";
radioButton3.Text = "Close relay 3";
radioButton4.Text = "Open all relays";
}
else radioButton1.Text = "spare";
else radioButton1.Text = "spare";
}
///
void UpdateOperations2(string className)
@@ -303,14 +296,7 @@ namespace DeviceTest
radioButton23.Text = "SelectTank 3";
radioButton24.Text = "SelectTank -";
}
else if (className == "Modbus.QuidoRS")
{
radioButton21.Text = "Close relay 1";
radioButton22.Text = "Close relay 2";
radioButton23.Text = "Close relay 3";
radioButton24.Text = "Open all relays";
}
else radioButton21.Text = "spare";
else radioButton21.Text = "spare";
}
///
void UpdateOperations3(string className)
@@ -330,14 +316,7 @@ namespace DeviceTest
radioButton33.Text = "SelectTank 3";
radioButton34.Text = "SelectTank -";
}
else if (className == "Modbus.QuidoRS")
{
radioButton31.Text = "Close relay 1";
radioButton32.Text = "Close relay 2";
radioButton33.Text = "Close relay 3";
radioButton34.Text = "Open all relays";
}
else radioButton31.Text = "spare";
else radioButton31.Text = "spare";
}
@@ -693,13 +672,6 @@ namespace DeviceTest
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation1 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation2 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation3 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation4 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -732,13 +704,6 @@ namespace DeviceTest
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation21 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation22 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation23 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation24 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -771,13 +736,6 @@ namespace DeviceTest
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
int time = 0;
+1 -1
View File
@@ -96,7 +96,7 @@ namespace Results
{
if (d.WaterMeters[i] == null) continue;
if (!t.IsPartCompatible(waterMeterParts[i])) continue;
if (t.Part != 0 && waterMeterParts[i] != 0 && t.Part != waterMeterParts[i]) continue;
///
/// Create empty watermeter test results and add them to the list and to dictionaries
+2 -2
View File
@@ -20,8 +20,8 @@ namespace Results.Entities
public virtual double TargetVolume { get; set; } /// [l] target test volume
public virtual double TargetTime { get; set; } /// [s] target test time
public virtual string Method { get; set; }
public virtual double ErrLimLo { get; set; } /// [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual double ErrLimHi { get; set; } /// [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual double ErrLimLo { get; set; } /// [%] (usually < 0)
public virtual double ErrLimHi { get; set; } /// [%] (usually > 0)
public virtual double Uncertainty { get; set; } /// [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; }
+2 -14
View File
@@ -148,7 +148,7 @@ namespace Results.Entities
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi);
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
@@ -172,7 +172,7 @@ namespace Results.Entities
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi);
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
@@ -319,18 +319,6 @@ namespace Results.Entities
#endif
}
public virtual bool IsPartCompatible(int waterMeterPartNr)
{
if ((this.Part == 0) || (waterMeterPartNr == 0)) return true;
if ((this.Part % 10) == waterMeterPartNr) return true;
if (((this.Part / 10) % 10) == waterMeterPartNr) return true;
if (((this.Part / 100) % 10) == waterMeterPartNr) return true;
if (((this.Part / 1000) % 10) == waterMeterPartNr) return true;
return false;
}
public override string ToString()
{
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
+7 -53
View File
@@ -41,8 +41,8 @@ namespace Results.Entities
public class WaterMeter
{
public virtual int Id { get; protected set; }
public virtual string SerialNr { get; set; } /// S/N _or_ S/N of the main meter of a compound meter _or_ PCB Number of an iPerl water meter
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ a complete assigned S/N of an iPerl water meter
public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter
public virtual string SerialNrAux { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual string PurchaseOrder { get; set; }
public virtual int YearOfProduction { get; set; }
public virtual int WMPosition { get; set; }
@@ -57,6 +57,7 @@ namespace Results.Entities
public virtual string Remark { get; set; }
#if IPERL
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
@@ -72,29 +73,9 @@ namespace Results.Entities
public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test
public virtual string FWVersion { get; set; }
#endif
#if TURA_SPECIAL
/// <summary>
/// Data from a production test bench (in case of tests on iPerl special)
/// </summary>
public virtual int AssignedSerialNr { get; set; }
public virtual string CompleteSerialNr { get; set; }
public virtual string RadioAddress { get; set; }
public virtual int PaletteNr { get; set; }
public virtual int UmkartonNr { get; set; }
public virtual string ProdTestBench { get; set; }
public virtual int ProdWMPosition { get; set; }
public virtual string ProdUserName { get; set; }
public virtual string ProdPurchaseOrder { get; set; }
public virtual bool ProdPassed { get; set; }
public virtual int ProdResultCode { get; set; }
public virtual int ProdQ2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
public virtual int ProdQ2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
#endif
#if ORACLE_DB
public virtual int Pruefindex { get; set; } /// Not mapped to DB !!! 0=unknown (saving to Oracle failed), >=1 ... pruefindex
public virtual int HydrPruefung { get; set; } /// Not mapped to DB !!!
public virtual int WMTypeRevision { get; set; } /// Not mapped to DB !!!
public virtual object TestInfos { get; set; } /// SensusTestInfo[] array fetched at the beginning of the cycle, not mapped to DB !!!
#endif
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; }
@@ -281,12 +262,7 @@ namespace Results.Entities
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy)
{
return mtr;
}
}
}
}
return null;
}
@@ -348,12 +324,6 @@ namespace Results.Entities
public WaterMeter()
{
MeterTestRslts = new List<MeterTestRslt>();
#if ORACLE_DB
Pruefindex = 1;
HydrPruefung = 0;
WMTypeRevision = 0;
TestInfos = null;
#endif
}
@@ -376,6 +346,7 @@ namespace Results.Entities
ArchivePath = src.ArchivePath;
Remark = src.Remark;
#if IPERL
SerialNrEx = src.SerialNrEx;
OrigCalibFactor = src.OrigCalibFactor;
CalibFactor = src.CalibFactor;
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
@@ -389,26 +360,9 @@ namespace Results.Entities
Hz2Correction = src.Hz2Correction;
FWVersion = src.FWVersion;
#endif
#if TURA_SPECIAL
AssignedSerialNr = src.AssignedSerialNr;
CompleteSerialNr = src.CompleteSerialNr;
RadioAddress = src.RadioAddress;
PaletteNr = src.PaletteNr;
UmkartonNr = src.UmkartonNr;
ProdTestBench = src.ProdTestBench;
ProdWMPosition = src.ProdWMPosition;
ProdUserName = src.ProdUserName;
ProdPurchaseOrder = src.ProdPurchaseOrder;
ProdPassed = src.ProdPassed;
ProdResultCode = src.ProdResultCode;
ProdQ2CorrRL = src.ProdQ2CorrRL;
ProdQ2CorrLR = src.ProdQ2CorrLR;
#endif
#if ORACLE_DB
Pruefindex = src.Pruefindex;
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
WMTypeRevision = src.WMTypeRevision;
TestInfos = src.TestInfos;
#endif
foreach (var mtr in MeterTestRslts)
{
@@ -425,7 +379,7 @@ namespace Results.Entities
{
StringBuilder sb = new StringBuilder(80);
#if IPERL
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrAux);
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrEx);
#else
sb.AppendFormat("S/N:{0} ", SerialNr);
#endif
+2
View File
@@ -54,6 +54,7 @@ namespace Results.Entities
#if ORACLE_DB
public virtual int WMTypeId { get; set; }
public virtual int WMTypeRev { get; set; }
#endif
public WaterMeterData()
@@ -110,6 +111,7 @@ namespace Results.Entities
#if ORACLE_DB
if (WMTypeId != wmd.WMTypeId) return false;
if (WMTypeRev != wmd.WMTypeRev) return false;
#endif
return true;
}
+20 -20
View File
@@ -45,7 +45,7 @@ namespace Results.Forms
Results.BatchResults results;
MetersKind metersKind;
OneWMResultsCtrl firstListView;
ListView firstListView;
public int[] rsltsClmnWidths;
int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
@@ -150,9 +150,9 @@ namespace Results.Forms
{
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
{
OneWMResultsCtrl lview = (TestsArrangement == TestsArrangement.Rows)
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
ListView lview = (TestsArrangement == TestsArrangement.Rows)
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
if (lview != null)
{
flowLayoutPanel.Controls.Add(lview);
@@ -182,9 +182,19 @@ namespace Results.Forms
/// Get an empty ListView control with appropriate parameters.
/// </summary>
/// <returns>ListView control</returns>
OneWMResultsCtrl GetListView()
ListView GetListView()
{
return new OneWMResultsCtrl(Color.White, lvWidth, lvHeight);
ListView lview = new ListView();
lview.AllowColumnReorder = false;
lview.Dock = System.Windows.Forms.DockStyle.None;
lview.FullRowSelect = true;
lview.GridLines = true;
lview.Location = new System.Drawing.Point(0, 0);
lview.Size = new System.Drawing.Size(lvWidth, lvHeight);
lview.TabIndex = 0;
lview.UseCompatibleStateImageBehavior = false;
lview.View = System.Windows.Forms.View.Details;
return lview;
}
@@ -215,16 +225,11 @@ namespace Results.Forms
/// </summary>
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
/// <returns>ListView object</returns>
OneWMResultsCtrl GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
OneWMResultsCtrl lview = GetListView();
#if ORACLE_DB
lview.Caption = string.Format("PCB {0} {1} {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), Strings.repetition, (wMtr.Pruefindex % 100));
#else
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
ListView lview = GetListView();
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
@@ -285,16 +290,11 @@ namespace Results.Forms
/// </summary>
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
/// <returns>ListView object</returns>
OneWMResultsCtrl GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
ListView GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
OneWMResultsCtrl lview = GetListView();
#if ORACLE_DB
lview.Caption = string.Format("PCB {0} {1} {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), Strings.repetition, (wMtr.Pruefindex % 100));
#else
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
ListView lview = GetListView();
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
-102
View File
@@ -1,102 +0,0 @@
namespace Results.Forms
{
partial class OneWMResultsCtrl
{
/// <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.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tBox = new System.Windows.Forms.TextBox();
this.lView = new System.Windows.Forms.ListView();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tBox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lView);
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// tBox
//
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tBox.Location = new System.Drawing.Point(0, 0);
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
//
// lView
//
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
this.lView.FullRowSelect = true;
this.lView.GridLines = true;
this.lView.Location = new System.Drawing.Point(0, 0);
this.lView.Name = "lView";
this.lView.Size = new System.Drawing.Size(352, 292);
this.lView.TabIndex = 0;
this.lView.UseCompatibleStateImageBehavior = false;
this.lView.View = System.Windows.Forms.View.Details;
//
// OneWMResultsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "OneWMResultsCtrl";
this.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox tBox;
private System.Windows.Forms.ListView lView;
}
}
-26
View File
@@ -1,26 +0,0 @@
using System.Drawing;
using System.Windows.Forms;
namespace Results.Forms
{
public partial class OneWMResultsCtrl : UserControl
{
public OneWMResultsCtrl()
{
InitializeComponent();
}
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight)
: this()
{
lView.BackColor = backColor;
tBox.BackColor = backColor;
Size = new System.Drawing.Size(lvWidth, lvHeight);
}
public string Caption { get { return tBox.Text; } set { tBox.Text = value; } }
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } }
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
public Color BColor { set { lView.BackColor = value; tBox.BackColor = value; } }
}
}
-120
View File
@@ -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>
+71 -92
View File
@@ -91,85 +91,85 @@ namespace Results
T_Lo_start, /// 81
T_Lo_end, /// 82
T_Lo_avg, /// 83
P_delta_mean, /// 84
P_delta_start, /// 85
P_delta_end, /// 86
Meter_type, /// 87 Single, Compound or HeatMeter
Volume_main, /// 88
Volume_aux, /// 89
Start_volume, /// 90
Start_volume_main, /// 91
Start_volume_aux, /// 92
End_volume, /// 93
End_volume_main, /// 94
End_volume_aux, /// 95
Error_main, /// 96
Error_aux, /// 97
Serial_Nr_main, /// 98
Serial_Nr_aux, /// 99
End_state_main, /// 100
End_state_aux, /// 101
Q_rise, /// 102
Q_fall, /// 103
P_delta_mean, /// 84
P_delta_start, /// 85
P_delta_end, /// 86
Meter_type, /// 87 Single, Compound or HeatMeter
Volume_main, /// 88
Volume_aux, /// 89
Start_volume, /// 90
Start_volume_main, /// 91
Start_volume_aux, /// 92
End_volume, /// 93
End_volume_main, /// 94
End_volume_aux, /// 95
Error_main, /// 96
Error_aux, /// 97
Serial_Nr_main, /// 98
Serial_Nr_aux, /// 99
End_state_main, /// 100
End_state_aux, /// 101
Q_rise, /// 102
Q_fall, /// 103
/// iPerl
/// iPerl
OrigCalibFactor, /// 104
CalibFactor, /// 105
Q2ErrWOCorrection, /// 106
Q2CorrectionDone, /// 107
CalibFactor, /// 105
Q2ErrWOCorrection, /// 106
Q2CorrectionDone, /// 107
Q2CorrRFlow, /// 108
Q2CorrLFlow, /// 109
Q2CorrFlowRight, /// 110
Q_ref_mean, /// 111
T_up_start, /// 112
T_up_end, /// 113
T_up_avg, /// 114
T_down_start, /// 115
T_down_end, /// 116
T_down_avg, /// 117
T_div_start, /// 118
T_div_end, /// 119
T_div_avg, /// 120
P_up_avg, /// 121
P_down_avg, /// 122
P_delta_avg, /// 123
TestDone, /// 124
TestPassed, /// 125
Q_ref_mean, /// 111
T_up_start, /// 112
T_up_end, /// 113
T_up_avg, /// 114
T_down_start, /// 115
T_down_end, /// 116
T_down_avg, /// 117
T_div_start, /// 118
T_div_end, /// 119
T_div_avg, /// 120
P_up_avg, /// 121
P_down_avg, /// 122
P_delta_avg, /// 123
TestDone, /// 124
TestPassed, /// 125
/// iPerl
FW_Version, /// 126
Mass_start_raw, /// 127
Mass_start, /// 128
Mass_end_raw, /// 129
Mass_end, /// 130
Mass, /// 131
Buoyancy, /// 132
Density_correction, /// 133
Mass_start_raw, /// 127
Mass_start, /// 128
Mass_end_raw, /// 129
Mass_end, /// 130
Mass, /// 131
Buoyancy, /// 132
Density_correction, /// 133
ErrorFlags, /// 134
E1, /// 135
E2, /// 136
E3, /// 137
E4, /// 138
E5, /// 139
E6, /// 140
E7, /// 141
E8, /// 142
E9, /// 143
E10, /// 144
E11, /// 145
E12, /// 146
E13, /// 147
E14, /// 148
E15, /// 149
E16, /// 150
ErrorFlags, /// 134
E1, /// 135
E2, /// 136
E3, /// 137
E4, /// 138
E5, /// 139
E6, /// 140
E7, /// 141
E8, /// 142
E9, /// 143
E10, /// 144
E11, /// 145
E12, /// 146
E13, /// 147
E14, /// 148
E15, /// 149
E16, /// 150
Table_row_nr, /// 151
Table_column_nr, /// 152
WMRemark, /// 153
Table_row_nr, /// 151
Table_column_nr, /// 152
WMRemark, /// 153
User_description, /// 154
Legalizator, /// 155
@@ -181,7 +181,7 @@ namespace Results
Diverter_start_time, /// 159
Diverter_end_time, /// 160
Q_sensitivity, /// 161
Q_ref_min, /// 162
Q_ref_max, /// 163
Q_ref_start, /// 164
@@ -210,7 +210,7 @@ namespace Results
Rho_Wa_calc, /// 183
Formatted_WM_ID, /// 184, Formated WM ID string:
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
E21, /// 185
T_line_mean, /// 186
@@ -262,7 +262,7 @@ namespace Results
Bench_address5, /// 227 'Address 5' from IBenchInfo
Max_test_index, /// 228 MaxPruefindex % 100
VolumeCTV, /// 229
VolumeCTV, /// 229
/// iPerl
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
@@ -270,28 +270,7 @@ namespace Results
CalibFactorLNA, /// 232
WM_remark, /// 233
/// iPerl special
Prod_AssignedSerialNr, /// 234
Prod_CompleteSerialNr, /// 235
Prod_RadioAddress, /// 236
Prod_PaletteNr, /// 237
Prod_UmkartonNr, /// 238
Prod_TestBench, /// 239
Prod_WMPosition, /// 240
Prod_UserName, /// 241
Prod_PurchaseOrder, /// 242
Prod_Passed, /// 243
Prod_ResultCode, /// 244
Prod_Q2CorrRL, /// 245
Prod_Q2CorrLR, /// 246
TestPartStr, /// 247
Error_heat_mtr_vol, /// 248
Energy_start,
Energy_end,
Count,
}
}
+1
View File
@@ -54,6 +54,7 @@ namespace Results.Mappings
#endif
#if ORACLE_DB
Map(x => x.WMTypeId);
Map(x => x.WMTypeRev);
#endif
}
}
+3 -17
View File
@@ -28,6 +28,7 @@ namespace Results.Mappings
.CustomType("StringClob")
.CustomSqlType("varchar(2000)");
#if IPERL
Map(x => x.SerialNrEx);
Map(x => x.OrigCalibFactor);
Map(x => x.CalibFactor);
Map(x => x.OrigCalibFactorLNA);
@@ -35,29 +36,14 @@ namespace Results.Mappings
Map(x => x.Q2ErrWOCorrection);
Map(x => x.Q2CorrectionDone);
Map(x => x.Q2Correction);
Map(x => x.Q2CorrRL);
Map(x => x.Q2CorrLR);
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
Map(x => x.Q2CorrFlowRight);
Map(x => x.Diff2Hz8Hz);
Map(x => x.Hz2CorrectionDone);
Map(x => x.Hz2Correction);
Map(x => x.FWVersion);
#endif
#if TURA_SPECIAL
Map(x => x.AssignedSerialNr);
Map(x => x.CompleteSerialNr);
Map(x => x.RadioAddress);
Map(x => x.PaletteNr);
Map(x => x.UmkartonNr);
Map(x => x.ProdTestBench);
Map(x => x.ProdWMPosition);
Map(x => x.ProdUserName);
Map(x => x.ProdPurchaseOrder);
Map(x => x.ProdPassed);
Map(x => x.ProdResultCode);
Map(x => x.ProdQ2CorrRL);
Map(x => x.ProdQ2CorrLR);
#endif
#if ORACLE_DB
Map(x => x.Pruefindex);
Map(x => x.HydrPruefung);
@@ -1,98 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using Results.Resources;
namespace Results.Output.Printers.Label
{
public class LabelPrintDocument : PrintersCommon
{
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight;
readonly int printWidth;
/// Selected font
readonly Font font;
/// Data to print
Results.Entities.Batch batch;
LabelPrinterCfg cfg;
Results.Entities.WaterMeter wm;
/// Items to print
IList<WMeterRsltItemSpec> itemsToPrint;
/// <summary>
/// Constructor
/// </summary>
/// <param name="textToPrint">Text to be printed</param>
public LabelPrintDocument(Results.Entities.Batch batch, LabelPrinterCfg cfg, Results.Entities.WaterMeter wm, string documentName)
{
DocumentName = documentName;
this.batch = batch;
this.cfg = cfg;
this.wm = wm;
this.itemsToPrint = Results.WMeterRsltItemSpec.FromStrArray(cfg.ItemsToPrint);
/// Initialize fonts
font = new Font((cfg.FontFamily != null ? cfg.FontFamily : "Arial"),
(cfg.FontSize > 0 ? cfg.FontSize : 10),
(FontStyle)cfg.FontStyle);
/// Set print area size and margins (in dots using 100 dpi)
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
///
printHeight = cfg.PaperHeight;
printWidth = cfg.PaperWidth;
}
/// <summary>
/// Override the default onbeginPrint method of the PrintDocument Object
/// </summary>
/// <param name=e></param>
/// <remarks></remarks>
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
{
base.OnBeginPrint(e);
}
/// <summary>
/// Override the default OnPrintPage method of the PrintDocument.
/// </summary>
/// <param name=e></param>
/// <remarks>This provides the print logic for our document</remarks>
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
{
/// Run base code
base.OnPrintPage(e);
if (!string.IsNullOrEmpty(cfg.Template))
{
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
if (File.Exists(templatePath))
{
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), printWidth, printHeight), new Rectangle(0, 0, printWidth, printHeight));
}
}
foreach (var item in itemsToPrint)
{
string[] coords = item.Caption.Split(new char[] { ';' });
int x, y;
if (coords.Length >= 2 && int.TryParse(coords[0].Trim(new char[] { ' ' }), out x)
&& int.TryParse(coords[1].Trim(new char[] { ' ' }), out y))
{
RectangleF printArea = new RectangleF(x, y, printWidth, printHeight);
e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea);
}
}
}
}
}
@@ -1,21 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.Label
{
public class LabelPrinterCfg
{
public string Template; /// Full path to a 'png' file
public Config.Entities.PageOrientation PageOrientation;
public int PaperWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int PaperHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string[] ItemsToPrint;
public string FontFamily;
public int FontSize;
public int FontStyle;
public System.Globalization.CultureInfo CultureInfo;
public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1142.0")]
[assembly: AssemblyFileVersion("2.18.1142.0")]
[assembly: AssemblyVersion("2.18.1093.0")]
[assembly: AssemblyFileVersion("2.18.1093.0")]
-9
View File
@@ -798,15 +798,6 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to repetition.
/// </summary>
internal static string repetition {
get {
return ResourceManager.GetString("repetition", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Result.
/// </summary>
-3
View File
@@ -255,7 +255,4 @@
<data name="Batch" xml:space="preserve">
<value>Dávka</value>
</data>
<data name="repetition" xml:space="preserve">
<value>opakování</value>
</data>
</root>
-3
View File
@@ -741,7 +741,4 @@
<data name="Batch" xml:space="preserve">
<value>Batch</value>
</data>
<data name="repetition" xml:space="preserve">
<value>repetition</value>
</data>
</root>
-13
View File
@@ -80,12 +80,6 @@
<Compile Include="Forms\ListViewExtensions.cs" />
<Compile Include="Forms\LviIntColumnComparer.cs" />
<Compile Include="Forms\LviTextColumnComparer.cs" />
<Compile Include="Forms\OneWMResultsCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\OneWMResultsCtrl.Designer.cs">
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ResultsConfigCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -110,10 +104,6 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Enhanced\EnhancedPrinterCfg.cs" />
<Compile Include="Output\Printers\Label\LabelPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Label\LabelPrinterCfg.cs" />
<Compile Include="Output\Printers\PrintersCommon.cs">
<SubType>Component</SubType>
</Compile>
@@ -165,9 +155,6 @@
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\OneWMResultsCtrl.resx">
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ResultsConfigCtrl.resx">
<DependentUpon>ResultsConfigCtrl.cs</DependentUpon>
</EmbeddedResource>
-15
View File
@@ -31,21 +31,6 @@ namespace Results
}
}
public static string BenchNameFromOracleBenchID(int id)
{
switch (id)
{
case 4: return "WR9";
case 5: return "WR10";
case 6: return "WR11";
case 7: return "PT7";
case 8: return "WR13";
case 9: return "WR15";
case 10: return "WR14";
default: return string.Empty;
}
}
/// <summary>
/// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31).
+18 -57
View File
@@ -155,16 +155,16 @@ namespace Results
///
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).TargetVolume())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.VolumeCTV, string.Format("{0} CTV ()", Strings.VName_Vol), Quantity.Volume, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).VolumeCTV)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeMeter) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeRef) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeStart) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeEnd) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
///
/// Mass
@@ -314,8 +314,7 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.LastError, string.Format("{0} rel. last ()", Strings.VName_Error), Strings.Tooltip_E_rel_last, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).LastError)));
#else
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_heat_mtr_vol, string.Format("{0} rel.hm.vol. ()", Strings.VName_Error), Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
#endif
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
@@ -372,8 +371,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Degree__liter, "Degree per liter ()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
/// Water meters results (combined)
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_main, string.Format("{0} {1}", Strings.sn, Strings.main), Strings.Tooltip_sn_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, string.Format("{0} {1}", Strings.sn, Strings.aux), Strings.Tooltip_sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNrAux)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
@@ -408,10 +407,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
#if HEAT_METERS
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_start, Strings.Energy + " start ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_end, Strings.Energy + " end ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef))));
#endif
#if IPERL
@@ -421,31 +418,14 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactorLNA, "iPerl CalibFactorLNA", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactorLNA)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2Corr RL", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2Corr LR", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2Corr R-L", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2Corr L-R", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
#if ORACLE_DB
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100))));
#endif
#endif
#if TURA_SPECIAL
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_AssignedSerialNr, "iPerl assigned s/n", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.AssignedSerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_CompleteSerialNr, "iPerl complete s/n", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.CompleteSerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_RadioAddress, "iPerl radio address", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.RadioAddress)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_PaletteNr, "iPerl palette nr.", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.PaletteNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_UmkartonNr, "iPerl umkarton nr.", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.UmkartonNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_TestBench, "Prod iPerl test bench", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ProdTestBench)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_WMPosition, "Prod iPerl WM position", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdWMPosition)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_UserName, "Prod iPerl user name", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ProdUserName)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_PurchaseOrder, "Prod iPerl purchase order", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ProdPurchaseOrder)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Passed, "Prod iPerl passed", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => FormatBool(f,w.ProdPassed)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_ResultCode, "Prod iPerl result code", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdResultCode)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Q2CorrRL, "Prod iPerl Q2Corr RL", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdQ2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Q2CorrLR, "Prod iPerl Q2Corr LR", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdQ2CorrLR)));
#endif
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).TestDone)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).Passed)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
@@ -467,7 +447,6 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.E15, "E15 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x4000) != 0) ? Strings.Yes : Strings.No));
AllItems.Add(new WMeterRsltItemSpec(ItemID.E16, "E16 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x8000) != 0) ? Strings.Yes : Strings.No));
AllItems.Add(new WMeterRsltItemSpec(ItemID.E21, "E21 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x100000) != 0) ? Strings.Yes : Strings.No));
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPartStr, "Test part str.", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatEnum(f, (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).TestRslt.Part : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_row_nr, "Table row #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableRowNr.ToString() : string.Format(f, TableRowNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_column_nr, "Table column #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableColumnNr.ToString() : string.Format(f, TableColumnNr)));
@@ -481,8 +460,7 @@ namespace Results
public static string FormatStr(string format, string value)
{
string valueEx = string.IsNullOrEmpty(value) ? string.Empty : value;
return string.IsNullOrEmpty(format) ? valueEx : string.Format(format, valueEx);
return string.IsNullOrEmpty(format) ? value : string.Format(format, value);
}
public static string FormatBool(string format, bool value)
@@ -498,23 +476,6 @@ namespace Results
}
}
public static string FormatEnum(string format, int value)
{
if (string.IsNullOrEmpty(format))
{
return value.ToString();
}
else
{
string[] texts = format.Split(new char[] { '~' });
if (value >= 0 && value < texts.Length)
return texts[value];
else
return value.ToString();
}
}
public static string FormatInt(string format, int value)
{
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
+1 -1
View File
@@ -48,7 +48,7 @@
//
this.batchNrTextBox.Location = new System.Drawing.Point(132, 13);
this.batchNrTextBox.Name = "batchNrTextBox";
this.batchNrTextBox.Size = new System.Drawing.Size(80, 20);
this.batchNrTextBox.Size = new System.Drawing.Size(138, 20);
this.batchNrTextBox.TabIndex = 0;
//
// BatchNrFilterUI
+3 -3
View File
@@ -48,15 +48,15 @@
//
this.procedureTextBox.Location = new System.Drawing.Point(132, 13);
this.procedureTextBox.Name = "procedureTextBox";
this.procedureTextBox.Size = new System.Drawing.Size(360, 20);
this.procedureTextBox.Size = new System.Drawing.Size(138, 20);
this.procedureTextBox.TabIndex = 0;
//
// ProcedureFilterUI
// ProcedureFilter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Name = "ProcedureFilterUI";
this.Name = "ProcedureFilter";
this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
+3 -3
View File
@@ -48,15 +48,15 @@
//
this.procedureTextBox.Location = new System.Drawing.Point(132, 13);
this.procedureTextBox.Name = "procedureTextBox";
this.procedureTextBox.Size = new System.Drawing.Size(80, 20);
this.procedureTextBox.Size = new System.Drawing.Size(138, 20);
this.procedureTextBox.TabIndex = 0;
//
// QnFilterUI
// QnFilter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Name = "QnFilterUI";
this.Name = "QnFilter";
this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
+6 -34
View File
@@ -30,6 +30,7 @@ namespace ResultsBrowser.Filters
///
public string SerialNr;
private SerialNrFilterUI userIface;
public SerialNrFilter()
@@ -41,50 +42,21 @@ namespace ResultsBrowser.Filters
{
IList<WaterMeter> filteredWaterMeters = new List<WaterMeter>();
if (string.IsNullOrEmpty(SerialNr)) return filteredWaterMeters; /// Empty s/n => Return an empty list of WM-s
IList<string> serialNumbers = new List<string>();
///
if (SerialNr[0] == '@')
{
try
{
TextReader rdr = new StreamReader(SerialNr.Substring(1));
string line = rdr.ReadLine();
while (!string.IsNullOrEmpty(line))
{
serialNumbers.Add(line);
line = rdr.ReadLine();
}
}
catch (Exception)
{
return filteredWaterMeters;
}
}
else
{
serialNumbers.Add(SerialNr);
}
if (waterMeters == null)
{
foreach (var se in sessions)
{
foreach (var oneSerialNr in serialNumbers)
{
IList<WaterMeter> wms = se.QueryOver<WaterMeter>()
.Where(x => (x.SerialNr == oneSerialNr))
.List<WaterMeter>();
foreach (var wm in wms) filteredWaterMeters.Add(wm);
}
IList<WaterMeter> wms = se.QueryOver<WaterMeter>()
.Where(x => (x.SerialNr == SerialNr))
.List<WaterMeter>();
foreach (var wm in wms) filteredWaterMeters.Add(wm);
}
}
else
{
foreach (var wm in waterMeters)
{
if (serialNumbers.Contains(wm.SerialNr)) filteredWaterMeters.Add(wm);
if (wm.SerialNr == SerialNr) filteredWaterMeters.Add(wm);
}
}
+3 -4
View File
@@ -48,16 +48,15 @@
//
this.serialNrTextBox.Location = new System.Drawing.Point(132, 13);
this.serialNrTextBox.Name = "serialNrTextBox";
this.serialNrTextBox.Size = new System.Drawing.Size(360, 20);
this.serialNrTextBox.Size = new System.Drawing.Size(138, 20);
this.serialNrTextBox.TabIndex = 0;
this.serialNrTextBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.serialNrTextBox_MouseDoubleClick);
//
// SerialNrFilterUI
// SerialNrFilter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Name = "SerialNrFilterUI";
this.Name = "SerialNrFilter";
this.Size = new System.Drawing.Size(835, 40);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
@@ -35,14 +35,5 @@ namespace ResultsBrowser.Filters
{
data.SerialNr = serialNrTextBox.Text;
}
private void serialNrTextBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
serialNrTextBox.Text = string.Format("@{0}", dlg.FileName);
}
}
}
}
+1 -1
View File
@@ -48,7 +48,7 @@
//
this.wmPositionTextBox.Location = new System.Drawing.Point(132, 13);
this.wmPositionTextBox.Name = "wmPositionTextBox";
this.wmPositionTextBox.Size = new System.Drawing.Size(80, 20);
this.wmPositionTextBox.Size = new System.Drawing.Size(138, 20);
this.wmPositionTextBox.TabIndex = 0;
//
// WMPositionFilterUI
-76
View File
@@ -1,76 +0,0 @@
namespace ResultsBrowser.Forms
{
partial class HistogramCtrl
{
/// <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()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title();
this.myChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.myChart)).BeginInit();
this.SuspendLayout();
//
// myChart
//
chartArea1.Name = "ChartArea1";
this.myChart.ChartAreas.Add(chartArea1);
this.myChart.Dock = System.Windows.Forms.DockStyle.Fill;
legend1.Name = "Legend1";
this.myChart.Legends.Add(legend1);
this.myChart.Location = new System.Drawing.Point(0, 0);
this.myChart.Name = "myChart";
this.myChart.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.Bright;
series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1";
series1.Name = "Series1";
this.myChart.Series.Add(series1);
this.myChart.Size = new System.Drawing.Size(400, 300);
this.myChart.TabIndex = 0;
this.myChart.Text = "chart1";
title1.Name = "Title1";
title1.Text = "Title1";
this.myChart.Titles.Add(title1);
//
// HistogramCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.myChart);
this.Name = "HistogramCtrl";
this.Size = new System.Drawing.Size(400, 300);
((System.ComponentModel.ISupportInitialize)(this.myChart)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataVisualization.Charting.Chart myChart;
}
}
-42
View File
@@ -1,42 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace ResultsBrowser.Forms
{
public partial class HistogramCtrl : UserControl
{
/// <summary>
/// Create user control that displays a bar chart iwth custom X-axis labels.
/// </summary>
/// <param name="title">Title of the chart displayed at the top</param>
/// <param name="values">Values = bar lengths</param>
/// <param name="labels">Labels for the X-axis</param>
public HistogramCtrl(string title, double[] values, string[] labels)
{
InitializeComponent();
if (myChart.Titles.Count > 0) myChart.Titles[0].Text = title;
if ((myChart.Series.Count > 0) && (values != null))
{
int startOffset = -1;
int endOffset = 1;
for (int i = 0; i < Math.Min(values.Length + 1, labels.Length); i++)
{
if (i < values.Length) myChart.Series[0].Points.Add(values[i]);
if (!string.IsNullOrEmpty(labels[i]))
{
myChart.ChartAreas[0].AxisX.CustomLabels.Add(new System.Windows.Forms.DataVisualization.Charting.CustomLabel(startOffset, endOffset, labels[i], 0, LabelMarkStyle.None));
}
startOffset = startOffset + 1;
endOffset = endOffset + 1;
}
}
}
}
}
-120
View File
@@ -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>
-150
View File
@@ -1,150 +0,0 @@
namespace ResultsBrowser.Forms
{
partial class HistogramDlg
{
/// <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 Windows Form 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.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.exportButton = new System.Windows.Forms.Button();
this.printButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.flowLayoutPanel1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
this.splitContainer1.SplitterDistance = 320;
this.splitContainer1.TabIndex = 0;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.exportButton);
this.splitContainer2.Panel2.Controls.Add(this.printButton);
this.splitContainer2.Panel2.Controls.Add(this.closeButton);
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
this.splitContainer2.SplitterDistance = 249;
this.splitContainer2.TabIndex = 0;
//
// exportButton
//
this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.exportButton.Location = new System.Drawing.Point(103, 21);
this.exportButton.Name = "exportButton";
this.exportButton.Size = new System.Drawing.Size(94, 41);
this.exportButton.TabIndex = 1;
this.exportButton.Text = "Export";
this.exportButton.UseVisualStyleBackColor = true;
//
// printButton
//
this.printButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.printButton.Location = new System.Drawing.Point(4, 21);
this.printButton.Name = "printButton";
this.printButton.Size = new System.Drawing.Size(94, 41);
this.printButton.TabIndex = 0;
this.printButton.Text = "Print";
this.printButton.UseVisualStyleBackColor = true;
//
// closeButton
//
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.closeButton.Location = new System.Drawing.Point(203, 21);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(94, 41);
this.closeButton.TabIndex = 2;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(572, 320);
this.flowLayoutPanel1.TabIndex = 0;
//
// HistogramDlg
//
this.AcceptButton = this.closeButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(572, 409);
this.Controls.Add(this.splitContainer1);
this.Name = "HistogramDlg";
this.Text = "HistogramDlg";
this.Load += new System.EventHandler(this.HistogramDlg_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.Button printButton;
private System.Windows.Forms.Button exportButton;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}
-152
View File
@@ -1,152 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using Results.Entities;
using ResultsBrowser.Resources;
using ResultsBrowser.Output.Printers.Statistics;
namespace ResultsBrowser.Forms
{
public partial class HistogramDlg : Form
{
const int NrBins = 11;
IList<WaterMeter> waterMeters;
HistogramOptionsDlg options;
public HistogramDlg(IList<WaterMeter> waterMeters, HistogramOptionsDlg options, string title)
{
InitializeComponent();
this.waterMeters = waterMeters;
this.options = options;
Text = title;
closeButton.Text = Strings.OkBtnText;
printButton.Text = Strings.Print;
}
private void HistogramDlg_Load(object sender, EventArgs e)
{
CalculateAndDraw();
}
void CalculateAndDraw()
{
for (int i = 0; i < options.SelectedItems.Count; i++)
{
Results.WMeterRsltItemSpec item = options.SelectedItems[i];
try
{
/// Find minimum and maximum
double min = Double.MaxValue;
double max = Double.MinValue;
double sum = 0;
int count = 0;
foreach (var wm in waterMeters)
{
string strValue = item.Print(wm);
double value;
if (!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.CurrentCulture, out value) &&
!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out value))
{
throw new Exception(string.Format("{0} is not a number, cannot calculate histogram", item.Caption));
}
sum += value;
count++;
if (min > value) min = value;
if (max < value) max = value;
}
double mean = (count != 0) ? (sum / count) : 0; /// Prevent division by zero
///
/// Determine limits for bins
///
double[] binHiLim;
string[] labels;
if ((-0.55 <= min) && (max <= 0.55))
{
labels = new string[] { "-0.6", "", "-0.4", "", "-0.2", "", "0", "", "0.2", "", "0.4", "", "0.6" };
binHiLim = new double[] { -0.45, -0.35, -0.25, -0.15, -0.05, 0.05, 0.15, 0.25, 0.35, 0.45, 0.55 };
}
else if ((-1.1 <= min) && (max <= 1.1))
{
labels = new string[] { "-1.2", "", "-0.8", "", "-0.4", "", "0", "", "0.4", "", "0.8", "", "1.2" };
binHiLim = new double[] { -0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1 };
}
else if ((-2.2 <= min) && (max <= 2.2))
{
labels = new string[] { "-2.4", "", "-1.6", "", "-0.8", "", "0", "", "0.8", "", "1.6", "", "2.4" };
binHiLim = new double[] { -1.8, -1.4, -1.0, -0.6, -0.2, 0.2, 0.6, 1.0, 1.4, 1.8, 2.2 };
}
else if ((-4.4 <= min) && (max <= 4.4))
{
labels = new string[] { "-4.8", "", "-3.2", "", "-1.6", "", "0", "", "1.6", "", "3.2", "", "4.8" };
binHiLim = new double[] { -3.6, -2.8, -2.0, -1.2, -0.4, 0.4, 1.2, 2.0, 2.8, 3.6, 4.4 };
}
else
{
labels = new string[] { "-9.6", "", "-6.4", "", "-3.2", "", "0", "", "3.2", "", "6.4", "", "9.6" };
binHiLim = new double[] { -7.2, -5.6, -4.0, -2.4, -0.8, 0.8, 2.4, 4.0, 5.6, 7.2, 8.8 };
}
int nrBins = Math.Min(labels.Length - 1, binHiLim.Length + 1);
double[] bins = new double[nrBins];
for (int j = 0; j < nrBins; j++) bins[j] = 0;
/// Calculate bins
foreach (var wm in waterMeters)
{
string strValue = item.Print(wm);
double value;
if (!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.CurrentCulture, out value) &&
!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out value))
{
throw new Exception(string.Format("{0} is not a number, cannot calculate histogram", item.Caption));
}
for (int j = 0; j < nrBins - 1; j++)
{
if (value < binHiLim[j])
{
bins[j] += 1.0;
break;
}
}
if (value >= binHiLim[nrBins - 2])
{
bins[nrBins - 1] += 1.0;
}
}
///
/// Draw
///
HistogramCtrl histo = new HistogramCtrl(string.Format("{0} mean = {1}", item.Caption, mean.ToString("F3")), bins, labels);
flowLayoutPanel1.Controls.Add(histo);
}
catch (Exception exc)
{
string msg = exc.Message;
}
}
}
private void closeButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}
-120
View File
@@ -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>
-91
View File
@@ -1,91 +0,0 @@
namespace ResultsBrowser.Forms
{
partial class HistogramOptionsDlg
{
/// <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 Windows Form 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.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(380, 302);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 9;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(269, 302);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
this.okButton.TabIndex = 8;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(479, 271);
this.flowLayoutPanel1.TabIndex = 10;
//
// HistogramOptionsDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(503, 355);
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Name = "HistogramOptionsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "HistogramOptionsDlg";
this.Load += new System.EventHandler(this.HistogramOptionsDlg_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}
@@ -1,67 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ResultsBrowser.Resources;
namespace ResultsBrowser.Forms
{
public partial class HistogramOptionsDlg : Form
{
IList<Results.WMeterRsltItemSpec> items;
public IList<Results.WMeterRsltItemSpec> SelectedItems;
IList<CheckBox> checkBoxes;
public HistogramOptionsDlg(IList<Results.WMeterRsltItemSpec> items)
{
InitializeComponent();
this.items = items;
checkBoxes = new List<CheckBox>();
}
private void HistogramOptionsDlg_Load(object sender, EventArgs e)
{
Localize();
foreach (var item in items)
{
CheckBox cb = new CheckBox();
cb.Text = item.Caption;
cb.Checked = false;
flowLayoutPanel1.Controls.Add(cb);
checkBoxes.Add(cb);
}
}
void Localize()
{
Text = Strings.Statistics;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
}
private void okButton_Click(object sender, EventArgs e)
{
SelectedItems = new List<Results.WMeterRsltItemSpec>();
for (int i = 0; i < items.Count; i++)
{
if (checkBoxes[i].Checked) SelectedItems.Add(items[i]);
}
//Program.LocalSettings.RowItemCaption = RowItem.Caption;
// ...
//Program.LocalSettings.Save();
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
}
}
}
@@ -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>
+68 -27
View File
@@ -1,7 +1,4 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Results.Entities;
@@ -14,7 +11,22 @@ namespace ResultsBrowser.Forms
public partial class StatisticsDlg : Form
{
IList<WaterMeter> waterMeters;
StatisticsOptionsDlg options;
bool twoDim;
Results.WMeterRsltItemSpec rowItem;
Results.WMeterRsltItemSpec rowItem2;
Results.WMeterRsltItemSpec rowItem3;
Results.WMeterRsltItemSpec columnItem;
Results.WMeterRsltItemSpec columnItem2;
Results.WMeterRsltItemSpec columnItem3;
string rowTestSpec;
string rowTestSpec2;
string rowTestSpec3;
string columnTestSpec;
string columnTestSpec2;
string columnTestSpec3;
IList<string> rowValues;
IList<string> columnValues;
@@ -24,14 +36,23 @@ namespace ResultsBrowser.Forms
string title;
public StatisticsDlg(IList<WaterMeter> waterMeters, StatisticsOptionsDlg options,
public StatisticsDlg(IList<WaterMeter> waterMeters, bool twoDim,
Results.WMeterRsltItemSpec rowItem,
Results.WMeterRsltItemSpec rowItem2,
Results.WMeterRsltItemSpec rowItem3,
Results.WMeterRsltItemSpec columnItem,
Results.WMeterRsltItemSpec columnItem2,
Results.WMeterRsltItemSpec columnItem3,
string rowTestSpec,
string rowTestSpec2,
string rowTestSpec3,
string columnTestSpec,
string columnTestSpec2,
string columnTestSpec3,
DateTime startDate, DateTime endDate)
{
InitializeComponent();
this.waterMeters = waterMeters;
this.options = options;
if (!string.IsNullOrEmpty(Program.LocalSettings.TimePeriodFormat) && (startDate != new DateTime(0)) && (endDate != new DateTime(0)))
{
title = string.Format(Program.LocalSettings.TimePeriodFormat, startDate, endDate);
@@ -45,6 +66,26 @@ namespace ResultsBrowser.Forms
closeButton.Text = Strings.OkBtnText;
printButton.Text = Strings.Print;
this.waterMeters = waterMeters;
this.twoDim = twoDim;
this.rowItem = rowItem;
this.rowItem2 = rowItem2;
this.rowItem3 = rowItem3;
this.columnItem = columnItem;
this.columnItem2 = columnItem2;
this.columnItem3 = columnItem3;
this.rowTestSpec = rowTestSpec;
this.rowTestSpec2 = rowTestSpec2;
this.rowTestSpec3 = rowTestSpec3;
this.columnTestSpec = columnTestSpec;
this.columnTestSpec2 = columnTestSpec2;
this.columnTestSpec3 = columnTestSpec3;
}
private void StatisticsDlg_Load(object sender, EventArgs e)
@@ -64,16 +105,16 @@ namespace ResultsBrowser.Forms
///
foreach (var wm in waterMeters)
{
string value = options.RowItem.Print(wm);
if (options.RowItem2 != null) value = value + " | " + options.RowItem2.Print(wm);
if (options.RowItem3 != null) value = value + " | " + options.RowItem3.Print(wm);
string value = rowItem.Print(wm);
if (rowItem2 != null) value = value + " | " + rowItem2.Print(wm);
if (rowItem3 != null) value = value + " | " + rowItem3.Print(wm);
if (!rowValues.Contains(value)) rowValues.Add(value);
if (options.TwoDim)
if (twoDim)
{
value = options.ColumnItem.Print(wm);
if (options.ColumnItem2 != null) value = value + " | " + options.ColumnItem2.Print(wm);
if (options.ColumnItem3 != null) value = value + " | " + options.ColumnItem3.Print(wm);
value = columnItem.Print(wm);
if (columnItem2 != null) value = value + " | " + columnItem2.Print(wm);
if (columnItem3 != null) value = value + " | " + columnItem3.Print(wm);
if (!columnValues.Contains(value)) columnValues.Add(value);
}
}
@@ -88,17 +129,17 @@ namespace ResultsBrowser.Forms
{
for (int row = 0; row < rowValues.Count; row++)
{
string rowValue = options.RowItem.Print(wm);
if (options.RowItem2 != null) rowValue = rowValue + " | " + options.RowItem2.Print(wm);
if (options.RowItem3 != null) rowValue = rowValue + " | " + options.RowItem3.Print(wm);
string rowValue = rowItem.Print(wm);
if (rowItem2 != null) rowValue = rowValue + " | " + rowItem2.Print(wm);
if (rowItem3 != null) rowValue = rowValue + " | " + rowItem3.Print(wm);
if (options.TwoDim)
if (twoDim)
{
for (int column = 0; column < columnsCount; column++)
{
string columnValue = options.ColumnItem.Print(wm);
if (options.ColumnItem2 != null) columnValue = columnValue + " | " + options.ColumnItem2.Print(wm);
if (options.ColumnItem3 != null) columnValue = columnValue + " | " + options.ColumnItem3.Print(wm);
string columnValue = columnItem.Print(wm);
if (columnItem2 != null) columnValue = columnValue + " | " + columnItem2.Print(wm);
if (columnItem3 != null) columnValue = columnValue + " | " + columnItem3.Print(wm);
if (rowValue == rowValues[row] && columnValue == columnValues[column])
{
@@ -123,7 +164,7 @@ namespace ResultsBrowser.Forms
statisticsListView.Columns.Add(" ", 200);
for (int column = 0; column < columnsCount; column++)
{
statisticsListView.Columns.Add((options.TwoDim ? columnValues[column] : Strings.Count), 70);
statisticsListView.Columns.Add((twoDim ? columnValues[column] : Strings.Count), 70);
}
for (int row = 0; row < rowValues.Count; row++)
@@ -156,7 +197,7 @@ namespace ResultsBrowser.Forms
table[0, 0] = string.Empty;
for (int column = 0; column < columnsCount; column++)
{
table[0, column + 1] = (options.TwoDim ? columnValues[column] : Strings.Count);
table[0, column + 1] = (twoDim ? columnValues[column] : Strings.Count);
}
for (int row = 0; row < rowValues.Count; row++)
@@ -193,7 +234,7 @@ namespace ResultsBrowser.Forms
{
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
{
if (options.TwoDim)
if (twoDim)
{
/// Write column headers
for (int i = 0; i < columnValues.Count; i++)
@@ -204,7 +245,7 @@ namespace ResultsBrowser.Forms
}
else
{
writer.WriteLine(string.Format("\"{0}\";\"{1}\"", options.RowItem.Caption, Strings.Count));
writer.WriteLine(string.Format("\"{0}\";\"{1}\"", rowItem.Caption, Strings.Count));
}
int nrColumns = Math.Max(1, columnValues.Count);
+1 -4
View File
@@ -1,7 +1,4 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ResultsBrowser.Resources;
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1146.0")]
[assembly: AssemblyFileVersion("2.18.1146.0")]
[assembly: AssemblyVersion("2.18.1110.0")]
[assembly: AssemblyFileVersion("2.18.1110.0")]
-3
View File
@@ -240,7 +240,4 @@
<data name="Add_data_from_Oracle" xml:space="preserve">
<value>Dohledej údaje z Oracle</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>Histogramy</value>
</data>
</root>
-3
View File
@@ -828,7 +828,4 @@
<data name="Add_data_from_Oracle" xml:space="preserve">
<value>Add data from Oracle</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>Histograms</value>
</data>
</root>
-9
View File
@@ -1257,15 +1257,6 @@ namespace ResultsBrowser.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Histograms.
/// </summary>
internal static string Histograms {
get {
return ResourceManager.GetString("Histograms", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Horizontally.
/// </summary>
-28
View File
@@ -60,7 +60,6 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -134,24 +133,6 @@
<Compile Include="Forms\DatabaseSettingsDlg.Designer.cs">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\HistogramCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\HistogramCtrl.Designer.cs">
<DependentUpon>HistogramCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Forms\HistogramDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\HistogramDlg.Designer.cs">
<DependentUpon>HistogramDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\HistogramOptionsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\HistogramOptionsDlg.Designer.cs">
<DependentUpon>HistogramOptionsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\NoBenchOrDatabaseDlg.cs">
<SubType>Form</SubType>
</Compile>
@@ -221,15 +202,6 @@
<EmbeddedResource Include="Forms\DatabaseSettingsDlg.resx">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HistogramCtrl.resx">
<DependentUpon>HistogramCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HistogramDlg.resx">
<DependentUpon>HistogramDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HistogramOptionsDlg.resx">
<DependentUpon>HistogramOptionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\NoBenchOrDatabaseDlg.resx">
<DependentUpon>NoBenchOrDatabaseDlg.cs</DependentUpon>
</EmbeddedResource>
+36 -77
View File
@@ -34,13 +34,10 @@
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
this.resultsListView = new System.Windows.Forms.ListView();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.histogramBtn = new System.Windows.Forms.Button();
this.statisticsBtn = new System.Windows.Forms.Button();
this.outputGroupBox = new System.Windows.Forms.GroupBox();
this.exportQueryResultsBtn = new System.Windows.Forms.Button();
this.printQueryResultsBtn = new System.Windows.Forms.Button();
this.printerConfigBtn = new System.Windows.Forms.Button();
this.statisticsBtn = new System.Windows.Forms.Button();
this.printQueryResultsBtn = new System.Windows.Forms.Button();
this.exportQueryResultsBtn = new System.Windows.Forms.Button();
this.formatOfResultsBtn = new System.Windows.Forms.Button();
this.clearFiltersBtn = new System.Windows.Forms.Button();
this.settingsBtn = new System.Windows.Forms.Button();
@@ -65,8 +62,6 @@
this.hSplitContainer.SuspendLayout();
this.filtersGroupBox.SuspendLayout();
this.resultsGroupBox.SuspendLayout();
this.groupBox1.SuspendLayout();
this.outputGroupBox.SuspendLayout();
this.testBenchesGroupBox.SuspendLayout();
this.SuspendLayout();
//
@@ -84,9 +79,10 @@
//
// vSplitContainer.Panel2
//
this.vSplitContainer.Panel2.Controls.Add(this.groupBox1);
this.vSplitContainer.Panel2.Controls.Add(this.outputGroupBox);
this.vSplitContainer.Panel2.Controls.Add(this.printerConfigBtn);
this.vSplitContainer.Panel2.Controls.Add(this.statisticsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.printQueryResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.exportQueryResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.formatOfResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.clearFiltersBtn);
this.vSplitContainer.Panel2.Controls.Add(this.settingsBtn);
@@ -158,68 +154,6 @@
this.resultsListView.UseCompatibleStateImageBehavior = false;
this.resultsListView.View = System.Windows.Forms.View.Details;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.histogramBtn);
this.groupBox1.Controls.Add(this.statisticsBtn);
this.groupBox1.Location = new System.Drawing.Point(8, 608);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(125, 93);
this.groupBox1.TabIndex = 13;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Analysis";
//
// histogramBtn
//
this.histogramBtn.Location = new System.Drawing.Point(5, 55);
this.histogramBtn.Name = "histogramBtn";
this.histogramBtn.Size = new System.Drawing.Size(114, 32);
this.histogramBtn.TabIndex = 11;
this.histogramBtn.Text = "Histograms";
this.histogramBtn.UseVisualStyleBackColor = true;
this.histogramBtn.Click += new System.EventHandler(this.histogramBtn_Click);
//
// statisticsBtn
//
this.statisticsBtn.Location = new System.Drawing.Point(5, 18);
this.statisticsBtn.Name = "statisticsBtn";
this.statisticsBtn.Size = new System.Drawing.Size(114, 32);
this.statisticsBtn.TabIndex = 10;
this.statisticsBtn.Text = "Statistics";
this.statisticsBtn.UseVisualStyleBackColor = true;
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
//
// outputGroupBox
//
this.outputGroupBox.Controls.Add(this.exportQueryResultsBtn);
this.outputGroupBox.Controls.Add(this.printQueryResultsBtn);
this.outputGroupBox.Location = new System.Drawing.Point(8, 509);
this.outputGroupBox.Name = "outputGroupBox";
this.outputGroupBox.Size = new System.Drawing.Size(125, 93);
this.outputGroupBox.TabIndex = 12;
this.outputGroupBox.TabStop = false;
this.outputGroupBox.Text = "Output";
//
// exportQueryResultsBtn
//
this.exportQueryResultsBtn.Location = new System.Drawing.Point(5, 18);
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
this.exportQueryResultsBtn.Size = new System.Drawing.Size(114, 32);
this.exportQueryResultsBtn.TabIndex = 8;
this.exportQueryResultsBtn.Text = "Export query results";
this.exportQueryResultsBtn.UseVisualStyleBackColor = true;
this.exportQueryResultsBtn.Click += new System.EventHandler(this.exportQueryResultsBtn_Click);
//
// printQueryResultsBtn
//
this.printQueryResultsBtn.Location = new System.Drawing.Point(5, 55);
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
this.printQueryResultsBtn.Size = new System.Drawing.Size(113, 32);
this.printQueryResultsBtn.TabIndex = 9;
this.printQueryResultsBtn.Text = "Print query results";
this.printQueryResultsBtn.UseVisualStyleBackColor = true;
this.printQueryResultsBtn.Click += new System.EventHandler(this.printQueryResultsBtn_Click);
//
// printerConfigBtn
//
this.printerConfigBtn.Location = new System.Drawing.Point(8, 316);
@@ -230,6 +164,36 @@
this.printerConfigBtn.UseVisualStyleBackColor = true;
this.printerConfigBtn.Click += new System.EventHandler(this.printerConfigBtn_Click);
//
// statisticsBtn
//
this.statisticsBtn.Location = new System.Drawing.Point(8, 621);
this.statisticsBtn.Name = "statisticsBtn";
this.statisticsBtn.Size = new System.Drawing.Size(125, 35);
this.statisticsBtn.TabIndex = 10;
this.statisticsBtn.Text = "Statistics";
this.statisticsBtn.UseVisualStyleBackColor = true;
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
//
// printQueryResultsBtn
//
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 548);
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
this.printQueryResultsBtn.Size = new System.Drawing.Size(125, 35);
this.printQueryResultsBtn.TabIndex = 9;
this.printQueryResultsBtn.Text = "Print query results";
this.printQueryResultsBtn.UseVisualStyleBackColor = true;
this.printQueryResultsBtn.Click += new System.EventHandler(this.printQueryResultsBtn_Click);
//
// exportQueryResultsBtn
//
this.exportQueryResultsBtn.Location = new System.Drawing.Point(8, 508);
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
this.exportQueryResultsBtn.Size = new System.Drawing.Size(125, 35);
this.exportQueryResultsBtn.TabIndex = 8;
this.exportQueryResultsBtn.Text = "Export query results";
this.exportQueryResultsBtn.UseVisualStyleBackColor = true;
this.exportQueryResultsBtn.Click += new System.EventHandler(this.exportQueryResultsBtn_Click);
//
// formatOfResultsBtn
//
this.formatOfResultsBtn.Location = new System.Drawing.Point(8, 276);
@@ -406,8 +370,6 @@
this.hSplitContainer.ResumeLayout(false);
this.filtersGroupBox.ResumeLayout(false);
this.resultsGroupBox.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.outputGroupBox.ResumeLayout(false);
this.testBenchesGroupBox.ResumeLayout(false);
this.testBenchesGroupBox.PerformLayout();
this.ResumeLayout(false);
@@ -440,8 +402,5 @@
private System.Windows.Forms.RadioButton checkBox4;
private System.Windows.Forms.Button printerConfigBtn;
private System.Windows.Forms.RadioButton checkBox6;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox outputGroupBox;
private System.Windows.Forms.Button histogramBtn;
}
}
+8 -26
View File
@@ -1,7 +1,4 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
@@ -492,7 +489,7 @@ namespace ResultsBrowser
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
///
/// Statistics options
/// Enter options
///
Forms.StatisticsOptionsDlg optionsDlg = new Forms.StatisticsOptionsDlg(items);
if (optionsDlg.ShowDialog() != DialogResult.OK) return;
@@ -500,31 +497,16 @@ namespace ResultsBrowser
///
/// Calculate statistics
///
Forms.StatisticsDlg statisticsDlg = new Forms.StatisticsDlg(waterMeters, optionsDlg, timePeriodStart, timePeriodEnd);
Forms.StatisticsDlg statisticsDlg = new Forms.StatisticsDlg(waterMeters, optionsDlg.TwoDim,
optionsDlg.RowItem, optionsDlg.RowItem2, optionsDlg.RowItem3,
optionsDlg.ColumnItem, optionsDlg.ColumnItem2, optionsDlg.ColumnItem3,
optionsDlg.RowTestSpecifier, optionsDlg.RowTestSpecifier2, optionsDlg.RowTestSpecifier3,
optionsDlg.ColumnTestSpecifier, optionsDlg.ColumnTestSpecifier2, optionsDlg.ColumnTestSpecifier3,
timePeriodStart, timePeriodEnd);
statisticsDlg.ShowDialog();
}
private void histogramBtn_Click(object sender, EventArgs e)
{
if (waterMeters == null || waterMeters.Count == 0) return;
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
///
/// Histogram options
///
Forms.HistogramOptionsDlg optionsDlg = new Forms.HistogramOptionsDlg(items);
if (optionsDlg.ShowDialog() != DialogResult.OK) return;
///
/// Calculate and display histograms
///
Forms.HistogramDlg histogramDlg = new Forms.HistogramDlg(waterMeters, optionsDlg, "Histogramy");
histogramDlg.ShowDialog();
}
/// <summary>
/// Updates component factory
/// </summary>
+99 -87
View File
@@ -27,13 +27,16 @@ namespace TBF.BenchControl.Ambient.Comet
/// <summary>The state of the measurement</summary>
MsrmntState msrmntState;
int msrmntTimeStamp;
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
float temperature; /// [°C]
float pressure; /// [bar]
float humidity; /// [R%]
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
int msrmntTimeStamp;
public Ambient()
{
@@ -61,7 +64,6 @@ namespace TBF.BenchControl.Ambient.Comet
temperature = 20.0f;
humidity = 40.0f;
pressure = 1.0f;
msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid;
return;
@@ -71,9 +73,7 @@ namespace TBF.BenchControl.Ambient.Comet
serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
serialPort.Handshake = ambientCfg.Handshake;
serialPort.Open();
msrmntTimeStamp = 0;
msrmntState = MsrmntState.Busy;
msrmntState = MsrmntState.Busy;
log.FatalFormat("Successfully initialized device {0}", ToString());
}
@@ -81,102 +81,114 @@ namespace TBF.BenchControl.Ambient.Comet
/// <summary>Run this device</summary>
public void RunDeviceBefore()
{
if ((ambientCfg.DebugLevel == DebugMode.Normal) && (serialPort != null))
{
///
/// Read response
///
try
{
int receivedBytes = serialPort.BytesToRead;
if (ambientCfg.DebugLevel == DebugMode.Simulate ||
ambientCfg.DebugLevel == DebugMode.FailureDuringOperation)
{
msrmntTimeStamp = StateMachine.Time;
return;
}
if (receivedBytes >= 13)
{
byte[] byteArr = new byte[receivedBytes];
for (int i = 0; i < receivedBytes; i++) byteArr[i] = (byte)serialPort.ReadByte();
log.Debug(Telegram.LogTelegram("Received ", byteArr));
if (serialPort == null)
{
log.ErrorFormat("{0} - RunDeviceBefore() - serial port closed", Name);
return;
}
if ((receivedBytes == 13) && (byteArr[0] == 1) && (byteArr[1] == 3) && (byteArr[2] == 8) && Telegram.VerifyTelegramCRC(byteArr))
{
int value = (int)byteArr[3] * 256 + (int)byteArr[4];
temperature = (float)value / 10.0f;
try
{
int receivedBytes = serialPort.BytesToRead;
value = (int)byteArr[5] * 256 + (int)byteArr[6];
humidity = (float)value / 10.0f;
if (receivedBytes >= 13)
{
byte[] byteArr = new byte[receivedBytes];
for (int i = 0; i < receivedBytes; i++) byteArr[i] = (byte)serialPort.ReadByte();
log.Debug(Telegram.LogTelegram("Received ", byteArr));
value = (int)byteArr[9] * 256 + (int)byteArr[10];
pressure = (float)value / 10000.0f;
if ((receivedBytes == 13) && (byteArr[0] == 1) && (byteArr[1] == 3) && (byteArr[2] == 8) && Telegram.VerifyTelegramCRC(byteArr))
{
int value = (int)byteArr[3] * 256 + (int)byteArr[4];
temperature = (float)value / 10.0f;
msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
value = (int)byteArr[5] * 256 + (int)byteArr[6];
humidity = (float)value / 10.0f;
value = (int)byteArr[9] * 256 + (int)byteArr[10];
pressure = (float)value / 10000.0f;
msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
}
catch (Exception e)
{
DebugLevel = DebugMode.FailureDuringOperation;
//serialPort.Close(); /// ?
serialPort = null;
}
}
catch (Exception e)
{
DebugLevel = DebugMode.FailureDuringOperation;
serialPort = null;
log.FatalFormat("Ambient: Serial port read failure : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
}
}
log.FatalFormat("Ambient: Serail port read failure : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
}
}
/// <summary>Run this device</summary>
public void RunDeviceAfter()
{
if ((ambientCfg.DebugLevel == DebugMode.Normal) && (serialPort != null))
{
if ((StateMachine.Time % 10) == 0)
{
///
/// Send request once per 10 seconds
///
try
{
/// Read four registers: 0x31, 0x32, 0x33, 0x34
UInt16 regAddr = 0x0030; /// register addr. = 0x31 (Modbus!)
UInt16 count = 4;
if (ambientCfg.DebugLevel == DebugMode.Simulate ||
ambientCfg.DebugLevel == DebugMode.FailureDuringOperation)
{
return;
}
/// Prepare data to be sent
byte[] msg = new byte[8];
msg[0] = 1; /// (byte)ambientCfg.BusAddress;
msg[1] = 3; /// CMD = Read registers
msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
msg[4] = (byte)(count >> 8); /// Serial Com Reference Hi
msg[5] = (byte)(count & 0xFF); /// Serial Com Reference Lo
Telegram.UpdateTelegramCRC(msg);
if (serialPort == null)
{
log.ErrorFormat("{0} - RunDeviceAfter() - serial port closed", Name);
return;
}
log.Debug(Telegram.LogTelegram("Sending ", msg));
serialPort.Write(msg, 0, msg.Length);
}
catch (Exception e)
{
DebugLevel = DebugMode.FailureDuringOperation;
//serialPort.Close(); /// ?
serialPort = null;
try
{
/// Each 10 seconds
if ((StateMachine.Time % 10) == 0)
{
/// Read four registers: 0x31, 0x32, 0x33, 0x34
UInt16 regAddr = 0x0030; /// register addr. = 0x31 (Modbus!)
UInt16 count = 4;
log.FatalFormat("Ambient: Serail port read failure : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
}
}
}
/// Prepare data to be sent
byte[] msg = new byte[8];
msg[0] = 1; /// (byte)ambientCfg.BusAddress;
msg[1] = 3; /// CMD = Read registers
msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
msg[4] = (byte)(count >> 8); /// Serial Com Reference Hi
msg[5] = (byte)(count & 0xFF); /// Serial Com Reference Lo
Telegram.UpdateTelegramCRC(msg);
log.Debug(Telegram.LogTelegram("Sending ", msg));
serialPort.Write(msg, 0, msg.Length);
}
}
catch (Exception e)
{
DebugLevel = DebugMode.FailureDuringOperation;
serialPort = null;
log.FatalFormat("Ambient: Serail port read failure : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
}
}
/// <summary>Stop this device</summary>
public void StopDevice()
{
if ((ambientCfg.DebugLevel == DebugMode.Normal) && (serialPort != null))
if (serialPort != null)
{
serialPort.Close();
serialPort = null;
@@ -194,18 +206,18 @@ namespace TBF.BenchControl.Ambient.Comet
public IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity)
{
this.tempBox = temperature;
this.tempBox = temperature;
this.pressureBox = pressure;
this.humiBox = humidity;
this.humiBox = humidity;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
if (tempBox != null) tempBox.Val = temperature;
if (tempBox != null) tempBox.Val = temperature;
if (pressureBox != null) pressureBox.Val = pressure;
if (humiBox != null) humiBox.Val = humidity;
if (humiBox != null) humiBox.Val = humidity;
}
/// <summary>Run this operation</summary>
@@ -214,9 +226,9 @@ namespace TBF.BenchControl.Ambient.Comet
/// </returns>
public Event Run()
{
if (tempBox != null) tempBox.Val = temperature;
if (tempBox != null) tempBox.Val = temperature;
if (pressureBox != null) pressureBox.Val = pressure;
if (humiBox != null) humiBox.Val = humidity;
if (humiBox != null) humiBox.Val = humidity;
return Event.AmbientDone;
}
@@ -1,794 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.DataEntry.Single
{
partial class CycleBeginningForm
{
/// <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 Windows Form 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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
this.okButton = new System.Windows.Forms.Button();
this.orderGroupBox = new System.Windows.Forms.GroupBox();
this.orderComboBox = new System.Windows.Forms.ComboBox();
this.clearButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.comboBox3 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.comboBox4 = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.comboBox5 = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.checkBox6 = new System.Windows.Forms.CheckBox();
this.comboBox6 = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.checkBox7 = new System.Windows.Forms.CheckBox();
this.comboBox7 = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.checkBox8 = new System.Windows.Forms.CheckBox();
this.comboBox8 = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.checkBox9 = new System.Windows.Forms.CheckBox();
this.comboBox9 = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.checkBox10 = new System.Windows.Forms.CheckBox();
this.comboBox10 = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.checkBox11 = new System.Windows.Forms.CheckBox();
this.comboBox11 = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.checkBox12 = new System.Windows.Forms.CheckBox();
this.comboBox12 = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.checkBox13 = new System.Windows.Forms.CheckBox();
this.comboBox13 = new System.Windows.Forms.ComboBox();
this.label13 = new System.Windows.Forms.Label();
this.checkBox14 = new System.Windows.Forms.CheckBox();
this.comboBox14 = new System.Windows.Forms.ComboBox();
this.label14 = new System.Windows.Forms.Label();
this.checkBox15 = new System.Windows.Forms.CheckBox();
this.comboBox15 = new System.Windows.Forms.ComboBox();
this.label15 = new System.Windows.Forms.Label();
this.checkBox16 = new System.Windows.Forms.CheckBox();
this.comboBox16 = new System.Windows.Forms.ComboBox();
this.label16 = new System.Windows.Forms.Label();
this.checkBox17 = new System.Windows.Forms.CheckBox();
this.comboBox17 = new System.Windows.Forms.ComboBox();
this.label17 = new System.Windows.Forms.Label();
this.checkBox18 = new System.Windows.Forms.CheckBox();
this.comboBox18 = new System.Windows.Forms.ComboBox();
this.label18 = new System.Windows.Forms.Label();
this.checkBox19 = new System.Windows.Forms.CheckBox();
this.comboBox19 = new System.Windows.Forms.ComboBox();
this.label19 = new System.Windows.Forms.Label();
this.checkBox20 = new System.Windows.Forms.CheckBox();
this.comboBox20 = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
this.checkBox21 = new System.Windows.Forms.CheckBox();
this.comboBox21 = new System.Windows.Forms.ComboBox();
this.label21 = new System.Windows.Forms.Label();
this.checkBox22 = new System.Windows.Forms.CheckBox();
this.comboBox22 = new System.Windows.Forms.ComboBox();
this.label22 = new System.Windows.Forms.Label();
this.checkBox23 = new System.Windows.Forms.CheckBox();
this.comboBox23 = new System.Windows.Forms.ComboBox();
this.label23 = new System.Windows.Forms.Label();
this.checkBox24 = new System.Windows.Forms.CheckBox();
this.comboBox24 = new System.Windows.Forms.ComboBox();
this.label24 = new System.Windows.Forms.Label();
this.orderGroupBox.SuspendLayout();
this.SuspendLayout();
//
// okButton
//
resources.ApplyResources(this.okButton, "okButton");
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Name = "okButton";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// orderGroupBox
//
this.orderGroupBox.Controls.Add(this.orderComboBox);
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
this.orderGroupBox.Name = "orderGroupBox";
this.orderGroupBox.TabStop = false;
//
// orderComboBox
//
this.orderComboBox.FormattingEnabled = true;
resources.ApplyResources(this.orderComboBox, "orderComboBox");
this.orderComboBox.Name = "orderComboBox";
//
// clearButton
//
resources.ApplyResources(this.clearButton, "clearButton");
this.clearButton.ForeColor = System.Drawing.Color.Black;
this.clearButton.Name = "clearButton";
this.clearButton.UseVisualStyleBackColor = true;
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// comboBox1
//
resources.ApplyResources(this.comboBox1, "comboBox1");
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Name = "comboBox1";
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
//
// checkBox1
//
resources.ApplyResources(this.checkBox1, "checkBox1");
this.checkBox1.Name = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true;
//
// checkBox2
//
resources.ApplyResources(this.checkBox2, "checkBox2");
this.checkBox2.Name = "checkBox2";
this.checkBox2.UseVisualStyleBackColor = true;
//
// comboBox2
//
resources.ApplyResources(this.comboBox2, "comboBox2");
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Name = "comboBox2";
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
this.comboBox2.TextChanged += new System.EventHandler(this.comboBox2_TextChanged);
this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// checkBox3
//
resources.ApplyResources(this.checkBox3, "checkBox3");
this.checkBox3.Name = "checkBox3";
this.checkBox3.UseVisualStyleBackColor = true;
//
// comboBox3
//
resources.ApplyResources(this.comboBox3, "comboBox3");
this.comboBox3.FormattingEnabled = true;
this.comboBox3.Name = "comboBox3";
this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
this.comboBox3.TextChanged += new System.EventHandler(this.comboBox3_TextChanged);
this.comboBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox3_KeyPress);
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// checkBox4
//
resources.ApplyResources(this.checkBox4, "checkBox4");
this.checkBox4.Name = "checkBox4";
this.checkBox4.UseVisualStyleBackColor = true;
//
// comboBox4
//
resources.ApplyResources(this.comboBox4, "comboBox4");
this.comboBox4.FormattingEnabled = true;
this.comboBox4.Name = "comboBox4";
this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.comboBox4_SelectedIndexChanged);
this.comboBox4.TextChanged += new System.EventHandler(this.comboBox4_TextChanged);
this.comboBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox4_KeyPress);
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// checkBox5
//
resources.ApplyResources(this.checkBox5, "checkBox5");
this.checkBox5.Name = "checkBox5";
this.checkBox5.UseVisualStyleBackColor = true;
//
// comboBox5
//
resources.ApplyResources(this.comboBox5, "comboBox5");
this.comboBox5.FormattingEnabled = true;
this.comboBox5.Name = "comboBox5";
this.comboBox5.SelectedIndexChanged += new System.EventHandler(this.comboBox5_SelectedIndexChanged);
this.comboBox5.TextChanged += new System.EventHandler(this.comboBox5_TextChanged);
this.comboBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox5_KeyPress);
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5";
//
// checkBox6
//
resources.ApplyResources(this.checkBox6, "checkBox6");
this.checkBox6.Name = "checkBox6";
this.checkBox6.UseVisualStyleBackColor = true;
//
// comboBox6
//
resources.ApplyResources(this.comboBox6, "comboBox6");
this.comboBox6.FormattingEnabled = true;
this.comboBox6.Name = "comboBox6";
this.comboBox6.SelectedIndexChanged += new System.EventHandler(this.comboBox6_SelectedIndexChanged);
this.comboBox6.TextChanged += new System.EventHandler(this.comboBox6_TextChanged);
this.comboBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox6_KeyPress);
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.Name = "label6";
//
// checkBox7
//
resources.ApplyResources(this.checkBox7, "checkBox7");
this.checkBox7.Name = "checkBox7";
this.checkBox7.UseVisualStyleBackColor = true;
//
// comboBox7
//
resources.ApplyResources(this.comboBox7, "comboBox7");
this.comboBox7.FormattingEnabled = true;
this.comboBox7.Name = "comboBox7";
this.comboBox7.SelectedIndexChanged += new System.EventHandler(this.comboBox7_SelectedIndexChanged);
this.comboBox7.TextChanged += new System.EventHandler(this.comboBox7_TextChanged);
this.comboBox7.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox7_KeyPress);
//
// label7
//
resources.ApplyResources(this.label7, "label7");
this.label7.Name = "label7";
//
// checkBox8
//
resources.ApplyResources(this.checkBox8, "checkBox8");
this.checkBox8.Name = "checkBox8";
this.checkBox8.UseVisualStyleBackColor = true;
//
// comboBox8
//
resources.ApplyResources(this.comboBox8, "comboBox8");
this.comboBox8.FormattingEnabled = true;
this.comboBox8.Name = "comboBox8";
this.comboBox8.SelectedIndexChanged += new System.EventHandler(this.comboBox8_SelectedIndexChanged);
this.comboBox8.TextChanged += new System.EventHandler(this.comboBox8_TextChanged);
this.comboBox8.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox8_KeyPress);
//
// label8
//
resources.ApplyResources(this.label8, "label8");
this.label8.Name = "label8";
//
// checkBox9
//
resources.ApplyResources(this.checkBox9, "checkBox9");
this.checkBox9.Name = "checkBox9";
this.checkBox9.UseVisualStyleBackColor = true;
//
// comboBox9
//
resources.ApplyResources(this.comboBox9, "comboBox9");
this.comboBox9.FormattingEnabled = true;
this.comboBox9.Name = "comboBox9";
this.comboBox9.SelectedIndexChanged += new System.EventHandler(this.comboBox9_SelectedIndexChanged);
this.comboBox9.TextChanged += new System.EventHandler(this.comboBox9_TextChanged);
this.comboBox9.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox9_KeyPress);
//
// label9
//
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
//
// checkBox10
//
resources.ApplyResources(this.checkBox10, "checkBox10");
this.checkBox10.Name = "checkBox10";
this.checkBox10.UseVisualStyleBackColor = true;
//
// comboBox10
//
resources.ApplyResources(this.comboBox10, "comboBox10");
this.comboBox10.FormattingEnabled = true;
this.comboBox10.Name = "comboBox10";
this.comboBox10.SelectedIndexChanged += new System.EventHandler(this.comboBox10_SelectedIndexChanged);
this.comboBox10.TextChanged += new System.EventHandler(this.comboBox10_TextChanged);
this.comboBox10.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox10_KeyPress);
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// checkBox11
//
resources.ApplyResources(this.checkBox11, "checkBox11");
this.checkBox11.Name = "checkBox11";
this.checkBox11.UseVisualStyleBackColor = true;
//
// comboBox11
//
resources.ApplyResources(this.comboBox11, "comboBox11");
this.comboBox11.FormattingEnabled = true;
this.comboBox11.Name = "comboBox11";
this.comboBox11.SelectedIndexChanged += new System.EventHandler(this.comboBox11_SelectedIndexChanged);
this.comboBox11.TextChanged += new System.EventHandler(this.comboBox11_TextChanged);
this.comboBox11.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox11_KeyPress);
//
// label11
//
resources.ApplyResources(this.label11, "label11");
this.label11.Name = "label11";
//
// checkBox12
//
resources.ApplyResources(this.checkBox12, "checkBox12");
this.checkBox12.Name = "checkBox12";
this.checkBox12.UseVisualStyleBackColor = true;
//
// comboBox12
//
resources.ApplyResources(this.comboBox12, "comboBox12");
this.comboBox12.FormattingEnabled = true;
this.comboBox12.Name = "comboBox12";
this.comboBox12.SelectedIndexChanged += new System.EventHandler(this.comboBox12_SelectedIndexChanged);
this.comboBox12.TextChanged += new System.EventHandler(this.comboBox12_TextChanged);
this.comboBox12.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox12_KeyPress);
//
// label12
//
resources.ApplyResources(this.label12, "label12");
this.label12.Name = "label12";
//
// checkBox13
//
resources.ApplyResources(this.checkBox13, "checkBox13");
this.checkBox13.Name = "checkBox13";
this.checkBox13.UseVisualStyleBackColor = true;
//
// comboBox13
//
resources.ApplyResources(this.comboBox13, "comboBox13");
this.comboBox13.FormattingEnabled = true;
this.comboBox13.Name = "comboBox13";
this.comboBox13.SelectedIndexChanged += new System.EventHandler(this.comboBox13_SelectedIndexChanged);
this.comboBox13.TextChanged += new System.EventHandler(this.comboBox13_TextChanged);
this.comboBox13.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox13_KeyPress);
//
// label13
//
resources.ApplyResources(this.label13, "label13");
this.label13.Name = "label13";
//
// checkBox14
//
resources.ApplyResources(this.checkBox14, "checkBox14");
this.checkBox14.Name = "checkBox14";
this.checkBox14.UseVisualStyleBackColor = true;
//
// comboBox14
//
resources.ApplyResources(this.comboBox14, "comboBox14");
this.comboBox14.FormattingEnabled = true;
this.comboBox14.Name = "comboBox14";
this.comboBox14.SelectedIndexChanged += new System.EventHandler(this.comboBox14_SelectedIndexChanged);
this.comboBox14.TextChanged += new System.EventHandler(this.comboBox14_TextChanged);
this.comboBox14.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox14_KeyPress);
//
// label14
//
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
//
// checkBox15
//
resources.ApplyResources(this.checkBox15, "checkBox15");
this.checkBox15.Name = "checkBox15";
this.checkBox15.UseVisualStyleBackColor = true;
//
// comboBox15
//
resources.ApplyResources(this.comboBox15, "comboBox15");
this.comboBox15.FormattingEnabled = true;
this.comboBox15.Name = "comboBox15";
this.comboBox15.SelectedIndexChanged += new System.EventHandler(this.comboBox15_SelectedIndexChanged);
this.comboBox15.TextChanged += new System.EventHandler(this.comboBox15_TextChanged);
this.comboBox15.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox15_KeyPress);
//
// label15
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
//
// checkBox16
//
resources.ApplyResources(this.checkBox16, "checkBox16");
this.checkBox16.Name = "checkBox16";
this.checkBox16.UseVisualStyleBackColor = true;
//
// comboBox16
//
resources.ApplyResources(this.comboBox16, "comboBox16");
this.comboBox16.FormattingEnabled = true;
this.comboBox16.Name = "comboBox16";
this.comboBox16.SelectedIndexChanged += new System.EventHandler(this.comboBox16_SelectedIndexChanged);
this.comboBox16.TextChanged += new System.EventHandler(this.comboBox16_TextChanged);
this.comboBox16.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox16_KeyPress);
//
// label16
//
resources.ApplyResources(this.label16, "label16");
this.label16.Name = "label16";
//
// checkBox17
//
resources.ApplyResources(this.checkBox17, "checkBox17");
this.checkBox17.Name = "checkBox17";
this.checkBox17.UseVisualStyleBackColor = true;
//
// comboBox17
//
resources.ApplyResources(this.comboBox17, "comboBox17");
this.comboBox17.FormattingEnabled = true;
this.comboBox17.Name = "comboBox17";
this.comboBox17.SelectedIndexChanged += new System.EventHandler(this.comboBox17_SelectedIndexChanged);
this.comboBox17.TextChanged += new System.EventHandler(this.comboBox17_TextChanged);
this.comboBox17.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox17_KeyPress);
//
// label17
//
resources.ApplyResources(this.label17, "label17");
this.label17.Name = "label17";
//
// checkBox18
//
resources.ApplyResources(this.checkBox18, "checkBox18");
this.checkBox18.Name = "checkBox18";
this.checkBox18.UseVisualStyleBackColor = true;
//
// comboBox18
//
resources.ApplyResources(this.comboBox18, "comboBox18");
this.comboBox18.FormattingEnabled = true;
this.comboBox18.Name = "comboBox18";
this.comboBox18.SelectedIndexChanged += new System.EventHandler(this.comboBox18_SelectedIndexChanged);
this.comboBox18.TextChanged += new System.EventHandler(this.comboBox18_TextChanged);
this.comboBox18.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox18_KeyPress);
//
// label18
//
resources.ApplyResources(this.label18, "label18");
this.label18.Name = "label18";
//
// checkBox19
//
resources.ApplyResources(this.checkBox19, "checkBox19");
this.checkBox19.Name = "checkBox19";
this.checkBox19.UseVisualStyleBackColor = true;
//
// comboBox19
//
resources.ApplyResources(this.comboBox19, "comboBox19");
this.comboBox19.FormattingEnabled = true;
this.comboBox19.Name = "comboBox19";
this.comboBox19.SelectedIndexChanged += new System.EventHandler(this.comboBox19_SelectedIndexChanged);
this.comboBox19.TextChanged += new System.EventHandler(this.comboBox19_TextChanged);
this.comboBox19.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox19_KeyPress);
//
// label19
//
resources.ApplyResources(this.label19, "label19");
this.label19.Name = "label19";
//
// checkBox20
//
resources.ApplyResources(this.checkBox20, "checkBox20");
this.checkBox20.Name = "checkBox20";
this.checkBox20.UseVisualStyleBackColor = true;
//
// comboBox20
//
resources.ApplyResources(this.comboBox20, "comboBox20");
this.comboBox20.FormattingEnabled = true;
this.comboBox20.Name = "comboBox20";
this.comboBox20.SelectedIndexChanged += new System.EventHandler(this.comboBox20_SelectedIndexChanged);
this.comboBox20.TextChanged += new System.EventHandler(this.comboBox20_TextChanged);
this.comboBox20.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox20_KeyPress);
//
// label20
//
resources.ApplyResources(this.label20, "label20");
this.label20.Name = "label20";
//
// checkBox21
//
resources.ApplyResources(this.checkBox21, "checkBox21");
this.checkBox21.Name = "checkBox21";
this.checkBox21.UseVisualStyleBackColor = true;
//
// comboBox21
//
resources.ApplyResources(this.comboBox21, "comboBox21");
this.comboBox21.FormattingEnabled = true;
this.comboBox21.Name = "comboBox21";
this.comboBox21.SelectedIndexChanged += new System.EventHandler(this.comboBox21_SelectedIndexChanged);
this.comboBox21.TextChanged += new System.EventHandler(this.comboBox21_TextChanged);
this.comboBox21.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox21_KeyPress);
//
// label21
//
resources.ApplyResources(this.label21, "label21");
this.label21.Name = "label21";
//
// checkBox22
//
resources.ApplyResources(this.checkBox22, "checkBox22");
this.checkBox22.Name = "checkBox22";
this.checkBox22.UseVisualStyleBackColor = true;
//
// comboBox22
//
resources.ApplyResources(this.comboBox22, "comboBox22");
this.comboBox22.FormattingEnabled = true;
this.comboBox22.Name = "comboBox22";
this.comboBox22.SelectedIndexChanged += new System.EventHandler(this.comboBox22_SelectedIndexChanged);
this.comboBox22.TextChanged += new System.EventHandler(this.comboBox22_TextChanged);
this.comboBox22.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox22_KeyPress);
//
// label22
//
resources.ApplyResources(this.label22, "label22");
this.label22.Name = "label22";
//
// checkBox23
//
resources.ApplyResources(this.checkBox23, "checkBox23");
this.checkBox23.Name = "checkBox23";
this.checkBox23.UseVisualStyleBackColor = true;
//
// comboBox23
//
resources.ApplyResources(this.comboBox23, "comboBox23");
this.comboBox23.FormattingEnabled = true;
this.comboBox23.Name = "comboBox23";
this.comboBox23.SelectedIndexChanged += new System.EventHandler(this.comboBox23_SelectedIndexChanged);
this.comboBox23.TextChanged += new System.EventHandler(this.comboBox23_TextChanged);
this.comboBox23.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox23_KeyPress);
//
// label23
//
resources.ApplyResources(this.label23, "label23");
this.label23.Name = "label23";
//
// checkBox24
//
resources.ApplyResources(this.checkBox24, "checkBox24");
this.checkBox24.Name = "checkBox24";
this.checkBox24.UseVisualStyleBackColor = true;
//
// comboBox24
//
resources.ApplyResources(this.comboBox24, "comboBox24");
this.comboBox24.FormattingEnabled = true;
this.comboBox24.Name = "comboBox24";
this.comboBox24.SelectedIndexChanged += new System.EventHandler(this.comboBox24_SelectedIndexChanged);
this.comboBox24.TextChanged += new System.EventHandler(this.comboBox24_TextChanged);
this.comboBox24.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox24_KeyPress);
//
// label24
//
resources.ApplyResources(this.label24, "label24");
this.label24.Name = "label24";
//
// CycleBeginningForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.Controls.Add(this.checkBox24);
this.Controls.Add(this.comboBox24);
this.Controls.Add(this.label24);
this.Controls.Add(this.checkBox23);
this.Controls.Add(this.comboBox23);
this.Controls.Add(this.label23);
this.Controls.Add(this.checkBox22);
this.Controls.Add(this.comboBox22);
this.Controls.Add(this.label22);
this.Controls.Add(this.checkBox21);
this.Controls.Add(this.comboBox21);
this.Controls.Add(this.label21);
this.Controls.Add(this.checkBox20);
this.Controls.Add(this.comboBox20);
this.Controls.Add(this.label20);
this.Controls.Add(this.checkBox19);
this.Controls.Add(this.comboBox19);
this.Controls.Add(this.label19);
this.Controls.Add(this.checkBox18);
this.Controls.Add(this.comboBox18);
this.Controls.Add(this.label18);
this.Controls.Add(this.checkBox17);
this.Controls.Add(this.comboBox17);
this.Controls.Add(this.label17);
this.Controls.Add(this.checkBox16);
this.Controls.Add(this.comboBox16);
this.Controls.Add(this.label16);
this.Controls.Add(this.checkBox15);
this.Controls.Add(this.comboBox15);
this.Controls.Add(this.label15);
this.Controls.Add(this.checkBox14);
this.Controls.Add(this.comboBox14);
this.Controls.Add(this.label14);
this.Controls.Add(this.checkBox13);
this.Controls.Add(this.comboBox13);
this.Controls.Add(this.label13);
this.Controls.Add(this.checkBox12);
this.Controls.Add(this.comboBox12);
this.Controls.Add(this.label12);
this.Controls.Add(this.checkBox11);
this.Controls.Add(this.comboBox11);
this.Controls.Add(this.label11);
this.Controls.Add(this.checkBox10);
this.Controls.Add(this.comboBox10);
this.Controls.Add(this.label10);
this.Controls.Add(this.checkBox9);
this.Controls.Add(this.comboBox9);
this.Controls.Add(this.label9);
this.Controls.Add(this.checkBox8);
this.Controls.Add(this.comboBox8);
this.Controls.Add(this.label8);
this.Controls.Add(this.checkBox7);
this.Controls.Add(this.comboBox7);
this.Controls.Add(this.label7);
this.Controls.Add(this.checkBox6);
this.Controls.Add(this.comboBox6);
this.Controls.Add(this.label6);
this.Controls.Add(this.checkBox5);
this.Controls.Add(this.comboBox5);
this.Controls.Add(this.label5);
this.Controls.Add(this.checkBox4);
this.Controls.Add(this.comboBox4);
this.Controls.Add(this.label4);
this.Controls.Add(this.checkBox3);
this.Controls.Add(this.comboBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.clearButton);
this.Controls.Add(this.orderGroupBox);
this.Controls.Add(this.okButton);
this.ForeColor = System.Drawing.Color.Black;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "CycleBeginningForm";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
this.orderGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox orderGroupBox;
private System.Windows.Forms.ComboBox orderComboBox;
private System.Windows.Forms.Button clearButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.ComboBox comboBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox checkBox4;
private System.Windows.Forms.ComboBox comboBox4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox checkBox5;
private System.Windows.Forms.ComboBox comboBox5;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.CheckBox checkBox6;
private System.Windows.Forms.ComboBox comboBox6;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox checkBox7;
private System.Windows.Forms.ComboBox comboBox7;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.CheckBox checkBox8;
private System.Windows.Forms.ComboBox comboBox8;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.CheckBox checkBox9;
private System.Windows.Forms.ComboBox comboBox9;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.CheckBox checkBox10;
private System.Windows.Forms.ComboBox comboBox10;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.CheckBox checkBox11;
private System.Windows.Forms.ComboBox comboBox11;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.CheckBox checkBox12;
private System.Windows.Forms.ComboBox comboBox12;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.CheckBox checkBox13;
private System.Windows.Forms.ComboBox comboBox13;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.CheckBox checkBox14;
private System.Windows.Forms.ComboBox comboBox14;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.CheckBox checkBox15;
private System.Windows.Forms.ComboBox comboBox15;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.CheckBox checkBox16;
private System.Windows.Forms.ComboBox comboBox16;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.CheckBox checkBox17;
private System.Windows.Forms.ComboBox comboBox17;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.CheckBox checkBox18;
private System.Windows.Forms.ComboBox comboBox18;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.CheckBox checkBox19;
private System.Windows.Forms.ComboBox comboBox19;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.CheckBox checkBox20;
private System.Windows.Forms.ComboBox comboBox20;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.CheckBox checkBox21;
private System.Windows.Forms.ComboBox comboBox21;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.CheckBox checkBox22;
private System.Windows.Forms.ComboBox comboBox22;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.CheckBox checkBox23;
private System.Windows.Forms.ComboBox comboBox23;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.CheckBox checkBox24;
private System.Windows.Forms.ComboBox comboBox24;
private System.Windows.Forms.Label label24;
}
}
@@ -1,494 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Single
{
public partial class CycleBeginningForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBeginningForm));
/// <summary> Number of water meters </summary>
public readonly int WaterMetersCount;
/// To be retrieved after the form is closed
public string PurchaseOrder;
public string[] SNText;
public bool[] Disabled;
/// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
/// <summary> Number of text boxes for serial numbers </summary>
int textBoxesCount;
Label[] labels;
ComboBox[] comboBoxes;
CheckBox[] checkBoxes;
IList<ComboBox> enabledComboBoxes;
/// <summary> Parameterless constructor for common functionality </summary>
public CycleBeginningForm()
{
InitializeComponent();
ControlBox = false;
textBoxesCount = 24;
labels = new Label[]
{
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
label21, label22, label23, label24,
};
comboBoxes = new ComboBox[]
{
comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6,
comboBox7, comboBox8, comboBox9, comboBox10, comboBox11, comboBox12,
comboBox13, comboBox14, comboBox15, comboBox16, comboBox17, comboBox18,
comboBox19, comboBox20, comboBox21, comboBox22, comboBox23, comboBox24,
};
checkBoxes = new CheckBox[]
{
checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6,
checkBox7, checkBox8, checkBox9, checkBox10, checkBox11, checkBox12,
checkBox13, checkBox14, checkBox15, checkBox16, checkBox17, checkBox18,
checkBox19, checkBox20, checkBox21, checkBox22, checkBox23, checkBox24,
};
enabledComboBoxes = new List<ComboBox>();
completed = false;
StartForceCloseHandler();
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleBeginningForm(int waterMetersCount)
: this()
{
this.WaterMetersCount = waterMetersCount;
SNText = new string[WaterMetersCount];
Disabled = new bool[WaterMetersCount];
ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize);
//Height = 147 + WaterMetersCount * 90;
}
/// <summary>
/// Make sure the layout of labels/text boxes on the screen
/// corresponds to the layout of watermeters of the test bench.
/// </summary>
/// <param name="wmsCount">Number of watermeters</param>
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
if (wmsCount < textBoxesCount && lineSize > 0)
{
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
{
for (int i = 0; i < lineSize; i++)
{
labels[dest] = labels[l * lineSize + l * gap + i];
comboBoxes[dest] = comboBoxes[l * lineSize + l * gap + i];
checkBoxes[dest] = checkBoxes[l * lineSize + l * gap + i];
dest++;
}
}
textBoxesCount = wmsCount;
}
}
private void CycleBeginningForm_Load(object sender, EventArgs e)
{
Localize();
PrepareOrderCombo(orderComboBox);
for (int i = 0; i < textBoxesCount; i++)
{
if (Program.LocalSettings.LastSNTextsCount == textBoxesCount)
{
comboBoxes[i].Items.Add((Program.LocalSettings.LastSNTexts[i] == null) ? string.Empty : Program.LocalSettings.LastSNTexts[i]);
}
labels[i].Visible = comboBoxes[i].Visible = checkBoxes[i].Visible = true;
enabledComboBoxes.Add(comboBoxes[i]);
}
}
void Localize()
{
Text = Strings.Data;
orderGroupBox.Text = Strings.Purchase_order;
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Text = Strings.Serial_Number + " " + (i + 1).ToString();
}
okButton.Text = Strings.OkBtnText;
clearButton.Text = Strings.ClearBtnText;
}
/// <summary>
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
/// </summary>
/// <param name="orderComboBox">Puchase order ComboBox</param>
void PrepareOrderCombo(ComboBox orderComboBox)
{
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
{
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
}
if (orderComboBox.Items.Count > 0)
{
orderComboBox.Text = orderComboBox.Items[0].ToString();
}
}
private void okButton_Click(object sender, EventArgs e)
{
PurchaseOrder = orderComboBox.Text;
Program.LocalSettings.UpdateHistory(orderComboBox.Text,
ref Program.LocalSettings.PurchaseOrderHistory
#if FUZHOU_150 || FUZHOU_300
, 20
#endif
);
Program.LocalSettings.LastSNTexts = SNText;
for (int i = 0; i < Math.Min(WaterMetersCount, textBoxesCount); i++)
{
SNText[i] = comboBoxes[i].Text;
Disabled[i] = !checkBoxes[i].Checked;
}
completed = true;
Close();
}
/// <summary>
/// When one combo box is updated using drop-down menu, all combo boxes
/// are updated by this function.
/// </summary>
private void UpdateAllCombos()
{
for (int i = 0; i < Math.Min(WaterMetersCount, textBoxesCount); i++)
{
comboBoxes[i].Text = Program.LocalSettings.LastSNTexts[i];
checkBoxes[i].Checked = !string.IsNullOrEmpty(comboBoxes[i].Text);
}
}
private void clearButton_Click(object sender, EventArgs e)
{
for (int i = 0; i < Math.Min(WaterMetersCount, textBoxesCount); i++)
{
comboBoxes[i].Text = string.Empty;
checkBoxes[i].Checked = false;
}
}
private void comboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox1.Text.Equals(comboBox1.Items[0])) UpdateAllCombos();
}
}
private void comboBox2_TextChanged(object sender, EventArgs e) { checkBox2.Checked = true; }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox2.Text.Equals(comboBox2.Items[0])) UpdateAllCombos();
}
}
private void comboBox3_TextChanged(object sender, EventArgs e) { checkBox3.Checked = true; }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox3.Text.Equals(comboBox3.Items[0])) UpdateAllCombos();
}
}
private void comboBox4_TextChanged(object sender, EventArgs e) { checkBox4.Checked = true; }
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox4.Text.Equals(comboBox4.Items[0])) UpdateAllCombos();
}
}
private void comboBox5_TextChanged(object sender, EventArgs e) { checkBox5.Checked = true; }
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox5.Text.Equals(comboBox5.Items[0])) UpdateAllCombos();
}
}
private void comboBox6_TextChanged(object sender, EventArgs e) { checkBox6.Checked = true; }
private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox6.Text.Equals(comboBox6.Items[0])) UpdateAllCombos();
}
}
private void comboBox7_TextChanged(object sender, EventArgs e) { checkBox7.Checked = true; }
private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox7.Text.Equals(comboBox7.Items[0])) UpdateAllCombos();
}
}
private void comboBox8_TextChanged(object sender, EventArgs e) { checkBox8.Checked = true; }
private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox8.Text.Equals(comboBox8.Items[0])) UpdateAllCombos();
}
}
private void comboBox9_TextChanged(object sender, EventArgs e) { checkBox9.Checked = true; }
private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox9.Text.Equals(comboBox9.Items[0])) UpdateAllCombos();
}
}
private void comboBox10_TextChanged(object sender, EventArgs e) { checkBox10.Checked = true; }
private void comboBox10_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox10.Text.Equals(comboBox10.Items[0])) UpdateAllCombos();
}
}
private void comboBox11_TextChanged(object sender, EventArgs e) { checkBox11.Checked = true; }
private void comboBox11_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox11.Text.Equals(comboBox11.Items[0])) UpdateAllCombos();
}
}
private void comboBox12_TextChanged(object sender, EventArgs e) { checkBox12.Checked = true; }
private void comboBox12_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox12.Text.Equals(comboBox12.Items[0])) UpdateAllCombos();
}
}
private void comboBox13_TextChanged(object sender, EventArgs e) { checkBox13.Checked = true; }
private void comboBox13_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox13.Text.Equals(comboBox13.Items[0])) UpdateAllCombos();
}
}
private void comboBox14_TextChanged(object sender, EventArgs e) { checkBox14.Checked = true; }
private void comboBox14_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox14.Text.Equals(comboBox14.Items[0])) UpdateAllCombos();
}
}
private void comboBox15_TextChanged(object sender, EventArgs e) { checkBox15.Checked = true; }
private void comboBox15_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox15.Text.Equals(comboBox15.Items[0])) UpdateAllCombos();
}
}
private void comboBox16_TextChanged(object sender, EventArgs e) { checkBox16.Checked = true; }
private void comboBox16_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox16.Text.Equals(comboBox16.Items[0])) UpdateAllCombos();
}
}
private void comboBox17_TextChanged(object sender, EventArgs e) { checkBox17.Checked = true; }
private void comboBox17_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox17.Text.Equals(comboBox17.Items[0])) UpdateAllCombos();
}
}
private void comboBox18_TextChanged(object sender, EventArgs e) { checkBox18.Checked = true; }
private void comboBox18_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox18.Text.Equals(comboBox18.Items[0])) UpdateAllCombos();
}
}
private void comboBox19_TextChanged(object sender, EventArgs e) { checkBox19.Checked = true; }
private void comboBox19_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox19.Text.Equals(comboBox19.Items[0])) UpdateAllCombos();
}
}
private void comboBox20_TextChanged(object sender, EventArgs e) { checkBox20.Checked = true; }
private void comboBox20_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox20.Text.Equals(comboBox20.Items[0])) UpdateAllCombos();
}
}
private void comboBox21_TextChanged(object sender, EventArgs e) { checkBox21.Checked = true; }
private void comboBox21_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox21.Text.Equals(comboBox21.Items[0])) UpdateAllCombos();
}
}
private void comboBox22_TextChanged(object sender, EventArgs e) { checkBox22.Checked = true; }
private void comboBox22_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox22.Text.Equals(comboBox22.Items[0])) UpdateAllCombos();
}
}
private void comboBox23_TextChanged(object sender, EventArgs e) { checkBox23.Checked = true; }
private void comboBox23_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox23.Text.Equals(comboBox23.Items[0])) UpdateAllCombos();
}
}
private void comboBox24_TextChanged(object sender, EventArgs e) { checkBox24.Checked = true; }
private void comboBox24_SelectedIndexChanged(object sender, EventArgs e)
{
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
{
if (comboBox24.Text.Equals(comboBox24.Items[0])) UpdateAllCombos();
}
}
#region Forced close handling
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
private void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
/// <summary>
/// Process a key press within any enabled text boxe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <param name="currentFocusOwner">TextBox control which received the event</param>
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
{
if (e.KeyChar == '+')
{
/// Process '+' key ..... Form completed
okButton_Click(sender, e);
}
if (e.KeyChar == '\r')
{
/// Process <enter> key ..... Next text field
if (enabledComboBoxes.Count < 2) return; /// There is just one enabled textbox
for (int i = 0; i < enabledComboBoxes.Count; i++)
{
if (enabledComboBoxes[i] == currentFocusOwner)
{
/// Change focus to the next enabled text box
enabledComboBoxes[(i + 1) % enabledComboBoxes.Count].Focus();
return;
}
}
}
}
private void comboBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox1); }
private void comboBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox2); }
private void comboBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox3); }
private void comboBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox4); }
private void comboBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox5); }
private void comboBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox6); }
private void comboBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox7); }
private void comboBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox8); }
private void comboBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox9); }
private void comboBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox10); }
private void comboBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox11); }
private void comboBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox12); }
private void comboBox13_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox13); }
private void comboBox14_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox14); }
private void comboBox15_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox15); }
private void comboBox16_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox16); }
private void comboBox17_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox17); }
private void comboBox18_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox18); }
private void comboBox19_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox19); }
private void comboBox20_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox20); }
private void comboBox21_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox21); }
private void comboBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox22); }
private void comboBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox23); }
private void comboBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, comboBox24); }
}
}
File diff suppressed because it is too large Load Diff
-652
View File
@@ -1,652 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.DataEntry.Single
{
partial class CycleEndForm
{
/// <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 Windows Form 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.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox7 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox8 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox9 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.textBox10 = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.textBox11 = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.textBox12 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.textBox13 = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.textBox14 = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.textBox15 = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
this.textBox16 = new System.Windows.Forms.TextBox();
this.label16 = new System.Windows.Forms.Label();
this.textBox17 = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.textBox18 = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.textBox19 = new System.Windows.Forms.TextBox();
this.label19 = new System.Windows.Forms.Label();
this.textBox20 = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.textBox21 = new System.Windows.Forms.TextBox();
this.label21 = new System.Windows.Forms.Label();
this.textBox22 = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.textBox23 = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.textBox24 = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(205, 66);
this.textBox2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(169, 27);
this.textBox2.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(38, 71);
this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(62, 18);
this.label2.TabIndex = 0;
this.label2.Text = "Stand:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(205, 30);
this.textBox1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(169, 27);
this.textBox1.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(38, 35);
this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 18);
this.label1.TabIndex = 0;
this.label1.Text = "Stand:";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(832, 30);
this.okButton.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(90, 60);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(205, 102);
this.textBox3.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(169, 27);
this.textBox3.TabIndex = 1;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(38, 107);
this.label3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 18);
this.label3.TabIndex = 0;
this.label3.Text = "Stand:";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(205, 138);
this.textBox4.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(169, 27);
this.textBox4.TabIndex = 1;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(38, 143);
this.label4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(62, 18);
this.label4.TabIndex = 0;
this.label4.Text = "Stand:";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(205, 174);
this.textBox5.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(169, 27);
this.textBox5.TabIndex = 1;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(38, 179);
this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(62, 18);
this.label5.TabIndex = 0;
this.label5.Text = "Stand:";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(205, 210);
this.textBox6.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(169, 27);
this.textBox6.TabIndex = 1;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(38, 215);
this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(62, 18);
this.label6.TabIndex = 0;
this.label6.Text = "Stand:";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(205, 246);
this.textBox7.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(169, 27);
this.textBox7.TabIndex = 9;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(38, 251);
this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(62, 18);
this.label7.TabIndex = 8;
this.label7.Text = "Stand:";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(205, 282);
this.textBox8.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(169, 27);
this.textBox8.TabIndex = 11;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(38, 287);
this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(62, 18);
this.label8.TabIndex = 10;
this.label8.Text = "Stand:";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(205, 318);
this.textBox9.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(169, 27);
this.textBox9.TabIndex = 13;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(38, 323);
this.label9.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(62, 18);
this.label9.TabIndex = 12;
this.label9.Text = "Stand:";
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(205, 354);
this.textBox10.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(169, 27);
this.textBox10.TabIndex = 15;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(38, 359);
this.label10.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(62, 18);
this.label10.TabIndex = 14;
this.label10.Text = "Stand:";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(205, 390);
this.textBox11.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(169, 27);
this.textBox11.TabIndex = 17;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(38, 395);
this.label11.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(62, 18);
this.label11.TabIndex = 16;
this.label11.Text = "Stand:";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(205, 426);
this.textBox12.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox12.Name = "textBox12";
this.textBox12.Size = new System.Drawing.Size(169, 27);
this.textBox12.TabIndex = 19;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(38, 431);
this.label12.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(62, 18);
this.label12.TabIndex = 18;
this.label12.Text = "Stand:";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(623, 30);
this.textBox13.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox13.Name = "textBox13";
this.textBox13.Size = new System.Drawing.Size(169, 27);
this.textBox13.TabIndex = 21;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(456, 35);
this.label13.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(62, 18);
this.label13.TabIndex = 20;
this.label13.Text = "Stand:";
//
// textBox14
//
this.textBox14.Location = new System.Drawing.Point(623, 66);
this.textBox14.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox14.Name = "textBox14";
this.textBox14.Size = new System.Drawing.Size(169, 27);
this.textBox14.TabIndex = 23;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(456, 71);
this.label14.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(62, 18);
this.label14.TabIndex = 22;
this.label14.Text = "Stand:";
//
// textBox15
//
this.textBox15.Location = new System.Drawing.Point(623, 102);
this.textBox15.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox15.Name = "textBox15";
this.textBox15.Size = new System.Drawing.Size(169, 27);
this.textBox15.TabIndex = 25;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(456, 107);
this.label15.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(62, 18);
this.label15.TabIndex = 24;
this.label15.Text = "Stand:";
//
// textBox16
//
this.textBox16.Location = new System.Drawing.Point(623, 138);
this.textBox16.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox16.Name = "textBox16";
this.textBox16.Size = new System.Drawing.Size(169, 27);
this.textBox16.TabIndex = 27;
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(456, 143);
this.label16.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(62, 18);
this.label16.TabIndex = 26;
this.label16.Text = "Stand:";
//
// textBox17
//
this.textBox17.Location = new System.Drawing.Point(623, 174);
this.textBox17.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox17.Name = "textBox17";
this.textBox17.Size = new System.Drawing.Size(169, 27);
this.textBox17.TabIndex = 29;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(456, 179);
this.label17.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(62, 18);
this.label17.TabIndex = 28;
this.label17.Text = "Stand:";
//
// textBox18
//
this.textBox18.Location = new System.Drawing.Point(623, 210);
this.textBox18.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox18.Name = "textBox18";
this.textBox18.Size = new System.Drawing.Size(169, 27);
this.textBox18.TabIndex = 31;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(456, 215);
this.label18.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(62, 18);
this.label18.TabIndex = 30;
this.label18.Text = "Stand:";
//
// textBox19
//
this.textBox19.Location = new System.Drawing.Point(623, 246);
this.textBox19.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox19.Name = "textBox19";
this.textBox19.Size = new System.Drawing.Size(169, 27);
this.textBox19.TabIndex = 33;
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(456, 251);
this.label19.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(62, 18);
this.label19.TabIndex = 32;
this.label19.Text = "Stand:";
//
// textBox20
//
this.textBox20.Location = new System.Drawing.Point(623, 282);
this.textBox20.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox20.Name = "textBox20";
this.textBox20.Size = new System.Drawing.Size(169, 27);
this.textBox20.TabIndex = 35;
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(456, 287);
this.label20.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(62, 18);
this.label20.TabIndex = 34;
this.label20.Text = "Stand:";
//
// textBox21
//
this.textBox21.Location = new System.Drawing.Point(623, 318);
this.textBox21.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox21.Name = "textBox21";
this.textBox21.Size = new System.Drawing.Size(169, 27);
this.textBox21.TabIndex = 37;
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(456, 323);
this.label21.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(62, 18);
this.label21.TabIndex = 36;
this.label21.Text = "Stand:";
//
// textBox22
//
this.textBox22.Location = new System.Drawing.Point(623, 354);
this.textBox22.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox22.Name = "textBox22";
this.textBox22.Size = new System.Drawing.Size(169, 27);
this.textBox22.TabIndex = 39;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(456, 359);
this.label22.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(62, 18);
this.label22.TabIndex = 38;
this.label22.Text = "Stand:";
//
// textBox23
//
this.textBox23.Location = new System.Drawing.Point(623, 390);
this.textBox23.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox23.Name = "textBox23";
this.textBox23.Size = new System.Drawing.Size(169, 27);
this.textBox23.TabIndex = 41;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(456, 395);
this.label23.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(62, 18);
this.label23.TabIndex = 40;
this.label23.Text = "Stand:";
//
// textBox24
//
this.textBox24.Location = new System.Drawing.Point(623, 426);
this.textBox24.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox24.Name = "textBox24";
this.textBox24.Size = new System.Drawing.Size(169, 27);
this.textBox24.TabIndex = 43;
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(456, 431);
this.label24.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(62, 18);
this.label24.TabIndex = 42;
this.label24.Text = "Stand:";
//
// CycleEndForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(959, 489);
this.Controls.Add(this.textBox24);
this.Controls.Add(this.label24);
this.Controls.Add(this.textBox23);
this.Controls.Add(this.label23);
this.Controls.Add(this.textBox22);
this.Controls.Add(this.label22);
this.Controls.Add(this.textBox21);
this.Controls.Add(this.label21);
this.Controls.Add(this.textBox20);
this.Controls.Add(this.label20);
this.Controls.Add(this.textBox19);
this.Controls.Add(this.label19);
this.Controls.Add(this.textBox18);
this.Controls.Add(this.label18);
this.Controls.Add(this.textBox17);
this.Controls.Add(this.label17);
this.Controls.Add(this.textBox16);
this.Controls.Add(this.label16);
this.Controls.Add(this.textBox15);
this.Controls.Add(this.label15);
this.Controls.Add(this.textBox14);
this.Controls.Add(this.label14);
this.Controls.Add(this.textBox13);
this.Controls.Add(this.label13);
this.Controls.Add(this.textBox12);
this.Controls.Add(this.label12);
this.Controls.Add(this.textBox11);
this.Controls.Add(this.label11);
this.Controls.Add(this.textBox10);
this.Controls.Add(this.label10);
this.Controls.Add(this.textBox9);
this.Controls.Add(this.label9);
this.Controls.Add(this.textBox8);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.label7);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.label6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.okButton);
this.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.Name = "CycleEndForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Daten";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleEndForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox textBox12;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox13;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textBox14;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox textBox15;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.TextBox textBox16;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox textBox17;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox textBox18;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TextBox textBox19;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.TextBox textBox20;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.TextBox textBox21;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.TextBox textBox22;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox textBox23;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.TextBox textBox24;
private System.Windows.Forms.Label label24;
}
}
@@ -1,155 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Single
{
public partial class CycleEndForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm));
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly int lineSize;
// To be retrieved after the form closes
public string[] EndStateText;
// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
int textBoxesCount;
Label[] labels;
TextBox[] textBoxes;
/// <summary>
/// Constructor
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm()
{
InitializeComponent();
ControlBox = false;
labels = new Label[]
{
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
label21, label22, label23, label24,
};
textBoxes = new TextBox[]
{
textBox1, textBox2, textBox3, textBox4, textBox5, textBox6,
textBox7, textBox8, textBox9, textBox10, textBox11, textBox12,
textBox13, textBox14, textBox15, textBox16, textBox17, textBox18,
textBox19, textBox20, textBox21, textBox22, textBox23, textBox24,
};
textBoxesCount = textBoxes.Length;
this.WaterMetersCount = textBoxesCount;
this.lineSize = textBoxesCount / 2;
completed = false;
StartForceCloseHandler();
}
/// <summary> Parameterless constructor for 3 watermeters </summary>
public CycleEndForm(int waterMetersCount, int lineSize)
: this()
{
this.WaterMetersCount = waterMetersCount;
this.lineSize = lineSize;
ShuffleTextBoxes(waterMetersCount, lineSize);
EndStateText = new string[WaterMetersCount];
}
/// <summary>
/// Make sure the layout of labels/text boxes on the screen
/// corresponds to the layout of watermeters of the test bench.
/// </summary>
/// <param name="wmsCount">Number of watermeters</param>
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
if (wmsCount < textBoxesCount && lineSize > 0)
{
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
{
for (int i = 0; i < lineSize; i++)
{
labels[dest] = labels[l * lineSize + l * gap + i];
textBoxes[dest] = textBoxes[l * lineSize + l * gap + i];
dest++;
}
}
textBoxesCount = wmsCount;
}
}
private void CycleEndForm_Load(object sender, EventArgs e)
{
Localize();
Height = 60 + 36 * lineSize;
for (int i = 0; i < textBoxesCount; i++)
{
if (i >= WaterMetersCount)
{
labels[i].Visible = false;
textBoxes[i].Visible = false;
}
}
}
void Localize()
{
Text = Strings.Data;
okButton.Text = Strings.OkBtnText;
for (int i = 0; i < WaterMetersCount; i++)
{
labels[i].Text = string.Format("{0} {1}:", Strings.Water_Meter, (i + 1).ToString());
}
}
private void okButton_Click(object sender, EventArgs e)
{
for (int i = 0; i < WaterMetersCount; i++)
{
EndStateText[i] = textBoxes[i].Text;
}
completed = true;
Close();
}
#region Forced close handling
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
}
}
@@ -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>
@@ -1,20 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Single
{
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
{
public EntryForm()
: base()
{
}
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
}
}
}
@@ -1,45 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Single
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new EntryFormCfgCtrl(); }
///
/// Serialized parameters
///
public bool EnterSerialNrsAtTheEnd;
public bool ShowCycleEndForm;
/// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg()
{
Name = "DataEntry-Standard-24";
ParentName = string.Empty;
EnterSerialNrsAtTheEnd = false;
ShowCycleEndForm = false;
}
public EntryFormCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, EnterSNsAtTheEnd={1}, ShowEndForm={2}", Name, EnterSerialNrsAtTheEnd, ShowCycleEndForm);
}
}
}
@@ -1,83 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Single
{
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()
{
enterSNsAtTheEndCheckBox.Text = Strings.Enter_SNs_at_the_end;
showEndStateFormCheckBox.Text = Strings.Show_cycle_end_form;
}
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;
enterSNsAtTheEndCheckBox.Checked = config.EnterSerialNrsAtTheEnd;
showEndStateFormCheckBox.Checked = config.ShowCycleEndForm;
}
public void Unlock()
{
nameTextBox.Enabled = true;
enterSNsAtTheEndCheckBox.Enabled = true;
showEndStateFormCheckBox.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.EnterSerialNrsAtTheEnd = enterSNsAtTheEndCheckBox.Checked;
config.ShowCycleEndForm = showEndStateFormCheckBox.Checked;
return flags;
}
}
}
@@ -1,114 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.DataEntry.Single
{
partial class EntryFormCfgCtrl
{
/// <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.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(99, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(35, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(96, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// showEndStateFormCheckBox
//
this.showEndStateFormCheckBox.AutoSize = true;
this.showEndStateFormCheckBox.Enabled = false;
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(99, 112);
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
this.showEndStateFormCheckBox.TabIndex = 4;
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
//
// enterSNsAtTheEndCheckBox
//
this.enterSNsAtTheEndCheckBox.AutoSize = true;
this.enterSNsAtTheEndCheckBox.Enabled = false;
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(99, 89);
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
this.enterSNsAtTheEndCheckBox.TabIndex = 3;
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
//
// EntryFormCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
this.Controls.Add(this.showEndStateFormCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "EntryFormCfgCtrl";
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;
private System.Windows.Forms.CheckBox showEndStateFormCheckBox;
private System.Windows.Forms.CheckBox enterSNsAtTheEndCheckBox;
}
}
@@ -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>
@@ -1,288 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Single
{
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
string purchaseOrder;
public string PurchaseOrder { get { return purchaseOrder; } }
bool[] disabled; /// This array is shared between forms
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
double[] wmStartState;
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
double[] wmEndState;
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
EnterTestStartStates,
EnterTestEndStates,
}
CurrentOp currentOp;
public EntryFormNoStartEnd()
{
}
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
disabled = new bool[Config.Data.WMsCount];
wmStartState = new double[Config.Data.WMsCount];
wmStartStateStr = new string[Config.Data.WMsCount];
wmEndState = new double[Config.Data.WMsCount];
wmCycleEndState = new string[Config.Data.WMsCount];
currentOp = CurrentOp.None;
log.Debug(this.ToString());
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
this.regReaders = regReaders;
return this;
}
/// <returns>Reference to the operation</returns>
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.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
///
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount, Config.Data.LineSize);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, Config.Data.LineSize, myRef.regReaders, myRef.disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, Config.Data.LineSize, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.EnterTestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{
if (waterMeters[i] != null)
{
waterMeters[i].SerialNr = dlg.SNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
}
}
}
}
else if (entryFormCfg.ShowCycleEndForm && currentOp == CurrentOp.ShowFormAtCycleEnd)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmEndState[i] = dlg.WMEndState[i];
}
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if ((wm != null) && !wm.Disabled && (PurchaseOrder != null))
{
wm.PurchaseOrder = PurchaseOrder; /// PurchaseOrder == null if form button OK has not been used => no update
}
}
}
}
}
@@ -1,26 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Single
{
public class Factory : IComponentFactory
{
public string ClassName { get { return "DataEntry.Single"; } }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}
@@ -1,26 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.DataEntry.Single
{
public class FactoryNoStartEnd : IComponentFactory
{
public string ClassName { get { return "DataEntry.NoStartEnd.Single"; } }
public void ResetStaticProperties() { EntryFormNoStartEnd.ResetStaticProperties(); }
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}
@@ -1,360 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
namespace TBF.BenchControl.DataEntry.Single
{
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
public double[] WMStartState;
// To be retrieved after the form closes
public readonly string[] WMStartStateStr;
// To be retrieved after the form closes
public double[] WMEndState;
bool endStates; /// false=start states, true=end states
double refVolume;
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
bool fixedErrorLimits; /// false in case of calculated error limits
Button okButton;
Label[] labels;
TextBox[] startTextBoxes;
TextBox[] endTextBoxes;
Label[] exclamations;
///
IList<TextBox> enabledTextBoxes;
IList<int> enabledWmNrs;
public TestStartEndForm()
{
}
/// <summary>
/// Parameterless constructor initializing common part for start and endstate form
/// </summary>
public TestStartEndForm(int waterMetersCount, int lineSize)
{
InitializeComponent();
ControlBox = false;
WaterMetersCount = waterMetersCount;
okButton = new Button()
{
};
labels = new Label[waterMetersCount];
startTextBoxes = new TextBox[waterMetersCount];
endTextBoxes = new TextBox[waterMetersCount];
exclamations = new Label[waterMetersCount];
for (int i = 0; i < waterMetersCount; i++)
{
labels[i] = new Label();
startTextBoxes[i] = new TextBox();
endTextBoxes[i] = new TextBox();
exclamations[i] = new Label();
}
enabledTextBoxes = new List<TextBox>();
enabledWmNrs = new List<int>();
completed = false;
StartForceCloseHandler();
}
/// <summary>
/// Constructor to fill in start states
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, int lineSize, IRegisterReader[] regReaders, bool[] disabled)
: this(waterMetersCount, lineSize)
{
endStates = false;
this.WaterMetersCount = waterMetersCount;
this.regReaders = regReaders;
this.disabled = disabled;
WMStartState = new double[waterMetersCount];
WMStartStateStr = new string[waterMetersCount];
}
/// <summary>
/// Constructor to fill in end states
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="wmStartStateStr">Information entered on test start</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, int lineSize, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this(waterMetersCount, lineSize)
{
endStates = true;
this.WaterMetersCount = waterMetersCount;
this.regReaders = regReaders;
if (wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
throw (new Exception("Invalid 'wmStartStateStr' argument"));
this.WMStartStateStr = wmStartStateStr;
this.disabled = disabled;
this.refVolume = refVolume;
this.warningLimLo = 2 * errLimLo;
this.warningLimHi = 2 * errLimHi;
this.fixedErrorLimits = (errLimHi > errLimLo);
WMEndState = new double[waterMetersCount];
}
private void CycleEndForm_Load(object sender, EventArgs e)
{
Localize();
//Height = 115 + 90 * WaterMetersCount;
int firstWmIx = -1;
if (endStates)
{
for (int i = 0; i < WaterMetersCount; i++)
{
if (WMStartStateStr != null && i < WMStartStateStr.Length)
{
startTextBoxes[i].Text = WMStartStateStr[i];
}
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
{
endTextBoxes[i].Enabled = false;
}
else
{
endTextBoxes[i].Enabled = true;
enabledTextBoxes.Add(endTextBoxes[i]);
enabledWmNrs.Add(i);
if (firstWmIx == -1) firstWmIx = i;
}
}
}
else
{
for (int i = 0; i < WaterMetersCount; i++)
{
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
{
startTextBoxes[i].Enabled = false;
}
else
{
startTextBoxes[i].Enabled = true;
enabledTextBoxes.Add(startTextBoxes[i]);
enabledWmNrs.Add(i);
if (firstWmIx == -1) firstWmIx = i;
}
}
}
if (enabledTextBoxes.Count > 0)
{
enabledTextBoxes[0].Focus();
//largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, firstWmIx + 1, string.Empty);
}
}
void Localize()
{
Text = Strings.Water_Meter_States;
for (int i = 0; i < WaterMetersCount; i++)
{
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
}
//startLabel.Text = startLabel2.Text = Strings.Start;
//endLabel.Text = endLabel2.Text = Strings.End;
okButton.Text = Strings.OkBtnText;
}
private void okButton_Click(object sender, EventArgs eArgs)
{
try
{
if (endStates)
{
for (int i = 0; i < WaterMetersCount; i++)
{
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
{
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
}
}
}
else
{
for (int i = 0; i < WaterMetersCount; i++)
{
if (startTextBoxes[i].Visible && startTextBoxes[i].Enabled)
{
WMStartStateStr[i] = startTextBoxes[i].Text;
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
}
}
}
}
catch(Exception e)
{
log.ErrorFormat("Exception: {0}", e.Message);
return;
}
completed = true;
Close();
}
#region Forced close handling
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
/// <summary>
/// Calculate the approximate error and verify whether it is within limits.
/// Make an exclamation mark visible if out of range.
/// Similar event handler is implemented for all endTextBoxes (1..24).
/// </summary>
private void ProcEndTextChanged(object sender, EventArgs e, TextBox endTBox)
{
int wmIx = -1;
for (int i = 0; i < startTextBoxes.Length; i++)
{
if (endTextBoxes[i] == endTBox)
{
wmIx = i;
break;
}
}
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
exclamations[wmIx].Visible = errorOoR;
//largeExclamationLabel.Visible = errorOoR;
//largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
}
//private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
//private void endTextBox2_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox2); }
//private void endTextBox3_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox3); }
//private void endTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox1); }
//private void endTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox2); }
//private void endTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox3); }
/// <summary>
/// Process a key press within any enabled text boxe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <param name="currentFocusOwner">TextBox control which received the event</param>
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
{
if (e.KeyChar == '+')
{
/// Process '+' key ..... Form completed
okButton_Click(sender, e);
}
if (e.KeyChar == '\r')
{
/// Process <enter> key ..... Next text field
if (enabledTextBoxes.Count < 2) return; /// There is just one enabled textbox
for (int i = 0; i < enabledTextBoxes.Count; i++)
{
if (enabledTextBoxes[i] == currentFocusOwner)
{
/// Change focus to the next enabled text box
int newTBIdx = (i + 1) % enabledTextBoxes.Count;
enabledTextBoxes[newTBIdx].Focus();
//largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, enabledWmNrs[newTBIdx] + 1, enabledTextBoxes[newTBIdx].Text);
//largeExclamationLabel.Visible = false;
return;
}
}
}
}
//private void startTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox1); }
//private void startTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox2); }
//private void startTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox3); }
//private void endTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox1); }
//private void endTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox2); }
//private void endTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox3); }
private void ProcStartTextChanged(object sender, EventArgs e, TextBox startTBox)
{
int wmIx = -1;
for (int i = 0; i < startTextBoxes.Length; i++)
{
if (startTextBoxes[i] == startTBox) { wmIx = i; break; }
}
//largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, startTextBoxes[wmIx].Text);
//largeExclamationLabel.Visible = false;
}
//private void startTextBox1_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
//private void startTextBox2_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
//private void startTextBox3_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
//private void startTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
//private void startTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
//private void startTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
}
}
@@ -1,81 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.DataEntry.Single
{
partial class TestStartEndForm
{
/// <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 Windows Form 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.splitContainer1 = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.DarkGoldenrod;
this.splitContainer1.Size = new System.Drawing.Size(270, 237);
this.splitContainer1.SplitterDistance = 90;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// TestStartEndForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(270, 237);
this.Controls.Add(this.splitContainer1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "TestStartEndForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "End States";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleEndForm_Load);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
}
}
@@ -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>
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, disabled);
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, myRef.regReaders, disabled);
modelessDlg.Show();
}
///
@@ -229,11 +229,8 @@ namespace TBF.BenchControl.DataEntry.Standard12
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
@@ -245,10 +242,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmEndState[i] = dlg.WMEndState[i];
}
wmEndState[i] = dlg.WMEndState[i];
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -133,10 +133,10 @@ namespace TBF.BenchControl.DataEntry.Standard12
/// </summary>
void ShuffleTextBoxes()
{
if (TextBoxesCount > WaterMetersCount)
if (Config.Data.WMsCount < TextBoxesCount)
{
int nrLines = WaterMetersCount / Config.Data.LineSize;
int gap = (TextBoxesCount - WaterMetersCount) / nrLines;
int nrLines = Config.Data.WMsCount / Config.Data.LineSize;
int gap = (TextBoxesCount - Config.Data.WMsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
@@ -149,7 +149,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
dest++;
}
}
TextBoxesCount = WaterMetersCount;
TextBoxesCount = Config.Data.WMsCount;
}
}
@@ -165,8 +165,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
}
}
bool focusSet = false;
if (endStates)
if (endStates)
{
for (int i = 0; i < TextBoxesCount; i++)
{
@@ -175,7 +174,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
startTextBoxes[i].Text = WMStartStateStr[i];
}
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
if (disabled != null && i < disabled.Length && disabled[i])
{
endTextBoxes[i].Enabled = false;
}
@@ -183,20 +182,14 @@ namespace TBF.BenchControl.DataEntry.Standard12
{
endTextBoxes[i].Enabled = true;
enabledTextBoxes.Add(endTextBoxes[i]);
if (!focusSet)
{
endTextBoxes[i].Focus();
focusSet = true;
}
}
}
}
}
else
{
for (int i = 0; i < TextBoxesCount; i++)
{
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
if (disabled != null && i < disabled.Length && disabled[i])
{
startTextBoxes[i].Enabled = false;
}
@@ -204,13 +197,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
{
startTextBoxes[i].Enabled = true;
enabledTextBoxes.Add(startTextBoxes[i]);
if (!focusSet)
{
startTextBoxes[i].Focus();
focusSet = true;
}
}
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, myRef.disabled);
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, myRef.regReaders, myRef.disabled);
modelessDlg.Show();
}
///
@@ -229,11 +229,8 @@ namespace TBF.BenchControl.DataEntry.Standard24
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
@@ -245,10 +242,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmEndState[i] = dlg.WMEndState[i];
}
wmEndState[i] = dlg.WMEndState[i];
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -43,10 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
Label[] labels;
TextBox[] startTextBoxes;
TextBox[] endTextBoxes;
Label[] exclamations;
IList<TextBox> activeTextBoxes;
IList<int> activeWmNrs;
IList<TextBox> enabledTextBoxes;
/// <summary>
/// Parameterless constructor initializing common part for start and endstate form
@@ -78,16 +75,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
endTextBox13, endTextBox14, endTextBox15, endTextBox16, endTextBox17, endTextBox18,
endTextBox19, endTextBox20, endTextBox21, endTextBox22, endTextBox23, endTextBox24,
};
exclamations = new Label[]
{
exclamation1, exclamation2, exclamation3, exclamation4, exclamation5, exclamation6,
exclamation7, exclamation8, exclamation9, exclamation10, exclamation11, exclamation12,
exclamation13, exclamation14, exclamation15, exclamation16, exclamation17, exclamation18,
exclamation19, exclamation20, exclamation21, exclamation22, exclamation23, exclamation24,
};
activeTextBoxes = new List<TextBox>();
activeWmNrs = new List<int>();
enabledTextBoxes = new List<TextBox>();
completed = false;
StartForceCloseHandler();
@@ -150,10 +138,10 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// </summary>
void ShuffleTextBoxes()
{
if (TextBoxesCount > WaterMetersCount)
if (Config.Data.WMsCount < TextBoxesCount)
{
int nrLines = WaterMetersCount / Config.Data.LineSize;
int gap = (TextBoxesCount - WaterMetersCount) / nrLines;
int nrLines = Config.Data.WMsCount / Config.Data.LineSize;
int gap = (TextBoxesCount - Config.Data.WMsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
@@ -163,11 +151,10 @@ namespace TBF.BenchControl.DataEntry.Standard24
labels[dest] = labels[l * Config.Data.LineSize + l * gap + i];
startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i];
endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i];
exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i];
dest++;
dest++;
}
}
TextBoxesCount = WaterMetersCount;
TextBoxesCount = Config.Data.WMsCount;
}
}
@@ -185,9 +172,8 @@ namespace TBF.BenchControl.DataEntry.Standard24
}
}
if (endStates)
if (endStates)
{
/// End of test
for (int i = 0; i < TextBoxesCount; i++)
{
if (WMStartStateStr != null && i < WMStartStateStr.Length)
@@ -195,41 +181,32 @@ namespace TBF.BenchControl.DataEntry.Standard24
startTextBoxes[i].Text = WMStartStateStr[i];
}
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
if (disabled != null && i < disabled.Length && disabled[i])
{
endTextBoxes[i].Enabled = false;
}
else
{
endTextBoxes[i].Enabled = true;
activeTextBoxes.Add(endTextBoxes[i]);
activeWmNrs.Add(i);
}
enabledTextBoxes.Add(endTextBoxes[i]);
}
}
}
else
{
/// Start of test
{
for (int i = 0; i < TextBoxesCount; i++)
{
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
if (disabled != null && i < disabled.Length && disabled[i])
{
startTextBoxes[i].Enabled = false;
}
else
{
startTextBoxes[i].Enabled = true;
activeTextBoxes.Add(startTextBoxes[i]);
activeWmNrs.Add(i);
}
enabledTextBoxes.Add(startTextBoxes[i]);
}
}
}
if ((activeTextBoxes.Count > 0) && (activeWmNrs.Count > 0))
{
activeTextBoxes[0].Focus();
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[0] + 1, string.Empty);
}
}
void Localize()
@@ -237,7 +214,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
Text = Strings.Water_Meter_States;
for (int i = 0; i < TextBoxesCount; i++)
{
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
labels[i].Text = Strings.Water_Meter + " " + (i + 1).ToString();
}
startLabel.Text = startLabel2.Text = Strings.Start;
endLabel.Text = endLabel2.Text = Strings.End;
@@ -299,88 +276,301 @@ namespace TBF.BenchControl.DataEntry.Standard24
#endregion
/// <summary>
/// Calculate the approximate error and verify whether it is within limits.
/// Make an exclamation mark visible if out of range.
/// Similar event handler is implemented for all endTextBoxes (1..24).
/// </summary>
private void endTextBox1_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox1.Text);
double startState = Utils.ParseUDouble(startTextBox1.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { };
exclamation1.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox2_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox2.Text);
double startState = Utils.ParseUDouble(startTextBox2.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation2.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox3_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox3.Text);
double startState = Utils.ParseUDouble(startTextBox3.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation3.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox4_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox4.Text);
double startState = Utils.ParseUDouble(startTextBox4.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation4.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox5_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox5.Text);
double startState = Utils.ParseUDouble(startTextBox5.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation5.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox6_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox6.Text);
double startState = Utils.ParseUDouble(startTextBox6.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation6.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox7_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox7.Text);
double startState = Utils.ParseUDouble(startTextBox7.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation7.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox8_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox8.Text);
double startState = Utils.ParseUDouble(startTextBox8.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation8.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox9_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox9.Text);
double startState = Utils.ParseUDouble(startTextBox9.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation9.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
/// <summary>
/// Calculate the approximate error and verify whether it is within limits.
/// Make an exclamation mark visible if out of range.
/// Similar event handler is implemented for all endTextBoxes (1..24).
/// </summary>
private void ProcEndTextChanged(object sender, EventArgs e, TextBox endTBox)
{
int wmIx = -1;
for (int i = 0; i < endTextBoxes.Length; i++)
{
if (endTextBoxes[i] == endTBox)
{
wmIx = i;
break;
}
}
private void endTextBox10_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox10.Text);
double startState = Utils.ParseUDouble(startTextBox10.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation10.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
exclamations[wmIx].Visible = errorOoR;
largeExclamationLabel.Visible = errorOoR;
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
}
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
private void endTextBox2_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox2); }
private void endTextBox3_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox3); }
private void endTextBox4_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox4); }
private void endTextBox5_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox5); }
private void endTextBox6_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox6); }
private void endTextBox7_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox7); }
private void endTextBox8_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox8); }
private void endTextBox9_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox9); }
private void endTextBox10_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox10); }
private void endTextBox11_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox11); }
private void endTextBox12_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox12); }
private void endTextBox13_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox13); }
private void endTextBox14_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox14); }
private void endTextBox15_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox15); }
private void endTextBox16_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox16); }
private void endTextBox17_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox17); }
private void endTextBox18_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox18); }
private void endTextBox19_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox19); }
private void endTextBox20_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox20); }
private void endTextBox21_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox21); }
private void endTextBox22_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox22); }
private void endTextBox23_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox23); }
private void endTextBox24_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox24); }
private void endTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox1); }
private void endTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox2); }
private void endTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox3); }
private void endTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox4); }
private void endTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox5); }
private void endTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox6); }
private void endTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox7); }
private void endTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox8); }
private void endTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox9); }
private void endTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox10); }
private void endTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox11); }
private void endTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox12); }
private void endTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox13); }
private void endTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox14); }
private void endTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox15); }
private void endTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox16); }
private void endTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox17); }
private void endTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox18); }
private void endTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox19); }
private void endTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox20); }
private void endTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox21); }
private void endTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox22); }
private void endTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox23); }
private void endTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcEndTextChanged(sender, e, endTextBox24); }
private void endTextBox11_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox11.Text);
double startState = Utils.ParseUDouble(startTextBox11.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation11.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox12_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox12.Text);
double startState = Utils.ParseUDouble(startTextBox12.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation12.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox13_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox13.Text);
double startState = Utils.ParseUDouble(startTextBox13.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation13.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox14_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox14.Text);
double startState = Utils.ParseUDouble(startTextBox14.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation14.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox15_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox15.Text);
double startState = Utils.ParseUDouble(startTextBox15.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation15.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox16_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox16.Text);
double startState = Utils.ParseUDouble(startTextBox16.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation16.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox17_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox17.Text);
double startState = Utils.ParseUDouble(startTextBox17.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation17.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox18_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox18.Text);
double startState = Utils.ParseUDouble(startTextBox18.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation18.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox19_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox19.Text);
double startState = Utils.ParseUDouble(startTextBox19.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation19.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox20_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox20.Text);
double startState = Utils.ParseUDouble(startTextBox20.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation20.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox21_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox21.Text);
double startState = Utils.ParseUDouble(startTextBox21.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation21.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox22_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox22.Text);
double startState = Utils.ParseUDouble(startTextBox22.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation22.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox23_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox23.Text);
double startState = Utils.ParseUDouble(startTextBox23.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation23.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox24_TextChanged(object sender, EventArgs e)
{
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBox24.Text);
double startState = Utils.ParseUDouble(startTextBox24.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
exclamation24.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
/// <summary>
/// Process a key press within any enabled text boxe
@@ -395,25 +585,21 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// Process '+' key ..... Form completed
okButton_Click(sender, e);
}
if (e.KeyChar == '\r')
{
/// Process <enter> key ..... Next text field
if (enabledTextBoxes.Count < 2) return; /// There is just one enabled textbox
if (e.KeyChar == '\r')
{
/// Process <enter> key ..... Next text field
if (activeTextBoxes.Count < 2) return; /// There is just one enabled textbox
for (int i = 0; i < activeTextBoxes.Count; i++)
{
if (activeTextBoxes[i] == currentFocusOwner)
{
/// Change focus to the next enabled text box
int newTBIdx = (i + 1) % activeTextBoxes.Count;
activeTextBoxes[newTBIdx].Focus();
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
largeExclamationLabel.Visible = false;
return;
}
}
}
for (int i = 0; i < enabledTextBoxes.Count; i++)
{
if (enabledTextBoxes[i] == currentFocusOwner)
{
/// Change focus to the next enabled text box
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus();
return;
}
}
}
}
private void startTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox1); }
@@ -441,15 +627,15 @@ namespace TBF.BenchControl.DataEntry.Standard24
private void startTextBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox23); }
private void startTextBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, startTextBox24); }
private void endTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox1); }
private void endTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox2); }
private void endTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox3); }
private void endTextBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox4); }
private void endTextBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox5); }
private void endTextBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox6); }
private void endTextBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox7); }
private void endTextBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox8); }
private void endTextBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox9); }
private void endTextBox1_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox1); }
private void endTextBox2_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox2); }
private void endTextBox3_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox3); }
private void endTextBox4_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox4); }
private void endTextBox5_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox5); }
private void endTextBox6_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox6); }
private void endTextBox7_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox7); }
private void endTextBox8_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox8); }
private void endTextBox9_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox9); }
private void endTextBox10_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox10); }
private void endTextBox11_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox11); }
private void endTextBox12_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox12); }
@@ -465,69 +651,5 @@ namespace TBF.BenchControl.DataEntry.Standard24
private void endTextBox22_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox22); }
private void endTextBox23_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox23); }
private void endTextBox24_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox24); }
private void ProcStartTextChanged(object sender, EventArgs e, TextBox startTBox)
{
for (int i = 0; i < startTextBoxes.Length; i++)
{
if (startTextBoxes[i] == startTBox)
{
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, i + 1, startTextBoxes[i].Text);
largeExclamationLabel.Visible = false;
break;
}
}
}
private void startTextBox1_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
private void startTextBox2_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
private void startTextBox3_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
private void startTextBox4_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
private void startTextBox5_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
private void startTextBox6_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
private void startTextBox7_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
private void startTextBox8_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
private void startTextBox9_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
private void startTextBox10_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
private void startTextBox11_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
private void startTextBox12_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
private void startTextBox13_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
private void startTextBox14_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
private void startTextBox15_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
private void startTextBox16_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
private void startTextBox17_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
private void startTextBox18_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
private void startTextBox19_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
private void startTextBox20_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
private void startTextBox21_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
private void startTextBox22_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
private void startTextBox23_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
private void startTextBox24_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
private void startTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
private void startTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
private void startTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
private void startTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
private void startTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
private void startTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
private void startTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
private void startTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
private void startTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
private void startTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
private void startTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
private void startTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
private void startTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
private void startTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
private void startTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
private void startTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
private void startTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
private void startTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
private void startTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
private void startTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
private void startTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
private void startTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
private void startTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
private void startTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
///
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
{
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, myRef.regReaders, disabled);
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, myRef.regReaders, disabled);
modelessDlg.Show();
}
///
@@ -221,7 +221,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
}
}
}
else if ((modelessDlg is TestStartEndForm) && (currentOp == CurrentOp.EnterTestStartStates))
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
{
/// Fixed start test - start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
@@ -229,15 +229,12 @@ namespace TBF.BenchControl.DataEntry.Standard48
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if ((modelessDlg is TestStartEndForm) && (currentOp == CurrentOp.EnterTestEndStates))
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
{
/// Fixed start test - end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
@@ -245,10 +242,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
{
wmEndState[i] = dlg.WMEndState[i];
}
wmEndState[i] = dlg.WMEndState[i];
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -43,10 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
Label[] labels;
TextBox[] startTextBoxes;
TextBox[] endTextBoxes;
Label[] exclamations;
///
IList<TextBox> activeTextBoxes;
IList<int> activeWmNrs;
IList<TextBox> enabledTextBoxes;
/// <summary>
/// Parameterless constructor initializing common part for start and endstate form
@@ -82,20 +79,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
endTextBox31, endTextBox32, endTextBox33, endTextBox34, endTextBox35, endTextBox36, endTextBox37, endTextBox38, endTextBox39, endTextBox40,
endTextBox41, endTextBox42, endTextBox43, endTextBox44, endTextBox45, endTextBox46, endTextBox47, endTextBox48,
};
exclamations = new Label[]
{
exclamation1, exclamation2, exclamation3, exclamation4, exclamation5, exclamation6,
exclamation7, exclamation8, exclamation9, exclamation10, exclamation11, exclamation12,
exclamation13, exclamation14, exclamation15, exclamation16, exclamation17, exclamation18,
exclamation19, exclamation20, exclamation21, exclamation22, exclamation23, exclamation24,
exclamation25, exclamation26, exclamation27, exclamation28, exclamation29, exclamation30,
exclamation31, exclamation32, exclamation33, exclamation34, exclamation35, exclamation36,
exclamation37, exclamation38, exclamation39, exclamation40, exclamation41, exclamation42,
exclamation43, exclamation44, exclamation45, exclamation46, exclamation47, exclamation48,
};
activeTextBoxes = new List<TextBox>();
activeWmNrs = new List<int>();
enabledTextBoxes = new List<TextBox>();
completed = false;
StartForceCloseHandler();
@@ -158,10 +142,10 @@ namespace TBF.BenchControl.DataEntry.Standard48
/// </summary>
void ShuffleTextBoxes()
{
if (TextBoxesCount > WaterMetersCount)
if (Config.Data.WMsCount < TextBoxesCount)
{
int nrLines = WaterMetersCount / Config.Data.LineSize;
int gap = (TextBoxesCount - WaterMetersCount) / nrLines;
int nrLines = Config.Data.WMsCount / Config.Data.LineSize;
int gap = (TextBoxesCount - Config.Data.WMsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
@@ -171,11 +155,10 @@ namespace TBF.BenchControl.DataEntry.Standard48
labels[dest] = labels[l * Config.Data.LineSize + l * gap + i];
startTextBoxes[dest] = startTextBoxes[l * Config.Data.LineSize + l * gap + i];
endTextBoxes[dest] = endTextBoxes[l * Config.Data.LineSize + l * gap + i];
exclamations[dest] = exclamations[l * Config.Data.LineSize + l * gap + i];
dest++;
dest++;
}
}
TextBoxesCount = WaterMetersCount;
TextBoxesCount = Config.Data.WMsCount;
}
}
@@ -193,9 +176,8 @@ namespace TBF.BenchControl.DataEntry.Standard48
}
}
if (endStates)
if (endStates)
{
/// End of test
for (int i = 0; i < TextBoxesCount; i++)
{
if (WMStartStateStr != null && i < WMStartStateStr.Length)
@@ -203,41 +185,32 @@ namespace TBF.BenchControl.DataEntry.Standard48
startTextBoxes[i].Text = WMStartStateStr[i];
}
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
if (disabled != null && i < disabled.Length && disabled[i])
{
endTextBoxes[i].Enabled = false;
}
else
{
endTextBoxes[i].Enabled = true;
activeTextBoxes.Add(endTextBoxes[i]);
activeWmNrs.Add(i);
}
enabledTextBoxes.Add(endTextBoxes[i]);
}
}
}
else
{
/// Start of test
{
for (int i = 0; i < TextBoxesCount; i++)
{
if (((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null)))
if (disabled != null && i < disabled.Length && disabled[i])
{
startTextBoxes[i].Enabled = false;
}
else
{
startTextBoxes[i].Enabled = true;
activeTextBoxes.Add(startTextBoxes[i]);
activeWmNrs.Add(i);
}
enabledTextBoxes.Add(startTextBoxes[i]);
}
}
}
if ((activeTextBoxes.Count > 0) && (activeWmNrs.Count > 0))
{
activeTextBoxes[0].Focus();
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[0] + 1, string.Empty);
}
}
void Localize()
@@ -308,166 +281,98 @@ namespace TBF.BenchControl.DataEntry.Standard48
#endregion
/// <summary>
/// Calculate the approximate error and verify whether it is within limits.
/// Make an exclamation mark visible if out of range.
/// Similar event handler is implemented for all endTextBoxes (1..24).
/// </summary>
private void ProcEndTextChanged(object sender, EventArgs e, TextBox endTBox)
/// <summary>
/// Calculate the approximate error and verify whether it is within limits.
/// Make an exclamation mark visible if out of range.
/// Similar event handler is implemented for all endTextBoxes (1..24).
/// </summary>
private void ProcTextChanged(object sender, EventArgs e, TextBox endStateTB, TextBox startStateTB, Label exclamation)
{
int wmIx = -1;
for (int i = 0; i < endTextBoxes.Length; i++)
{
if (endTextBoxes[i] == endTBox)
{
wmIx = i;
break;
}
}
double err = 0;
try
{
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
double endState = Utils.ParseUDouble(endStateTB.Text);
double startState = Utils.ParseUDouble(startStateTB.Text);
err = 100.0 * (endState - startState - refVolume) / refVolume;
}
catch { err = 1000.0f; };
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
exclamations[wmIx].Visible = errorOoR;
largeExclamationLabel.Visible = errorOoR;
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
exclamation.Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
}
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
private void endTextBox2_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox2); }
private void endTextBox3_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox3); }
private void endTextBox4_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox4); }
private void endTextBox5_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox5); }
private void endTextBox6_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox6); }
private void endTextBox7_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox7); }
private void endTextBox8_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox8); }
private void endTextBox9_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox9); }
private void endTextBox10_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox10); }
private void endTextBox11_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox11); }
private void endTextBox12_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox12); }
private void endTextBox13_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox13); }
private void endTextBox14_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox14); }
private void endTextBox15_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox15); }
private void endTextBox16_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox16); }
private void endTextBox17_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox17); }
private void endTextBox18_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox18); }
private void endTextBox19_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox19); }
private void endTextBox20_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox20); }
private void endTextBox21_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox21); }
private void endTextBox22_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox22); }
private void endTextBox23_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox23); }
private void endTextBox24_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox24); }
private void endTextBox25_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox25); }
private void endTextBox26_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox26); }
private void endTextBox27_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox27); }
private void endTextBox28_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox28); }
private void endTextBox29_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox29); }
private void endTextBox30_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox30); }
private void endTextBox31_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox31); }
private void endTextBox32_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox32); }
private void endTextBox33_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox33); }
private void endTextBox34_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox34); }
private void endTextBox35_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox35); }
private void endTextBox36_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox36); }
private void endTextBox37_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox37); }
private void endTextBox38_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox38); }
private void endTextBox39_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox39); }
private void endTextBox40_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox40); }
private void endTextBox41_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox41); }
private void endTextBox42_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox42); }
private void endTextBox43_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox43); }
private void endTextBox44_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox44); }
private void endTextBox45_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox45); }
private void endTextBox46_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox46); }
private void endTextBox47_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox47); }
private void endTextBox48_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox48); }
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox1, startTextBox1, exclamation1); }
private void endTextBox2_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox2, startTextBox2, exclamation2); }
private void endTextBox3_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox3, startTextBox3, exclamation3); }
private void endTextBox4_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox4, startTextBox4, exclamation4); }
private void endTextBox5_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox5, startTextBox5, exclamation5); }
private void endTextBox6_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox6, startTextBox6, exclamation6); }
private void endTextBox7_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox7, startTextBox7, exclamation7); }
private void endTextBox8_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox8, startTextBox8, exclamation8); }
private void endTextBox9_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox9, startTextBox9, exclamation9); }
private void endTextBox10_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox10, startTextBox10, exclamation10); }
private void endTextBox11_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox11, startTextBox11, exclamation11); }
private void endTextBox12_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox12, startTextBox12, exclamation12); }
private void endTextBox13_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox13, startTextBox13, exclamation13); }
private void endTextBox14_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox14, startTextBox14, exclamation14); }
private void endTextBox15_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox15, startTextBox15, exclamation15); }
private void endTextBox16_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox16, startTextBox16, exclamation16); }
private void endTextBox17_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox17, startTextBox17, exclamation17); }
private void endTextBox18_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox18, startTextBox18, exclamation18); }
private void endTextBox19_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox19, startTextBox19, exclamation19); }
private void endTextBox20_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox20, startTextBox20, exclamation20); }
private void endTextBox21_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox21, startTextBox21, exclamation21); }
private void endTextBox22_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox22, startTextBox22, exclamation22); }
private void endTextBox23_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox23, startTextBox23, exclamation23); }
private void endTextBox24_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox24, startTextBox24, exclamation24); }
private void endTextBox25_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox25, startTextBox25, exclamation25); }
private void endTextBox26_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox26, startTextBox26, exclamation26); }
private void endTextBox27_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox27, startTextBox27, exclamation27); }
private void endTextBox28_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox28, startTextBox28, exclamation28); }
private void endTextBox29_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox29, startTextBox29, exclamation29); }
private void endTextBox30_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox30, startTextBox30, exclamation30); }
private void endTextBox31_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox31, startTextBox31, exclamation31); }
private void endTextBox32_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox32, startTextBox32, exclamation32); }
private void endTextBox33_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox33, startTextBox33, exclamation33); }
private void endTextBox34_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox34, startTextBox34, exclamation34); }
private void endTextBox35_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox35, startTextBox35, exclamation35); }
private void endTextBox36_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox36, startTextBox36, exclamation36); }
private void endTextBox37_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox37, startTextBox37, exclamation37); }
private void endTextBox38_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox38, startTextBox38, exclamation38); }
private void endTextBox39_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox39, startTextBox39, exclamation39); }
private void endTextBox40_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox40, startTextBox40, exclamation40); }
private void endTextBox41_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox41, startTextBox41, exclamation41); }
private void endTextBox42_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox42, startTextBox42, exclamation42); }
private void endTextBox43_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox43, startTextBox43, exclamation43); }
private void endTextBox44_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox44, startTextBox44, exclamation44); }
private void endTextBox45_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox45, startTextBox45, exclamation45); }
private void endTextBox46_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox46, startTextBox46, exclamation46); }
private void endTextBox47_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox47, startTextBox47, exclamation47); }
private void endTextBox48_TextChanged(object sndr, EventArgs e) { ProcTextChanged(sndr, e, endTextBox48, startTextBox48, exclamation48); }
private void endTextBox1_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
private void endTextBox2_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox2); }
private void endTextBox3_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox3); }
private void endTextBox4_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox4); }
private void endTextBox5_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox5); }
private void endTextBox6_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox6); }
private void endTextBox7_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox7); }
private void endTextBox8_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox8); }
private void endTextBox9_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox9); }
private void endTextBox10_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox10); }
private void endTextBox11_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox11); }
private void endTextBox12_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox12); }
private void endTextBox13_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox13); }
private void endTextBox14_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox14); }
private void endTextBox15_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox15); }
private void endTextBox16_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox16); }
private void endTextBox17_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox17); }
private void endTextBox18_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox18); }
private void endTextBox19_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox19); }
private void endTextBox20_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox20); }
private void endTextBox21_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox21); }
private void endTextBox22_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox22); }
private void endTextBox23_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox23); }
private void endTextBox24_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox24); }
private void endTextBox25_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox25); }
private void endTextBox26_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox26); }
private void endTextBox27_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox27); }
private void endTextBox28_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox28); }
private void endTextBox29_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox29); }
private void endTextBox30_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox30); }
private void endTextBox31_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox31); }
private void endTextBox32_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox32); }
private void endTextBox33_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox33); }
private void endTextBox34_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox34); }
private void endTextBox35_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox35); }
private void endTextBox36_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox36); }
private void endTextBox37_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox37); }
private void endTextBox38_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox38); }
private void endTextBox39_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox39); }
private void endTextBox40_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox40); }
private void endTextBox41_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox41); }
private void endTextBox42_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox42); }
private void endTextBox43_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox43); }
private void endTextBox44_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox44); }
private void endTextBox45_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox45); }
private void endTextBox46_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox46); }
private void endTextBox47_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox47); }
private void endTextBox48_MouseClick(object sndr, MouseEventArgs e) { ProcEndTextChanged(sndr, e, endTextBox48); }
/// <summary>
/// Process a key press within any enabled text boxe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <param name="currentFocusOwner">TextBox control which received the event</param>
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
{
if (e.KeyChar == '+')
{
/// Process '+' key ..... Form completed
okButton_Click(sender, e);
}
/// <summary>
/// Process a key press within any enabled text boxe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <param name="currentFocusOwner">TextBox control which received the event</param>
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
{
if (e.KeyChar == '+')
{
/// Process '+' key ..... Form completed
okButton_Click(sender, e);
}
if (e.KeyChar == '\r')
{
/// Process <enter> key ..... Next text field
if (activeTextBoxes.Count < 2) return; /// There is just one enabled textbox
if (enabledTextBoxes.Count < 2) return; /// There is just one enabled textbox
for (int i = 0; i < activeTextBoxes.Count; i++)
for (int i = 0; i < enabledTextBoxes.Count; i++)
{
if (activeTextBoxes[i] == currentFocusOwner)
if (enabledTextBoxes[i] == currentFocusOwner)
{
/// Index of the next active text box
int newTBIdx = (i + 1) % activeTextBoxes.Count;
/// Change focus to the next active text box
activeTextBoxes[newTBIdx].Focus();
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
largeExclamationLabel.Visible = false;
/// Change focus to the next enabled text box
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus();
return;
}
}
@@ -571,118 +476,5 @@ namespace TBF.BenchControl.DataEntry.Standard48
private void endTextBox46_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox46); }
private void endTextBox47_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox47); }
private void endTextBox48_KeyPress(object sndr, KeyPressEventArgs e) { ProcKeyPress(sndr, e, endTextBox48); }
private void ProcStartTextChanged(object sender, EventArgs e, TextBox startTBox)
{
for (int i = 0; i < startTextBoxes.Length; i++)
{
if (startTextBoxes[i] == startTBox)
{
/// wmIx == i
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, i + 1, startTextBoxes[i].Text);
largeExclamationLabel.Visible = false;
break;
}
}
}
private void startTextBox1_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
private void startTextBox2_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
private void startTextBox3_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
private void startTextBox4_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
private void startTextBox5_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
private void startTextBox6_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
private void startTextBox7_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
private void startTextBox8_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
private void startTextBox9_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
private void startTextBox10_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
private void startTextBox11_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
private void startTextBox12_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
private void startTextBox13_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
private void startTextBox14_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
private void startTextBox15_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
private void startTextBox16_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
private void startTextBox17_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
private void startTextBox18_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
private void startTextBox19_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
private void startTextBox20_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
private void startTextBox21_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
private void startTextBox22_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
private void startTextBox23_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
private void startTextBox24_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
private void startTextBox25_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox25); }
private void startTextBox26_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox26); }
private void startTextBox27_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox27); }
private void startTextBox28_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox28); }
private void startTextBox29_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox29); }
private void startTextBox30_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox30); }
private void startTextBox31_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox31); }
private void startTextBox32_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox32); }
private void startTextBox33_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox33); }
private void startTextBox34_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox34); }
private void startTextBox35_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox35); }
private void startTextBox36_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox36); }
private void startTextBox37_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox37); }
private void startTextBox38_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox38); }
private void startTextBox39_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox39); }
private void startTextBox40_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox40); }
private void startTextBox41_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox41); }
private void startTextBox42_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox42); }
private void startTextBox43_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox43); }
private void startTextBox44_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox44); }
private void startTextBox45_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox45); }
private void startTextBox46_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox46); }
private void startTextBox47_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox47); }
private void startTextBox48_TextChanged(object sender, EventArgs e) { ProcStartTextChanged(sender, e, startTextBox48); }
private void startTextBox1_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox1); }
private void startTextBox2_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox2); }
private void startTextBox3_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox3); }
private void startTextBox4_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox4); }
private void startTextBox5_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox5); }
private void startTextBox6_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox6); }
private void startTextBox7_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox7); }
private void startTextBox8_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox8); }
private void startTextBox9_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox9); }
private void startTextBox10_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox10); }
private void startTextBox11_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox11); }
private void startTextBox12_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox12); }
private void startTextBox13_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox13); }
private void startTextBox14_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox14); }
private void startTextBox15_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox15); }
private void startTextBox16_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox16); }
private void startTextBox17_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox17); }
private void startTextBox18_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox18); }
private void startTextBox19_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox19); }
private void startTextBox20_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox20); }
private void startTextBox21_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox21); }
private void startTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
private void startTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
private void startTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
private void startTextBox25_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox25); }
private void startTextBox26_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox26); }
private void startTextBox27_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox27); }
private void startTextBox28_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox28); }
private void startTextBox29_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox29); }
private void startTextBox30_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox30); }
private void startTextBox31_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox31); }
private void startTextBox32_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox32); }
private void startTextBox33_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox33); }
private void startTextBox34_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox34); }
private void startTextBox35_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox35); }
private void startTextBox36_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox36); }
private void startTextBox37_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox37); }
private void startTextBox38_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox38); }
private void startTextBox39_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox39); }
private void startTextBox40_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox40); }
private void startTextBox41_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox41); }
private void startTextBox42_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox42); }
private void startTextBox43_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox43); }
private void startTextBox44_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox44); }
private void startTextBox45_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox45); }
private void startTextBox46_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox46); }
private void startTextBox47_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox47); }
private void startTextBox48_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox48); }
}
}
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || IZRAEL_200 || PUCHONG_200 || MALTA_WSD25
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || PUCHONG_200 || MALTA_WSD25
public int EtPulsesK { get { return 1; } }
#else /// all new benches
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
@@ -1,15 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IParallelOutput : IComponent
{
IOperation SetOutputsOp(ushort outValue);
IOperation ShowBenchWaitingOp();
IOperation ShowBenchErrorOp();
}
}
@@ -1,12 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
namespace TBF.BenchControl.GenericDevices
{
public interface IReceivesDataFromRadio
{
void WMStateReceived(string serialNr, double wmState);
}
}
@@ -11,6 +11,6 @@ namespace TBF.BenchControl.GenericDevices
/// Reads information on start of a cycle, Events: Event.InfoRead
/// </summary>
/// <returns>Reference to the operation</returns>
IOperation ReadStartInfoOp(Results.Entities.WaterMeter[] waterMeters);
IOperation ReadStartInfoOp(Results.Entities.Batch batchResults);
}
}
+15 -40
View File
@@ -28,7 +28,6 @@ namespace TBF.BenchControl.Modbus.Common
/// Private fields
SerialPort serialPort;
DateTime lastSerialPortWrite;
bool initialRunDeviceCommComplete;
public Queue<byte[]>[] ReceivedTelegrams
{
@@ -83,8 +82,6 @@ namespace TBF.BenchControl.Modbus.Common
//workerThread = new Thread(Worker);
//workerThread.Start();
initialRunDeviceCommComplete = false; /// Causes search for Quido RS modules in the first RunDeviceAfter() call
log.FatalFormat("{0} - Device successfully initialized", Name);
}
@@ -102,7 +99,7 @@ namespace TBF.BenchControl.Modbus.Common
Telegram.UpdateTelegramCRC(message);
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100) && initialRunDeviceCommComplete)
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
{
/// More then 100 ms since last 'send' --> do not enqueue the message
SendMessageNow(message);
@@ -177,12 +174,12 @@ namespace TBF.BenchControl.Modbus.Common
Debug.WriteLine(s);
log.Debug(s);
}
else
{
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
Debug.WriteLine(s);
log.Debug(s);
}
else
{
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
Debug.WriteLine(s);
log.Debug(s);
}
}
}
@@ -191,16 +188,6 @@ namespace TBF.BenchControl.Modbus.Common
{
if (serialPort == null) return;
if (!initialRunDeviceCommComplete)
{
initialRunDeviceCommComplete = true; /// Prevent 2nd invocation of the subsequent code
/// Search Quido RS modules
byte[] searchTelegram = new byte[] { 0xF8, 0x11, 0, 0 };
Telegram.UpdateTelegramCRC(searchTelegram);
SendMessageNow(searchTelegram);
}
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
{
SendMessageNow(telegramsToSend.Dequeue());
@@ -210,27 +197,15 @@ namespace TBF.BenchControl.Modbus.Common
/// <summary>Stop this device</summary>
public void StopDevice()
{
if (serialPort != null)
{
//stopWorkerThread = true;
//workerThread.Join(2000);
serialPort.Close();
serialPort = null;
}
}
public void StopDevice2()
{
if (serialPort != null)
{
/// Send telegrams currently in the queue
while (telegramsToSend.Count > 0)
{
while ((DateTime.Now - lastSerialPortWrite) <= new TimeSpan(0, 0, 0, 0, 200))
{
Thread.Sleep(100);
}
SendMessageNow(telegramsToSend.Dequeue());
}
//stopWorkerThread = true;
//workerThread.Join(2000);
serialPort.Close();
serialPort = null;
}
}
public void StopDevice2() { }
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Slovensko a.s.
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
+25 -44
View File
@@ -1,17 +1,15 @@
///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl.Generic;
using TBF.Boxes;
using System.Text;
using System.Diagnostics;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class QuidoRS : ComponentBase, IDevice, GenericDevices.IParallelOutput
public class QuidoRS : ComponentBase, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(QuidoRS));
public override string ToString() { return string.Format("QuidoRS({0})", Cfg.ToString(1)); }
@@ -62,22 +60,12 @@ namespace TBF.BenchControl.Modbus.QuidoRS
if (modbus.ReceivedTelegrams[quidoRSCfg.ModbusAddress].Count > 0)
{
byte[] telegram = modbus.ReceivedTelegrams[quidoRSCfg.ModbusAddress].Dequeue();
if ((telegram.Length >= 8) && (telegram[1] == 0x11) && (telegram[2] == telegram.Length - 5))
{
int msgLen = telegram.Length - 7;
byte modbusAddress = telegram[3];
string msg = Encoding.ASCII.GetString(telegram, 5, msgLen);
string s = string.Format("QuidoRS detected: Address={0}, Message={1}", modbusAddress, msg);
Debug.WriteLine(s);
log.Warn(s);
}
modbus.ReceivedTelegrams[quidoRSCfg.ModbusAddress].Dequeue();
}
}
public void RunDeviceAfter() { }
public void StopDevice() { SendOutputs(0); }
public void StopDevice() { }
public void StopDevice2() { }
@@ -136,19 +124,19 @@ namespace TBF.BenchControl.Modbus.QuidoRS
private void SendOutputs(ushort outputs)
{
byte addr = quidoRSCfg.ModbusAddress;
byte cmd = (byte)Function.ForceMultipleCoils;
byte dataLo = (byte)(outputs & 0xFF);
byte dataHi = (byte)(outputs >> 8);
byte[] msg = new byte[11];
if (quidoRSCfg.Variant == QuidoVariant.QuidoRS_2_16)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 16, 2, dataLo, dataHi, 0, 0 });
}
else if (quidoRSCfg.Variant == QuidoVariant.QuidoRS_8_8)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 8, 1, dataLo, 0, 0 });
}
msg[0] = quidoRSCfg.ModbusAddress;
msg[1] = (byte)Function.ForceMultipleCoils;
msg[2] = 0; /// Data Hi
msg[3] = 0; /// Data Lo
msg[4] = 0; /// Nr. of coils Hi
msg[5] = 16; /// Nr. of coils Lo
msg[6] = 2; /// Byte count
msg[7] = (byte)(outputs & 0xFF); /// Output data Lo
msg[8] = (byte)(outputs >> 8); /// Output data Hi
modbus.SendMessage(msg);
lastOutputsChange = DateTime.Now;
}
@@ -157,29 +145,22 @@ namespace TBF.BenchControl.Modbus.QuidoRS
/// <summary>
/// Events: SetOpututsDone, Error
/// </summary>
/// <param name="outValue">Parallel output data</param>
/// <returns>SetOutputsOp operation casted to IOperaton</returns>
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
public IOperation SetOutputsOp(ushort outValue)
{
return new SetOutputsOp(this, outValue);
}
/// <summary>
/// Events: Event.None
/// Events: pressureDone, Error
/// </summary>
/// <returns>ShowBenchWaitingOp operation casted to generic IOperaton</returns>
public IOperation ShowBenchWaitingOp()
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
/// <param name="setOutputsDone">Event returned when SetOutput is done</param>
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
public IOperation ReadPressureOp(ushort outValue, Event setOutputsDone)
{
return new ShowBenchWaitingOp(this);
return new SetOutputsOp(this, outValue, setOutputsDone);
}
/// <summary>
/// Events: Event.None
/// </summary>
/// <returns>ShowBenchErrorOp operation casted to generic IOperaton</returns>
public IOperation ShowBenchErrorOp()
{
return new ShowBenchErrorOp(this);
}
}
}
}
+4 -14
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -9,13 +9,6 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public enum QuidoVariant
{
QuidoRS_2_16,
QuidoRS_8_8,
Count
}
public class QuidoRSCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(QuidoRSCfg) })[0];
@@ -26,8 +19,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
///
/// Serialized parameters
///
public byte ModbusAddress; /// 1..247
public QuidoVariant Variant; /// 'QuidoRS_2_16' or 'QuidoRS_8_8'
public byte ModbusAddress; /// 1..255
public bool WatchdogEnabled;
public int WatchdogBitNr; /// 0..15
@@ -37,8 +29,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
Name = "QuidoRS";
ParentName = "Modbus";
ModbusAddress = 49;
Variant = QuidoVariant.QuidoRS_2_16;
WatchdogEnabled = false;
WatchdogEnabled = true;
WatchdogBitNr = 4;
}
@@ -50,10 +41,9 @@ namespace TBF.BenchControl.Modbus.QuidoRS
public string ToString(int i)
{
return string.Format("Name={0}, ModbusAddress={1}, Variant={2}, Parent={2}",
return string.Format("Name={0}, ModbusAddr={1}, Parent={2}",
Name,
ModbusAddress,
Variant,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
@@ -46,8 +46,6 @@ namespace TBF.BenchControl.Modbus.QuidoRS
}
}
for (QuidoVariant v = 0; v < QuidoVariant.Count; v++) variantComboBox.Items.Add(v.ToString());
Redraw();
}
@@ -63,7 +61,6 @@ namespace TBF.BenchControl.Modbus.QuidoRS
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
variantComboBox.Text = config.Variant.ToString();
watchdogCheckBox.Checked = config.WatchdogEnabled;
watchdogBitNrTextBox.Text = config.WatchdogBitNr.ToString();
}
@@ -73,7 +70,6 @@ namespace TBF.BenchControl.Modbus.QuidoRS
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
variantComboBox.Enabled = true;
watchdogCheckBox.Enabled = true;
watchdogBitNrTextBox.Enabled = true;
}
@@ -88,16 +84,11 @@ namespace TBF.BenchControl.Modbus.QuidoRS
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 1 || dummy > 247)
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 0 || dummy > 255)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
}
if (!variantComboBox.Items.Contains(variantComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Variant'";
}
if (!int.TryParse(watchdogBitNrTextBox.Text, out dummy) || dummy < 0 || dummy > 15)
{
flags |= CfgUpdateFlags.Error;
@@ -115,10 +106,6 @@ namespace TBF.BenchControl.Modbus.QuidoRS
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
for (QuidoVariant v = 0; v < QuidoVariant.Count; v++)
{
if (variantComboBox.Text == v.ToString()) { config.Variant = v; break; }
}
config.WatchdogEnabled = watchdogCheckBox.Checked;
config.WatchdogBitNr = int.Parse(watchdogBitNrTextBox.Text);
+6 -30
View File
@@ -41,8 +41,6 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.watchdogCheckBox = new System.Windows.Forms.CheckBox();
this.watchdogBitNrTextBox = new System.Windows.Forms.TextBox();
this.watchdogBitNrLabel = new System.Windows.Forms.Label();
this.variantComboBox = new System.Windows.Forms.ComboBox();
this.variantLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
@@ -86,7 +84,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 108);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 5;
this.modbusAddressLabel.TabIndex = 7;
this.modbusAddressLabel.Text = "Modbus Address";
//
// modbusAddressTextBox
@@ -95,7 +93,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 105);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
this.modbusAddressTextBox.TabIndex = 6;
this.modbusAddressTextBox.TabIndex = 8;
//
// parentNameComboBox
//
@@ -110,7 +108,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
//
this.watchdogCheckBox.AutoSize = true;
this.watchdogCheckBox.Enabled = false;
this.watchdogCheckBox.Location = new System.Drawing.Point(31, 164);
this.watchdogCheckBox.Location = new System.Drawing.Point(31, 131);
this.watchdogCheckBox.Name = "watchdogCheckBox";
this.watchdogCheckBox.Size = new System.Drawing.Size(99, 17);
this.watchdogCheckBox.TabIndex = 9;
@@ -120,7 +118,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
// watchdogBitNrTextBox
//
this.watchdogBitNrTextBox.Enabled = false;
this.watchdogBitNrTextBox.Location = new System.Drawing.Point(138, 186);
this.watchdogBitNrTextBox.Location = new System.Drawing.Point(138, 153);
this.watchdogBitNrTextBox.Name = "watchdogBitNrTextBox";
this.watchdogBitNrTextBox.Size = new System.Drawing.Size(46, 20);
this.watchdogBitNrTextBox.TabIndex = 11;
@@ -128,36 +126,16 @@ namespace TBF.BenchControl.Modbus.QuidoRS
// watchdogBitNrLabel
//
this.watchdogBitNrLabel.AutoSize = true;
this.watchdogBitNrLabel.Location = new System.Drawing.Point(28, 189);
this.watchdogBitNrLabel.Location = new System.Drawing.Point(28, 156);
this.watchdogBitNrLabel.Name = "watchdogBitNrLabel";
this.watchdogBitNrLabel.Size = new System.Drawing.Size(81, 13);
this.watchdogBitNrLabel.TabIndex = 10;
this.watchdogBitNrLabel.Text = "Watchdog bit #";
//
// variantComboBox
//
this.variantComboBox.Enabled = false;
this.variantComboBox.FormattingEnabled = true;
this.variantComboBox.Location = new System.Drawing.Point(138, 131);
this.variantComboBox.Name = "variantComboBox";
this.variantComboBox.Size = new System.Drawing.Size(130, 21);
this.variantComboBox.TabIndex = 8;
//
// variantLabel
//
this.variantLabel.AutoSize = true;
this.variantLabel.Location = new System.Drawing.Point(28, 134);
this.variantLabel.Name = "variantLabel";
this.variantLabel.Size = new System.Drawing.Size(40, 13);
this.variantLabel.TabIndex = 7;
this.variantLabel.Text = "Variant";
//
// QuidoRSCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.variantComboBox);
this.Controls.Add(this.variantLabel);
this.Controls.Add(this.watchdogBitNrTextBox);
this.Controls.Add(this.watchdogBitNrLabel);
this.Controls.Add(this.watchdogCheckBox);
@@ -169,7 +147,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "QuidoRSCfgCtrl";
this.Size = new System.Drawing.Size(374, 268);
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.QuidoRSCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -188,7 +166,5 @@ namespace TBF.BenchControl.Modbus.QuidoRS
private System.Windows.Forms.CheckBox watchdogCheckBox;
private System.Windows.Forms.TextBox watchdogBitNrTextBox;
private System.Windows.Forms.Label watchdogBitNrLabel;
private System.Windows.Forms.ComboBox variantComboBox;
private System.Windows.Forms.Label variantLabel;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Slovensko a.s.
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using log4net;
@@ -1,51 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class ShowBenchErrorOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ShowBenchErrorOp));
public override string ToString() { return string.Format("ShowBenchErrorOp(.)"); }
const ushort BenchReadyValue = 0x01;
const ushort BenchErrorValue = 0x06;
/// Set by the constructor
readonly QuidoRS quidoRS;
/// <summary>
/// Events: Event.None
/// </summary>
/// <param name="quidoRS">Pressure meter reference</param>
public ShowBenchErrorOp(QuidoRS quidoRS)
{
if (quidoRS == null) throw new ArgumentNullException("quidoRS");
this.quidoRS = quidoRS;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
public void Start()
{
quidoRS.SetOutputs(BenchErrorValue);
}
/// <summary>Run this operation</summary>
public Event Run()
{
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
quidoRS.SetOutputs(BenchReadyValue);
}
}
}
@@ -1,51 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class ShowBenchWaitingOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ShowBenchWaitingOp));
public override string ToString() { return string.Format("ShowBenchWaitingOp(.)"); }
const ushort BenchReadyValue = 0x01;
const ushort BenchWaitingValue = 0x06;
/// Set by the constructor
readonly QuidoRS quidoRS;
/// <summary>
/// Events: Event.None
/// </summary>
/// <param name="quidoRS">Pressure meter reference</param>
public ShowBenchWaitingOp(QuidoRS quidoRS)
{
if (quidoRS == null) throw new ArgumentNullException("quidoRS");
this.quidoRS = quidoRS;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
public void Start()
{
quidoRS.SetOutputs(BenchWaitingValue);
}
/// <summary>Run this operation</summary>
public Event Run()
{
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
quidoRS.SetOutputs(BenchReadyValue);
}
}
}
@@ -1,86 +0,0 @@
///
/// Copyright (c) 2019 Sensus Metering Systems
///
namespace TBF.BenchControl.Operations
{
partial class LargeMessageBoxForm
{
/// <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 Windows Form 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.okButton = new System.Windows.Forms.Button();
this.messageLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(452, 523);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.messageLabel.Location = new System.Drawing.Point(34, 29);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(91, 23);
this.messageLabel.TabIndex = 4;
this.messageLabel.Text = "Message";
//
// LargeMessageBoxForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Goldenrod;
this.ClientSize = new System.Drawing.Size(1002, 617);
this.Controls.Add(this.messageLabel);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LargeMessageBoxForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MessageBoxForm_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label messageLabel;
}
}
@@ -1,99 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
public partial class LargeMessageBoxForm : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(LargeMessageBoxForm));
/// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
public LargeMessageBoxForm(string message, Color backgroundColor)
{
InitializeComponent();
//ControlBox = false;
Localize();
messageLabel.Text = message;
BackColor = backgroundColor;
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(messageLabel.Text, messageLabel.Font).Width;
int rqrdFormWidth = (int)textWidth + 80; /// Form width calculated from the text width
if (rqrdFormWidth > Width)
{
int shift = (rqrdFormWidth - Width) / 2;
Width = rqrdFormWidth;
okButton.Left += shift;
}
completed = false;
StartForceCloseHandler();
}
void Localize()
{
okButton.Text = Strings.OkBtnText;
}
private void okButton_Click(object sender, EventArgs e)
{
completed = true;
Close();
}
private void MessageBoxForm_FormClosing(object sender, FormClosingEventArgs e)
{
completed = true;
}
#region Forced close handling
/// <summary>
/// Used by CoverTest, AskYesNoOp and LargeMessageBoxOp.
/// </summary>
public void OnCloseThisForm(object sender, EventArgs args)
{
if (CloseThisFormHandler == null) return;
try
{
CloseThisFormHandler(sender, null);
}
catch (Exception e)
{
log.Error("CloseThisFormHandler(...) failed", e);
}
}
public event EventHandler<EventArgs> CloseThisFormHandler;
public void StartForceCloseHandler()
{
CloseThisFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired)
Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args);
else
OnForceClose(sender, args);
};
}
private void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
}
}
@@ -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>
@@ -1,76 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using TBF.BenchControl;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
public class LargeMessageBoxOp : IOperation
{
LargeMessageBoxForm form;
string message;
Color backColor;
bool completed = false;
/// <returns>Reference to the operation</returns>
public LargeMessageBoxOp()
: this(Strings.Message)
{
}
public LargeMessageBoxOp(string message)
: this (message, Color.Goldenrod)
{
}
public LargeMessageBoxOp(string message, Color backColor)
{
this.message = message;
this.backColor = backColor;
}
delegate void MessageBoxFormDlgt(LargeMessageBoxOp myRef);
///
void OpenFormDlg(LargeMessageBoxOp myRef)
{
myRef.form = new LargeMessageBoxForm(message, backColor);
form.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
completed = false;
Program.MainWnd.Invoke(new MessageBoxFormDlgt(OpenFormDlg), this);
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (completed || form.Completed)
{
completed = true;
form = null;
return Event.OK;
}
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (form != null)
{
form.OnCloseThisForm(this, null);
form = null;
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using System;
using System.Xml.Serialization;
@@ -39,7 +39,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public int Baujahr; /// Written to the database
public bool ReadStartInfo;
public bool SaveResults;
public bool StartInfoIsRequired;
/// Private parameterless constructor invoked by all other (public) constructors
@@ -52,7 +51,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
Baujahr = 2015;
ReadStartInfo = true;
SaveResults = true;
StartInfoIsRequired = false;
}
public DatabaseCfg(IComponentFactory factory)
@@ -63,14 +61,12 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public string ToString(int i)
{
return string.Format("Name={0}, BenchId={1}, DB={2}, Bjahr={3}, RdStartInfo={4}, SaveRslts={5}, StartInfoRqrd={6}",
Name,
return string.Format("BenchId={0}, DBUsed={1}, Baujahr={2}, ReadStartInfo={3}, SaveResults={4}",
TestBenchId,
DBUsed,
Baujahr,
ReadStartInfo,
SaveResults,
StartInfoIsRequired);
SaveResults);
}
}
}
@@ -52,7 +52,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
baujahrTextBox.Text = config.Baujahr.ToString();
readStartInfoCheckBox.Checked = config.ReadStartInfo;
saveResultsCheckBox.Checked = config.SaveResults;
startInfoIsRequiredCheckBox.Checked = config.StartInfoIsRequired;
}
public void Unlock()
@@ -63,7 +62,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
baujahrTextBox.Enabled = true;
readStartInfoCheckBox.Enabled = true;
saveResultsCheckBox.Enabled = true;
startInfoIsRequiredCheckBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -137,11 +135,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
config.SaveResults = saveResultsCheckBox.Checked;
flags = CfgUpdateFlags.RestartRqrd;
}
if (startInfoIsRequiredCheckBox.Checked != config.StartInfoIsRequired)
{
config.StartInfoIsRequired = startInfoIsRequiredCheckBox.Checked;
flags = CfgUpdateFlags.RestartRqrd;
}
return flags;
}
@@ -42,7 +42,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.dbUsedLabel = new System.Windows.Forms.Label();
this.baujahrTextBox = new System.Windows.Forms.TextBox();
this.baujahrLabel = new System.Windows.Forms.Label();
this.startInfoIsRequiredCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
@@ -75,7 +74,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
//
this.readStartInfoCheckBox.AutoSize = true;
this.readStartInfoCheckBox.Enabled = false;
this.readStartInfoCheckBox.Location = new System.Drawing.Point(111, 136);
this.readStartInfoCheckBox.Location = new System.Drawing.Point(111, 144);
this.readStartInfoCheckBox.Name = "readStartInfoCheckBox";
this.readStartInfoCheckBox.Size = new System.Drawing.Size(95, 17);
this.readStartInfoCheckBox.TabIndex = 15;
@@ -86,7 +85,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
//
this.saveResultsCheckBox.AutoSize = true;
this.saveResultsCheckBox.Enabled = false;
this.saveResultsCheckBox.Location = new System.Drawing.Point(111, 159);
this.saveResultsCheckBox.Location = new System.Drawing.Point(111, 167);
this.saveResultsCheckBox.Name = "saveResultsCheckBox";
this.saveResultsCheckBox.Size = new System.Drawing.Size(84, 17);
this.saveResultsCheckBox.TabIndex = 16;
@@ -145,22 +144,10 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.baujahrLabel.TabIndex = 7;
this.baujahrLabel.Text = "Baujahr";
//
// startInfoIsRequiredCheckBox
//
this.startInfoIsRequiredCheckBox.AutoSize = true;
this.startInfoIsRequiredCheckBox.Enabled = false;
this.startInfoIsRequiredCheckBox.Location = new System.Drawing.Point(110, 182);
this.startInfoIsRequiredCheckBox.Name = "startInfoIsRequiredCheckBox";
this.startInfoIsRequiredCheckBox.Size = new System.Drawing.Size(119, 17);
this.startInfoIsRequiredCheckBox.TabIndex = 17;
this.startInfoIsRequiredCheckBox.Text = "Start info is required";
this.startInfoIsRequiredCheckBox.UseVisualStyleBackColor = true;
//
// DatabaseCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.startInfoIsRequiredCheckBox);
this.Controls.Add(this.baujahrTextBox);
this.Controls.Add(this.baujahrLabel);
this.Controls.Add(this.dbUsedComboBox);
@@ -193,6 +180,5 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
private System.Windows.Forms.Label dbUsedLabel;
private System.Windows.Forms.TextBox baujahrTextBox;
private System.Windows.Forms.Label baujahrLabel;
private System.Windows.Forms.CheckBox startInfoIsRequiredCheckBox;
}
}

Some files were not shown because too many files have changed in this diff Show More