Compare commits
82
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80697ed65f | ||
|
|
43fd99cea6 | ||
|
|
eafcf016f3 | ||
|
|
5a89a5d43f | ||
|
|
33715395dc | ||
|
|
05982cc2ff | ||
|
|
6706b296c0 | ||
|
|
e4be90b7bc | ||
|
|
9cc9e4b4c9 | ||
|
|
45869401ad | ||
|
|
5a88e8909f | ||
|
|
a4dc7435d0 | ||
|
|
df1689d458 | ||
|
|
76a54f41a7 | ||
|
|
89593b1dac | ||
|
|
dbd6b7a9f7 | ||
|
|
e49fcdebfc | ||
|
|
1ccdcf9bd2 | ||
|
|
60f5359bd9 | ||
|
|
71cc77bee1 | ||
|
|
460b40c9cd | ||
|
|
c2e32c774e | ||
|
|
796d9fa554 | ||
|
|
8a8c6c9997 | ||
|
|
6e420250b4 | ||
|
|
4564f0424c | ||
|
|
099d635d3e | ||
|
|
d372a38e7d | ||
|
|
fc26b95bdb | ||
|
|
44735260ce | ||
|
|
6aa3cd96a6 | ||
|
|
e1eb582804 | ||
|
|
0ad4847972 | ||
|
|
323f2ede25 | ||
|
|
a64c547395 | ||
|
|
40f5079846 | ||
|
|
464dfc6dd1 | ||
|
|
c1b3cdde6d | ||
|
|
e688c4ba25 | ||
|
|
592823aa10 | ||
|
|
5ad871a7e0 | ||
|
|
049bbc8655 | ||
|
|
dcf6df293f | ||
|
|
0dd2245fe6 | ||
|
|
cd750cca2f | ||
|
|
5f2da63339 | ||
|
|
d420128b4b | ||
|
|
2ca5eec8e1 | ||
|
|
214a570ca6 | ||
|
|
8fb021da4c | ||
|
|
439d98f99d | ||
|
|
3c4fe34c1d | ||
|
|
641353585c | ||
|
|
de9a47c2a1 | ||
|
|
e902dd7c07 | ||
|
|
ac7076ee0f | ||
|
|
b5f218b657 | ||
|
|
c468854a76 | ||
|
|
1037a68d96 | ||
|
|
9e84d894a7 | ||
|
|
dbbe11cbbc | ||
|
|
8d287351b7 | ||
|
|
724869948f | ||
|
|
0497693968 | ||
|
|
de90477276 | ||
|
|
8d4af6f347 | ||
|
|
64cb33cdfd | ||
|
|
042488ba79 | ||
|
|
cd50494141 | ||
|
|
f12b2c38f7 | ||
|
|
dbfc06960f | ||
|
|
861aae753e | ||
|
|
ccf99a3105 | ||
|
|
e245ec80c6 | ||
|
|
7564ed7ba6 | ||
|
|
721bfdf5c8 | ||
|
|
f3d9fdca7f | ||
|
|
2b78f46efe | ||
|
|
77555aeebf | ||
|
|
58d34023b7 | ||
|
|
42ac833091 | ||
|
|
94eb2909bc |
@@ -14,6 +14,8 @@ TBFSetup/Debug/
|
||||
TBFSetup/Release/
|
||||
Users/bin/
|
||||
Users/obj/
|
||||
UserManagement/bin/
|
||||
UserManagement/obj/
|
||||
Doc/
|
||||
*.suo
|
||||
*.bak
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -66,7 +66,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Data.cs" />
|
||||
<Compile Include="DatabaseSettings.cs" />
|
||||
<Compile Include="DBSettings.cs" />
|
||||
<Compile Include="Entities\BenchPath.cs" />
|
||||
<Compile Include="Entities\Component.cs" />
|
||||
<Compile Include="Entities\ComponentProcedure.cs" />
|
||||
@@ -93,8 +92,6 @@
|
||||
<Compile Include="Entities\Watermeter.cs" />
|
||||
<Compile Include="Entities\WMType.cs" />
|
||||
<Compile Include="FluentCommon.cs" />
|
||||
<Compile Include="Grp.cs" />
|
||||
<Compile Include="IUser.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
<Compile Include="Mappings\ComponentMap.cs" />
|
||||
<Compile Include="Mappings\ComponentProcedureMap.cs" />
|
||||
@@ -134,6 +131,12 @@
|
||||
<EmbeddedResource Include="Resources\Strings.ru.resx" />
|
||||
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Users\Users.csproj">
|
||||
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Database settings required to make a connection
|
||||
/// </summary>
|
||||
public class DBSettings : ICloneable
|
||||
{
|
||||
public Entities.DBType DbType;
|
||||
public string ConnectionString;
|
||||
|
||||
public DBSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public DBSettings(Entities.DBType dbType, string connectionString)
|
||||
{
|
||||
this.DbType = dbType;
|
||||
this.ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new DBSettings(DbType, ConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -2,12 +2,8 @@
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public class Data
|
||||
public class Data : Users.GlobalData
|
||||
{
|
||||
/// Current user
|
||||
public static IUser CurrentUser;
|
||||
public static DateTime LastAuthorization = DateTime.Now;
|
||||
|
||||
public const string AdminUsername = "admin";
|
||||
public const string AdminPassword = "staratura";
|
||||
public const string SQLiteDbFName = "SQLite.db";
|
||||
|
||||
+10
-10
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -15,18 +15,18 @@ namespace Config
|
||||
// Public fields
|
||||
public string BenchName;
|
||||
public bool IsRealBench;
|
||||
public DBSettings ProceduresDBSettings; /// Config database settings
|
||||
public DBSettings WaterMetersDBSettings; /// Results database settings
|
||||
public DBSettings UsersDBSettings; /// Users database settings
|
||||
public Users.DBSettings ProceduresDBSettings; /// Config database settings
|
||||
public Users.DBSettings WaterMetersDBSettings; /// Results database settings
|
||||
public Users.DBSettings UsersDBSettings; /// Users database settings
|
||||
|
||||
// Constructor
|
||||
public DatabaseSettings()
|
||||
{
|
||||
BenchName = String.Empty; /// Empty string (avoid null)
|
||||
IsRealBench = false;
|
||||
ProceduresDBSettings = new DBSettings(Entities.DBType.MySql, string.Empty);
|
||||
WaterMetersDBSettings = new DBSettings(Entities.DBType.MySql, string.Empty);
|
||||
UsersDBSettings = new DBSettings(Entities.DBType.MySql, string.Empty);
|
||||
ProceduresDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
|
||||
WaterMetersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
|
||||
UsersDBSettings = new Users.DBSettings(Users.Entities.DBType.MySql, string.Empty);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
@@ -35,9 +35,9 @@ namespace Config
|
||||
|
||||
result.BenchName = BenchName;
|
||||
result.IsRealBench = IsRealBench;
|
||||
result.ProceduresDBSettings = (DBSettings)ProceduresDBSettings.Clone();
|
||||
result.WaterMetersDBSettings = (DBSettings)WaterMetersDBSettings.Clone();
|
||||
result.UsersDBSettings = (DBSettings)ProceduresDBSettings.Clone();
|
||||
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
|
||||
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
|
||||
result.UsersDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ComponentProcedure
|
||||
@@ -10,13 +13,32 @@ namespace Config.Entities
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
public virtual ComponentProcedure Clone()
|
||||
public virtual ComponentProcedure Clone(Procedure newProcedure)
|
||||
{
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Procedure = Procedure;
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(CmpntName);
|
||||
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
|
||||
}
|
||||
|
||||
public static ComponentProcedure Import(StreamReader input, Procedure newProcedure)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ComponentTest
|
||||
@@ -18,5 +21,24 @@ namespace Config.Entities
|
||||
result.Test = Test;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(CmpntName);
|
||||
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
|
||||
}
|
||||
|
||||
public static ComponentTest Import(StreamReader input, Test newTest)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Test = newTest;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-25
@@ -38,22 +38,6 @@ namespace Config.Entities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Identifies the type of a database </summary>
|
||||
public enum DBType
|
||||
{
|
||||
MySql, /// MySQL database
|
||||
SQLite, /// SQLite
|
||||
DbTypesCount,
|
||||
}
|
||||
|
||||
/// <summary> Identifies the database based on the content </summary>
|
||||
public enum DBKind
|
||||
{
|
||||
Config,
|
||||
Results,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ProcedureState
|
||||
{
|
||||
Active,
|
||||
@@ -206,6 +190,26 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
public enum MassMethod : byte
|
||||
{
|
||||
#if LANG_DE
|
||||
/// nemecky
|
||||
[Description("Waage")] Scale,
|
||||
[Description("Spanne")] Spread,
|
||||
[Description("Standardabw.")] StdDev,
|
||||
#elif LANG_CS
|
||||
/// cesky
|
||||
[Description("váhou")] Scale,
|
||||
[Description("max.rozdíl")] Spread,
|
||||
[Description("std.dev.")] StdDev,
|
||||
#else
|
||||
[Description("Scale")] Scale,
|
||||
[Description("Spread")] Spread,
|
||||
[Description("Std.dev.")] StdDev,
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
|
||||
public enum TestRedType
|
||||
{
|
||||
Fix,
|
||||
@@ -349,14 +353,5 @@ namespace Config.Entities
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
|
||||
|
||||
public enum LoginMethod
|
||||
{
|
||||
UserName, /// = alias, abbreviation
|
||||
FullName, /// = description
|
||||
Number,
|
||||
Count
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
|
||||
@@ -11,16 +11,16 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string RegulValve { get; set; }
|
||||
public virtual string FlowMeter { get; set; }
|
||||
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
|
||||
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
|
||||
public virtual string StartValve { get; set; }
|
||||
public virtual string Diverter { get; set; }
|
||||
public virtual string TempDiv { get; set; }
|
||||
public virtual string Balance { get; set; }
|
||||
public virtual string EmptyTankValve { get; set; }
|
||||
public virtual string Scale { get; set; }
|
||||
public virtual string EmptyTankValve { get; set; } /// Not used anywhere
|
||||
|
||||
/// Valves
|
||||
public virtual string ValvesOpen { get; set; }
|
||||
@@ -54,7 +54,7 @@ namespace Config.Entities
|
||||
result.StartValve = StartValve;
|
||||
result.Diverter = Diverter;
|
||||
result.TempDiv = TempDiv;
|
||||
result.Balance = Balance;
|
||||
result.Scale = Scale;
|
||||
result.EmptyTankValve = EmptyTankValve;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -40,9 +42,6 @@ namespace Config.Entities
|
||||
public virtual IList<ComponentProcedure> MoreParams { get; set; }
|
||||
public virtual IList<Test> Tests { get; set; }
|
||||
|
||||
////public virtual string MetrologicalClass { get; set; }
|
||||
////public virtual IList<WMType> WMTypes { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Procedure()
|
||||
@@ -53,7 +52,7 @@ namespace Config.Entities
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = (Config.Data.CurrentUser != null) ? Config.Data.CurrentUser.UserName : null;
|
||||
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
@@ -96,11 +95,77 @@ namespace Config.Entities
|
||||
result.TransitionStart = TransitionStart;
|
||||
result.TransitionEnd = TransitionEnd;
|
||||
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
|
||||
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
|
||||
//result.MetrologicalClass = MetrologicalClass;
|
||||
//result.WMType = WMType.Clone();
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Description);
|
||||
output.WriteLine(CreationUser);
|
||||
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(LastChgUser);
|
||||
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(MetersKind.ToString());
|
||||
output.WriteLine(Watermeters);
|
||||
output.WriteLine(ProtocolTitle);
|
||||
output.WriteLine(DataEntry);
|
||||
output.WriteLine(ResultsPrinter);
|
||||
output.WriteLine(ResultsWriter);
|
||||
output.WriteLine(TransitionStart);
|
||||
output.WriteLine(TransitionEnd);
|
||||
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
foreach (var test in Tests) { test.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
output.Close();
|
||||
}
|
||||
|
||||
public static Procedure Import(StreamReader input)
|
||||
{
|
||||
Procedure result = new Procedure();
|
||||
|
||||
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.Name = input.ReadLine();
|
||||
result.Description = input.ReadLine();
|
||||
result.CreationUser = input.ReadLine();
|
||||
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.LastChgUser = input.ReadLine();
|
||||
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
string line = input.ReadLine();
|
||||
result.MetersKind = line.Equals(MetersKind.Single.ToString()) ? MetersKind.Single : (line.Equals(MetersKind.Combined.ToString()) ? MetersKind.Combined : MetersKind.HeatMeter);
|
||||
result.Watermeters = input.ReadLine();
|
||||
result.ProtocolTitle = input.ReadLine();
|
||||
result.DataEntry = input.ReadLine();
|
||||
result.ResultsPrinter = input.ReadLine();
|
||||
result.ResultsWriter = input.ReadLine();
|
||||
result.TransitionStart = input.ReadLine();
|
||||
result.TransitionEnd = input.ReadLine();
|
||||
|
||||
while(true)
|
||||
{
|
||||
ComponentProcedure prms = ComponentProcedure.Import(input, result);
|
||||
if (prms == null)
|
||||
break;
|
||||
else
|
||||
result.MoreParams.Add(prms);
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Test tst = Test.Import(input, result);
|
||||
if (tst == null)
|
||||
break;
|
||||
else
|
||||
result.Tests.Add(tst);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+119
-28
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajik
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -22,23 +23,23 @@ namespace Config.Entities
|
||||
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
|
||||
public virtual float Volume { get; set; } /// Test volume (target) in [l]
|
||||
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
|
||||
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)
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
|
||||
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
|
||||
public virtual int Repeats { get; set; }
|
||||
public virtual bool Emptying { get; set; }
|
||||
public virtual bool Draining { get; set; }
|
||||
public virtual bool Zeroing { get; set; }
|
||||
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
|
||||
public virtual int MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5)
|
||||
public virtual float MassSpread { get; set; } /// Max spread of mass. measurements at the beginning/end of test, 0 = default
|
||||
public virtual bool MassMethod { get; set; } /// method of mass. measurement at the beginning/end of test: false=slow (precise), true=fast (immediate)
|
||||
public virtual int TimeBeforeFlow { get; set; } /// Delay time before the start of flow control in [s]
|
||||
public virtual int TimeFlow2Mass { get; set; } /// Delay time from the flow stable to the 1st mass measurement in [s]
|
||||
public virtual int TimePump2StartV { get; set; }/// Delay time from the start of the pump to opening the start valve in [s]
|
||||
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
|
||||
public virtual double TolerRed { get; set; } /// = Filter
|
||||
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
|
||||
public virtual int MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5)
|
||||
public virtual float MassSpread { get; set; } /// Max spread of mass. measurements at the beginning/end of test, 0 = default
|
||||
public virtual MassMethod MassMethod { get; set; } /// method of mass. measurement at the beginning/end of test: false=slow (precise), true=using immediate mass measurement and evaluation
|
||||
public virtual int TimeBeforeFlow { get; set; } /// Delay time before the start of flow control in [s]
|
||||
public virtual int TimeFlow2Mass { get; set; } /// Delay time from the flow stable to the 1st mass measurement in [s]
|
||||
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
|
||||
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
|
||||
public virtual double TolerRed { get; set; } /// = Filter
|
||||
public virtual TestRedType RedType { get; set; }
|
||||
public virtual string FeedingPath { get; set; }
|
||||
public virtual string BenchPath { get; set; }
|
||||
@@ -68,23 +69,23 @@ namespace Config.Entities
|
||||
Publish = (sbyte)Config.Entities.Publish.Always;
|
||||
Evaluate = true;
|
||||
Repeats = 1;
|
||||
Emptying = false;
|
||||
Draining = false;
|
||||
Zeroing = false;
|
||||
ErrLimLo = -2.0f; /// [%] lower error limit
|
||||
ErrLimHi = 2.0f; /// [%] upper error limit
|
||||
ErrLimLo = -2.0f; /// [%] lower error limit
|
||||
ErrLimHi = 2.0f; /// [%] upper error limit
|
||||
Uncertainty = 0;
|
||||
PumpPower = 60.0f; /// [%]
|
||||
MassRepeats = 0; /// default
|
||||
MassSpread = 0; /// default
|
||||
MassMethod = false; /// default
|
||||
TimeBeforeFlow = 10; /// [s] time before the start of flow control in [s]
|
||||
TimeFlow2Mass = 5; /// [s] time from the flow stable to the 1st mass measurement in [s]
|
||||
TimePump2StartV = 1; /// [s] time from the 1st mass measurement to the test start in [s]
|
||||
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
|
||||
TolerRed = 0; /// = Filter parameter
|
||||
RelTransBefore = string.Empty;
|
||||
PumpPower = 60.0f; /// [%]
|
||||
MassRepeats = 0; /// default
|
||||
MassSpread = 0; /// default
|
||||
MassMethod = MassMethod.Scale; /// default
|
||||
TimeBeforeFlow = 10; /// [s] time before the start of flow control in [s]
|
||||
TimeFlow2Mass = 5; /// [s] time from the flow stable to the 1st mass measurement in [s]
|
||||
TimePump2StartV = 1; /// [s] time from the 1st mass measurement to the test start in [s]
|
||||
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
|
||||
TolerRed = 0; /// = Filter parameter
|
||||
RelTransBefore = string.Empty;
|
||||
RelTransBetween = string.Empty;
|
||||
RelTransAfter = string.Empty;
|
||||
RelTransAfter = string.Empty;
|
||||
TransitionAfter = string.Empty;
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ namespace Config.Entities
|
||||
result.Volume = Volume;
|
||||
result.TstTime = TstTime;
|
||||
result.Repeats = Repeats;
|
||||
result.Emptying = Emptying;
|
||||
result.Draining = Draining;
|
||||
result.Zeroing = Zeroing;
|
||||
result.PumpPower = PumpPower;
|
||||
result.MassRepeats = MassRepeats;
|
||||
@@ -141,6 +142,96 @@ namespace Config.Entities
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Part.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Publish.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Evaluate.ToString());
|
||||
output.WriteLine(Qfrom.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Qto.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Volume.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(TstTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Method);
|
||||
output.WriteLine(ErrLimLo.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(ErrLimHi.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Uncertainty.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Repeats.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Draining.ToString());
|
||||
output.WriteLine(Zeroing.ToString());
|
||||
output.WriteLine(PumpPower.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(MassRepeats.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(MassSpread.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(((byte)MassMethod).ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(TimeBeforeFlow.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(TimeFlow2Mass.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(TimePump2StartV.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(TimeStop2Mass.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(FeedingPath);
|
||||
output.WriteLine(BenchPath);
|
||||
output.WriteLine(OutputPath);
|
||||
output.WriteLine(MetersPath);
|
||||
output.WriteLine(RelTransBefore);
|
||||
output.WriteLine(RelTransBetween);
|
||||
output.WriteLine(RelTransAfter);
|
||||
output.WriteLine(TransitionAfter);
|
||||
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
output.WriteLine();
|
||||
}
|
||||
|
||||
public static Test Import(StreamReader input, Procedure newProcedure)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
Test tst = new Test();
|
||||
tst.Name = firstLine;
|
||||
tst.Part = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Evaluate = bool.Parse(input.ReadLine());
|
||||
tst.Qfrom = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Qto = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Volume = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.TstTime = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Method = input.ReadLine();
|
||||
tst.ErrLimLo = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.ErrLimHi = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Uncertainty = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Repeats = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.Draining = bool.Parse(input.ReadLine());
|
||||
tst.Zeroing = bool.Parse(input.ReadLine());
|
||||
tst.PumpPower = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.MassRepeats = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.MassSpread = float.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.MassMethod = (MassMethod)byte.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.TimeBeforeFlow = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.TimeFlow2Mass = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.TimePump2StartV = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.TimeStop2Mass = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
tst.FeedingPath = input.ReadLine();
|
||||
tst.BenchPath = input.ReadLine();
|
||||
tst.OutputPath = input.ReadLine();
|
||||
tst.MetersPath = input.ReadLine();
|
||||
tst.RelTransBefore = input.ReadLine();
|
||||
tst.RelTransBetween = input.ReadLine();
|
||||
tst.RelTransAfter = input.ReadLine();
|
||||
tst.TransitionAfter = input.ReadLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
ComponentTest prms = ComponentTest.Import(input, tst);
|
||||
if (prms == null)
|
||||
break;
|
||||
else
|
||||
tst.MoreParams.Add(prms);
|
||||
}
|
||||
|
||||
tst.Procedure = newProcedure;
|
||||
return tst;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty;
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Config.Entities
|
||||
Volume = test.Volume;
|
||||
TstTime = test.TstTime;
|
||||
Repeats = test.Repeats;
|
||||
Emptying = test.Emptying;
|
||||
Emptying = test.Draining;
|
||||
Zeroing = test.Zeroing;
|
||||
PumpPower = PumpPower;
|
||||
Time2MassMsrmt = test.TimeStop2Mass;
|
||||
|
||||
+2
-379
@@ -1,20 +1,13 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using Config.Resources;
|
||||
using log4net;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class User : IUser
|
||||
public class User //: Users.IUser
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(User));
|
||||
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string UserName { get; set; } /// = name, alias, abbreviation
|
||||
public virtual string FullName { get; set; } /// = description
|
||||
@@ -23,379 +16,9 @@ namespace Config.Entities
|
||||
public virtual DateTime LastPwChange { get; set; }
|
||||
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
|
||||
|
||||
private bool powerUser; /// true for built-in users, power users have full access even with empty Groups list
|
||||
|
||||
public User()
|
||||
{
|
||||
this.powerUser = false;
|
||||
Groups = new List<Group>();
|
||||
#if ORACLE_DB
|
||||
Number = 6;
|
||||
#else
|
||||
Number = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
public User(string userName, int number, bool powerUser)
|
||||
{
|
||||
UserName = userName;
|
||||
Number = number;
|
||||
this.powerUser = powerUser;
|
||||
Groups = new List<Group>();
|
||||
FullName = powerUser ? "Power user" : string.Empty;
|
||||
}
|
||||
|
||||
public virtual void AddGroup(Group group)
|
||||
{
|
||||
Groups.Add(group);
|
||||
}
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
/// <summary>
|
||||
/// Check whether user is a member of a group.
|
||||
/// </summary>
|
||||
/// <param name="groupId">Group GID</param>
|
||||
/// <returns>true is user is a member of the specified group</returns>
|
||||
public virtual bool IsMemberOf(Grp.GID groupId)
|
||||
{
|
||||
if (groupId == Grp.GID.None || powerUser)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (groupId >= 0 && (int)groupId < Grp.Count)
|
||||
{
|
||||
// for all group elements in User.groups
|
||||
for (int i = 0; i < Groups.Count; ++i)
|
||||
{
|
||||
// element GID = parameter GroupId ?
|
||||
if (((Group)Groups[i]).Gid == (int)groupId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets users password. It then will be encrypted.
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
public virtual void SetPassword(string password)
|
||||
{
|
||||
this.Password = EncryptedPassword(password);
|
||||
LastPwChange = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
public virtual string EncryptedPassword(string password)
|
||||
{
|
||||
return getHash(password);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies users password. Used by static bool Authorisation(...)
|
||||
/// </summary>
|
||||
/// <param name="password">Password</param>
|
||||
/// <returns>true if password is correct</returns>
|
||||
public virtual bool CheckPassword(string password)
|
||||
{
|
||||
return (Password == EncryptedPassword(password));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The FIRST of TWO possible user authorization method to be used
|
||||
/// when a specific group membership is required (you can use Grp.GID.None).
|
||||
/// If the user is not authorized, the current user remains to be a current user
|
||||
/// (i.e. the access rights were not risen to a higher level).
|
||||
/// If you require different behavior, use Unauthorize() before calling Authorize().
|
||||
/// </summary>
|
||||
/// <param name="userName">User name</param>
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool Authorize(string userName, string password, Grp.GID requiredGroupMembership)
|
||||
{
|
||||
if (Entities.User.IsPowerUser(userName, password))
|
||||
{
|
||||
Data.CurrentUser = this;
|
||||
Data.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("Power user '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (UserName.ToLower() == userName.ToLower())
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
{
|
||||
Data.CurrentUser = this;
|
||||
Data.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SECOND of TWO possible user authorization method to be used when
|
||||
/// no specific group membership is required.
|
||||
/// </summary>
|
||||
public virtual bool Authorize(string userName, string password)
|
||||
{
|
||||
return Authorize(userName, password, Grp.GID.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The FIRST of TWO possible user authorization method to be used
|
||||
/// when a specific group membership is required (you can use Grp.GID.None).
|
||||
/// If the user is not authorized, the current user remains to be a current user
|
||||
/// (i.e. the access rights were not risen to a higher level).
|
||||
/// If you require different behavior, use Unauthorize() before calling Authorize().
|
||||
/// </summary>
|
||||
/// <param name="number">User ID number</param>
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeNumber(int number, string password, Grp.GID requiredGroupMembership)
|
||||
{
|
||||
if (Number == number)
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
{
|
||||
Data.CurrentUser = this;
|
||||
Data.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User ID={0} authorized @level '{1}'", number, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SECOND of TWO possible user authorization method to be used when
|
||||
/// no specific group membership is required.
|
||||
/// </summary>
|
||||
public virtual bool AuthorizeNumber(int number, string password)
|
||||
{
|
||||
return AuthorizeNumber(number, password, Grp.GID.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The FIRST of TWO possible user authorization method to be used
|
||||
/// when a specific group membership is required (you can use Grp.GID.None).
|
||||
/// If the user is not authorized, the current user remains to be a current user
|
||||
/// (i.e. the access rights were not risen to a higher level).
|
||||
/// If you require different behavior, use Unauthorize() before calling Authorize().
|
||||
/// </summary>
|
||||
/// <param name="fullName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeFullName(string fullName, string password, Grp.GID requiredGroupMembership)
|
||||
{
|
||||
if (FullName.ToLower() == fullName.ToLower())
|
||||
{
|
||||
if (IsMemberOf(requiredGroupMembership) && CheckPassword(password))
|
||||
{
|
||||
Data.CurrentUser = this;
|
||||
Data.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User alias={0} authorized @level '{1}'", fullName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The SECOND of TWO possible user authorization method to be used when
|
||||
/// no specific group membership is required.
|
||||
/// </summary>
|
||||
public virtual bool AuthorizeFullName(string fullName, string password)
|
||||
{
|
||||
return AuthorizeFullName(fullName, password, Grp.GID.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from a database.
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User AuthorizeDummyUser(string username)
|
||||
{
|
||||
User user = new User();
|
||||
user.UserName = username;
|
||||
Data.CurrentUser = user;
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from an ARBITRARY database.
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByName(string userName, DBSettings dbSettings)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(DBKind.Config, dbSettings, false)
|
||||
.OpenSession()
|
||||
.CreateQuery("FROM User WHERE LOWER(UserName) = :username") /// Note: QueryOver<User>().Where(x => x.UserName.ToLower() == ... does not work
|
||||
.SetParameter("username", userName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from the users database.
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByName(string userName)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSession(DBKind.Config)
|
||||
.CreateQuery("FROM User WHERE LOWER(UserName) = :username") /// Note: QueryOver<User>().Where(x => x.UserName.ToLower() == ... does not work
|
||||
.SetParameter("username", userName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given full name from an ARBITRARY database.
|
||||
/// </summary>
|
||||
/// <param name="fullName">Full name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByFullName(string fullName, Config.DBSettings dbSettings)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(DBKind.Config, dbSettings, false)
|
||||
.OpenSession()
|
||||
.CreateQuery("FROM User WHERE LOWER(Description) = :fullname") /// Note: QueryOver<User>().Where(x => x.FullName.ToLower() == ... does not work
|
||||
.SetParameter("fullname", fullName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given full name from the users database.
|
||||
/// </summary>
|
||||
/// <param name="fullName">Full name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByFullName(string fullName)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSession(DBKind.Config)
|
||||
.CreateQuery("FROM User WHERE LOWER(Description) = :fullname") /// Note: QueryOver<User>().Where(x => x.FullName.ToLower() == ... does not work
|
||||
.SetParameter("fullname", fullName.ToLower())
|
||||
.List<User>();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from an ARBITRARY database.
|
||||
/// </summary>
|
||||
/// <param name="number">User ID number for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByNumber(int number, Config.DBSettings dbSettings)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSessionFactory(DBKind.Config, dbSettings, false)
|
||||
.OpenSession()
|
||||
.QueryOver<User>()
|
||||
.Where(x => (x.Number == number))
|
||||
.List();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a 'User' with a given username from the users database.
|
||||
/// </summary>
|
||||
/// <param name="number">User ID number for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User LoadUserByNumber(int number)
|
||||
{
|
||||
IList<User> listOfUsers = FluentCommon.CreateSession(DBKind.Config)
|
||||
.QueryOver<User>()
|
||||
.Where(x => (x.Number == number))
|
||||
.List();
|
||||
if (listOfUsers.Count > 0) return listOfUsers[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns an IList of all Users
|
||||
/// </summary>
|
||||
public static IList<User> GetAllUsers()
|
||||
{
|
||||
return FluentCommon.CreateSession(DBKind.Config)
|
||||
.CreateQuery("FROM User")
|
||||
.List<User>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Unauthorize, abandon current users authorization.
|
||||
/// </summary>
|
||||
public static void Unauthorize()
|
||||
{
|
||||
Data.CurrentUser = null;
|
||||
Data.LastAuthorization = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// getHash encrypts a string
|
||||
/// </summary>
|
||||
/// <param name="text">the string to encrypt</param>
|
||||
/// <returns></returns>
|
||||
public static string getHash(string text)
|
||||
{
|
||||
byte[] bytes = Encoding.Unicode.GetBytes(text);
|
||||
SHA512Managed hashstring = new SHA512Managed();
|
||||
byte[] hash = hashstring.ComputeHash(bytes);
|
||||
string hashString = string.Empty;
|
||||
foreach (byte x in hash)
|
||||
{
|
||||
hashString += String.Format("{0:x2}", x);
|
||||
}
|
||||
return hashString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns 'true' when authentication data are valid for a power user.
|
||||
/// </summary>
|
||||
/// <param name="userName">User name</param>
|
||||
/// <param name="password">Password</param>
|
||||
/// <returns>true = authenticated, false = refused</returns>
|
||||
public static bool IsPowerUser(string userName, string password)
|
||||
{
|
||||
return (userName.Equals("milan") && password.Equals("napajedla")) ||
|
||||
(userName.Equals("igor") && password.Equals("ronko4")) ||
|
||||
(userName.Equals("vlado") && password.Equals("luskovica.430")) ||
|
||||
(userName.Equals("pakan") && password.Equals("kuriatko")) ||
|
||||
(userName.Equals("evinic") && password.Equals("stivik55")) ||
|
||||
(userName.Equals("gilles") && password.Equals("alibaba"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Config.Entities
|
||||
WMType procedure = new WMType()
|
||||
{
|
||||
CreateTime = DateTime.Now,
|
||||
CreateUserName = Config.Data.CurrentUser.UserName,
|
||||
CreateUserName = Users.GlobalData.CurrentUser.UserName,
|
||||
CreateDescription = "A default water meter created.",
|
||||
Name = "Watermeter",
|
||||
PulseRate = 1000,
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Config.Entities
|
||||
/// </summary>
|
||||
public static Watermeter LoadBySerialnr(string SerialNr)
|
||||
{
|
||||
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(DBKind.Results)
|
||||
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Users.Entities.DBKind.Results)
|
||||
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
|
||||
.SetParameter("SerialNrParameter", SerialNr)
|
||||
.List<Watermeter>();
|
||||
|
||||
+30
-30
@@ -17,61 +17,61 @@ namespace Config
|
||||
/// <summary>
|
||||
/// Session factories for regular sessions.
|
||||
/// </summary>
|
||||
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Entities.DBKind.Count];
|
||||
public static ISessionFactory[] SessionFactories = new ISessionFactory[(int)Users.Entities.DBKind.Count];
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
static ISessionFactory CreateSessionFactory(Entities.DBKind database)
|
||||
static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database)
|
||||
{
|
||||
Entities.DBType dbType;
|
||||
Users.Entities.DBType dbType;
|
||||
string connectionString;
|
||||
|
||||
switch (database)
|
||||
{
|
||||
default:
|
||||
case Entities.DBKind.Config:
|
||||
case Users.Entities.DBKind.Config:
|
||||
dbType = Data.CurrentBench.ProceduresDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
break;
|
||||
case Entities.DBKind.Results:
|
||||
case Users.Entities.DBKind.Results:
|
||||
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
break;
|
||||
}
|
||||
|
||||
return CreateSessionFactory(database, new DBSettings(dbType, connectionString), false);
|
||||
return CreateSessionFactory(database, dbType, connectionString, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NHibernate session factory (to create the database session 'SessionFactory')
|
||||
/// </summary>
|
||||
/// <returns>A database session</returns>
|
||||
public static ISessionFactory CreateSessionFactory(Entities.DBKind database, DBSettings dbSettings, bool createDB)
|
||||
public static ISessionFactory CreateSessionFactory(Users.Entities.DBKind database, Users.Entities.DBType dbType, string connectionString, bool createDB)
|
||||
{
|
||||
try
|
||||
{
|
||||
FluentConfiguration cfg = Fluently.Configure();
|
||||
|
||||
switch (dbSettings.DbType)
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case Entities.DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(dbSettings.ConnectionString));
|
||||
case Users.Entities.DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
case Entities.DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(dbSettings.ConnectionString));
|
||||
case Users.Entities.DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (database)
|
||||
{
|
||||
default:
|
||||
case Entities.DBKind.Config:
|
||||
case Users.Entities.DBKind.Config:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
case Entities.DBKind.Results:
|
||||
case Users.Entities.DBKind.Results:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
}
|
||||
@@ -112,17 +112,17 @@ namespace Config
|
||||
}
|
||||
|
||||
/// Create a NHibernate session for the given database
|
||||
public static ISession CreateSession(Entities.DBKind database)
|
||||
public static ISession CreateSession(Users.Entities.DBKind database)
|
||||
{
|
||||
int ix = (int)database;
|
||||
if (ix < 0 || ix >= (int)Entities.DBKind.Count) return null;
|
||||
if (ix < 0 || ix >= (int)Users.Entities.DBKind.Count) return null;
|
||||
|
||||
if (SessionFactories[ix] == null) SessionFactories[ix] = CreateSessionFactory(database);
|
||||
|
||||
return SessionFactories[ix].OpenSession();
|
||||
}
|
||||
|
||||
public static void SaveToDb(Entities.DBKind database, object obj)
|
||||
public static void SaveToDb(Users.Entities.DBKind database, object obj)
|
||||
{
|
||||
SaveToDb(CreateSession(database), obj);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ namespace Config
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(Entities.DBKind database, object obj)
|
||||
public static void DeleteFromDb(Users.Entities.DBKind database, object obj)
|
||||
{
|
||||
DeleteFromDb(CreateSession(database), obj);
|
||||
}
|
||||
@@ -158,9 +158,9 @@ namespace Config
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyConfigDB(DBSettings dbSettings)
|
||||
public static bool CreateEmptyConfigDB(Users.Entities.DBType dbType, string connectionString)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Entities.DBKind.Config, dbSettings, true);
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Config, dbType, connectionString, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
@@ -171,16 +171,16 @@ namespace Config
|
||||
///
|
||||
/// Prepare all groups
|
||||
///
|
||||
var testers = new Entities.Group { Gid = (int)Grp.GID.Testers, Name = Strings.Tester };
|
||||
var testingSpecialists = new Entities.Group { Gid = (int)Grp.GID.TestingSpecialists, Name = Strings.Testing_Specialist };
|
||||
var headOfLab = new Entities.Group { Gid = (int)Grp.GID.HeadOfLab, Name = Strings.Head_of_Lab };
|
||||
var maintenanceSpecialists = new Entities.Group { Gid = (int)Grp.GID.MaintenanceSpecialists, Name = Strings.Maintenance_Specialist };
|
||||
var metrologists = new Entities.Group { Gid = (int)Grp.GID.Metrologists, Name = Strings.Metrologist };
|
||||
var calibrationSpecialists = new Entities.Group { Gid = (int)Grp.GID.CalibrationSpecialists, Name = Strings.Calibration_Specialist };
|
||||
var administrators = new Entities.Group { Gid = (int)Grp.GID.Administrators, Name = Strings.Administrator };
|
||||
var testers = new Users.Entities.Group((int)Users.Grp.GID.Testers, Strings.Tester);
|
||||
var testingSpecialists = new Users.Entities.Group((int)Users.Grp.GID.TestingSpecialists, Strings.Testing_Specialist);
|
||||
var headOfLab = new Users.Entities.Group((int)Users.Grp.GID.HeadOfLab, Strings.Head_of_Lab);
|
||||
var maintenanceSpecialists = new Users.Entities.Group((int)Users.Grp.GID.MaintenanceSpecialists, Strings.Maintenance_Specialist);
|
||||
var metrologists = new Users.Entities.Group((int)Users.Grp.GID.Metrologists, Strings.Metrologist);
|
||||
var calibrationSpecialists = new Users.Entities.Group((int)Users.Grp.GID.CalibrationSpecialists, Strings.Calibration_Specialist);
|
||||
var administrators = new Users.Entities.Group((int)Users.Grp.GID.Administrators, Strings.Administrator);
|
||||
|
||||
/// Create the user 'admin' add his groups
|
||||
var admin = new Entities.User
|
||||
var admin = new Users.Entities.User
|
||||
{
|
||||
UserName = Data.AdminUsername,
|
||||
FullName = Strings.Administrator,
|
||||
@@ -214,9 +214,9 @@ namespace Config
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyResultsDB(DBSettings dbSettings)
|
||||
public static bool CreateEmptyResultsDB(Users.Entities.DBType dbType, string connectionString)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Entities.DBKind.Results, dbSettings, true);
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Results, dbType, connectionString, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace Config.Mappings
|
||||
Map(x => x.StartValve);
|
||||
Map(x => x.Diverter);
|
||||
Map(x => x.TempDiv);
|
||||
Map(x => x.Balance);
|
||||
Map(x => x.Scale)
|
||||
.Column("Balance");
|
||||
Map(x => x.EmptyTankValve);
|
||||
Map(x => x.ValvesOpen)
|
||||
.CustomType("StringClob")
|
||||
|
||||
@@ -22,12 +22,14 @@ namespace Config.Mappings
|
||||
Map(x => x.Volume);
|
||||
Map(x => x.TstTime);
|
||||
Map(x => x.Repeats);
|
||||
Map(x => x.Emptying);
|
||||
Map(x => x.Draining)
|
||||
.Column("Emptying");
|
||||
Map(x => x.Zeroing);
|
||||
Map(x => x.PumpPower);
|
||||
Map(x => x.MassRepeats);
|
||||
Map(x => x.MassSpread);
|
||||
Map(x => x.MassMethod);
|
||||
Map(x => x.MassMethod)
|
||||
.CustomType<byte>();
|
||||
Map(x => x.TimeBeforeFlow);
|
||||
Map(x => x.TimeFlow2Mass);
|
||||
Map(x => x.TimePump2StartV)
|
||||
|
||||
@@ -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.12.486.0")]
|
||||
[assembly: AssemblyFileVersion("2.12.486.0")]
|
||||
[assembly: AssemblyVersion("2.12.537.0")]
|
||||
[assembly: AssemblyFileVersion("2.12.537.0")]
|
||||
|
||||
+39
-4
@@ -30,9 +30,9 @@ namespace Results
|
||||
}
|
||||
|
||||
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
|
||||
private static Config.Entities.DBType dbType;
|
||||
private static Users.Entities.DBType dbType;
|
||||
///
|
||||
public static Config.Entities.DBType DbType
|
||||
public static Users.Entities.DBType DbType
|
||||
{
|
||||
get { return dbType; }
|
||||
set { dbType = value; SessionFactory = null; }
|
||||
@@ -59,10 +59,10 @@ namespace Results
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case Config.Entities.DBType.SQLite:
|
||||
case Users.Entities.DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
case Config.Entities.DBType.MySql:
|
||||
case Users.Entities.DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
|
||||
break;
|
||||
}
|
||||
@@ -270,5 +270,40 @@ namespace Results
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static Batch LoadBatch(int batchNr)
|
||||
{
|
||||
IList<Batch> batches;
|
||||
ISession session = DB.CreateSession();
|
||||
if (session == null) return null;
|
||||
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
|
||||
try
|
||||
{
|
||||
batches = session.QueryOver<Batch>()
|
||||
.Where(x => (x.BatchNr == batchNr))
|
||||
.List();
|
||||
|
||||
foreach (var batch in batches)
|
||||
{
|
||||
batch.TestRslts = session.QueryOver<TestRslt>()
|
||||
.Where(x => (x.Batch.Id == batch.Id))
|
||||
.List();
|
||||
batch.WaterMeters = session.QueryOver<WaterMeter>()
|
||||
.Where(x => (x.Batch.Id == batch.Id))
|
||||
.List();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (batches.Count > 0) ? batches[0] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using Results.Entities;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
public class DBase
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(DBase));
|
||||
|
||||
/// <summary> Session factory for all regular sessions, not for CreateEmptyResultsDB(). </summary>
|
||||
public static IList<DBase> Databases;
|
||||
public static int Count { get { return Databases.Count; } }
|
||||
|
||||
static DBase()
|
||||
{
|
||||
Databases = new List<DBase>();
|
||||
}
|
||||
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string ConnectionString;
|
||||
|
||||
ISessionFactory sessionFactory;
|
||||
|
||||
public DBase(string connectionString, string name)
|
||||
{
|
||||
this.ConnectionString = connectionString;
|
||||
this.Name = name;
|
||||
sessionFactory = Fluently.Configure()
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>())
|
||||
.ExposeConfiguration(BuildSchema)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
|
||||
public DBase(string connectionString)
|
||||
: this(connectionString, string.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private void BuildSchema(Configuration config)
|
||||
{
|
||||
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
|
||||
new SchemaExport(config).SetOutputFile("db_schema");
|
||||
}
|
||||
|
||||
public ISession OpenSession()
|
||||
{
|
||||
return sessionFactory.OpenSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,5 +89,24 @@ namespace Results.Entities
|
||||
TestRslt = testRslt;
|
||||
CompoundMeterId = (byte)compoundMeterId;
|
||||
}
|
||||
|
||||
public virtual void CopyContentFrom(MeterTestRslt src)
|
||||
{
|
||||
if (src == null) return;
|
||||
|
||||
PulsesMeter = src.PulsesMeter;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
PulsesPerLiter = src.PulsesPerLiter;
|
||||
VolumeStart = src.VolumeStart;
|
||||
VolumeEnd = src.VolumeEnd;
|
||||
VolumeMeter = src.VolumeMeter;
|
||||
VolumeRef = src.VolumeRef;
|
||||
TimestampStart = src.TimestampStart;
|
||||
TimestampEnd = src.TimestampEnd;
|
||||
TestTime = src.TestTime;
|
||||
Error = src.Error;
|
||||
TestDone = src.TestDone;
|
||||
Passed = src.Passed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Results.Entities
|
||||
public virtual TestData TestData { get; set; }
|
||||
public virtual Components Components { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
|
||||
/// Main results
|
||||
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; }
|
||||
public virtual double ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
|
||||
@@ -104,7 +104,7 @@ namespace Results.Entities
|
||||
|
||||
/// Wrappers
|
||||
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
public virtual double Qfrom() { return TestData.Qfrom; }
|
||||
public virtual double Qto() { return TestData.Qto; }
|
||||
public virtual double TargetVolume() { return TestData.TargetVolume; }
|
||||
@@ -130,6 +130,94 @@ namespace Results.Entities
|
||||
RepetitionNr = repetitionNr;
|
||||
}
|
||||
|
||||
public virtual void CopyContentFrom(TestRslt src)
|
||||
{
|
||||
if (src == null) return;
|
||||
|
||||
Components = src.Components; /// ???
|
||||
Part = src.Part;
|
||||
RepetitionNr = src.RepetitionNr;
|
||||
StartTime = src.StartTime;
|
||||
EndTime = src.EndTime;
|
||||
FlowSetTime = src.FlowSetTime;
|
||||
TestTime = src.TestTime;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
ConstMaster = src.ConstMaster;
|
||||
MassStartRaw = src.MassStartRaw;
|
||||
MassStart = src.MassStart;
|
||||
MassEndRaw = src.MassEndRaw;
|
||||
MassEnd = src.MassEnd;
|
||||
DensityIn = src.DensityIn;
|
||||
DensityOut = src.DensityOut;
|
||||
DensityDiv = src.DensityDiv;
|
||||
Buoyancy = src.Buoyancy;
|
||||
FlowMass = src.FlowMass;
|
||||
FlowVolume = src.FlowVolume;
|
||||
VolumeCTV = src.VolumeCTV;
|
||||
VolumeMaster = src.VolumeMaster;
|
||||
ErrorMaster = src.ErrorMaster;
|
||||
RefEnergy = src.RefEnergy;
|
||||
AmbTempMean = src.AmbTempMean;
|
||||
AmbTempStart = src.AmbTempStart;
|
||||
AmbTempEnd = src.AmbTempEnd;
|
||||
AmbTempMin = src.AmbTempMin;
|
||||
AmbTempMax = src.AmbTempMax;
|
||||
AmbPressMean = src.AmbPressMean;
|
||||
AmbPressStart = src.AmbPressStart;
|
||||
AmbPressEnd = src.AmbPressEnd;
|
||||
AmbPressMin = src.AmbPressMin;
|
||||
AmbPressMax = src.AmbPressMax;
|
||||
AmbHumiMean = src.AmbHumiMean;
|
||||
AmbHumiStart = src.AmbHumiStart;
|
||||
AmbHumiEnd = src.AmbHumiEnd;
|
||||
AmbHumiMin = src.AmbHumiMin;
|
||||
AmbHumiMax = src.AmbHumiMax;
|
||||
PressUpMean = src.PressUpMean;
|
||||
PressUpStart = src.PressUpStart;
|
||||
PressUpEnd = src.PressUpEnd;
|
||||
PressUpMin = src.PressUpMin;
|
||||
PressUpMax = src.PressUpMax;
|
||||
PressDownMean = src.PressDownMean;
|
||||
PressDownStart = src.PressDownStart;
|
||||
PressDownEnd = src.PressDownEnd;
|
||||
PressDownMin = src.PressDownMin;
|
||||
PressDownMax = src.PressDownMax;
|
||||
PressDeltaMean = src.PressDeltaMean;
|
||||
PressDeltaStart = src.PressDeltaStart;
|
||||
PressDeltaEnd = src.PressDeltaEnd;
|
||||
PressDeltaMin = src.PressDeltaMin;
|
||||
PressDeltaMax = src.PressDeltaMax;
|
||||
TempUpMean = src.TempUpMean;
|
||||
TempUpStart = src.TempUpStart;
|
||||
TempUpEnd = src.TempUpEnd;
|
||||
TempUpMin = src.TempUpMin;
|
||||
TempUpMax = src.TempUpMax;
|
||||
TempDownMean = src.TempDownMean;
|
||||
TempDownStart = src.TempDownStart;
|
||||
TempDownEnd = src.TempDownEnd;
|
||||
TempDownMin = src.TempDownMin;
|
||||
TempDownMax = src.TempDownMax;
|
||||
TempDivMean = src.TempDivMean;
|
||||
TempDivStart = src.TempDivStart;
|
||||
TempDivEnd = src.TempDivEnd;
|
||||
TempDivMin = src.TempDivMin;
|
||||
TempDivMax = src.TempDivMax;
|
||||
FlowStart = src.FlowStart;
|
||||
FlowEnd = src.FlowEnd;
|
||||
FlowMin = src.FlowMin;
|
||||
FlowMax = src.FlowMax;
|
||||
Custom1 = src.Custom1;
|
||||
Custom2 = src.Custom2;
|
||||
Custom3 = src.Custom3;
|
||||
Custom4 = src.Custom4;
|
||||
Custom5 = src.Custom5;
|
||||
Custom6 = src.Custom6;
|
||||
Custom7 = src.Custom7;
|
||||
Custom8 = src.Custom8;
|
||||
Custom9 = src.Custom9;
|
||||
Custom10 = src.Custom10;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Config.Entities;
|
||||
|
||||
@@ -27,8 +26,10 @@ namespace Results.Entities
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
public virtual double Q2Correction { get; set; } /// !!! obsolete
|
||||
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
public virtual double Diff2Hz8Hz { get; set; }
|
||||
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test
|
||||
@@ -142,6 +143,50 @@ namespace Results.Entities
|
||||
}
|
||||
|
||||
|
||||
public virtual void CopyContentFrom(WaterMeter src)
|
||||
{
|
||||
if (src == null) return;
|
||||
|
||||
SerialNr = src.SerialNr;
|
||||
SerialNrAux = src.SerialNrAux;
|
||||
PurchaseOrder = src.PurchaseOrder;
|
||||
YearOfProduction = src.YearOfProduction;
|
||||
// WMPosition skipped
|
||||
EndState = src.EndState;
|
||||
EndStateAux = src.EndStateAux;
|
||||
QRise = src.QRise;
|
||||
QFall = src.QFall;
|
||||
Passed = src.Passed;
|
||||
ResultCode = src.ResultCode;
|
||||
#if IPERL
|
||||
SerialNrEx = src.SerialNrEx;
|
||||
OrigCalibFactor = src.OrigCalibFactor;
|
||||
CalibFactor = src.CalibFactor;
|
||||
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
|
||||
Q2CorrectionDone = src.Q2CorrectionDone;
|
||||
Q2Correction = src.Q2Correction;
|
||||
Q2CorrRFlow = src.Q2CorrRFlow;
|
||||
Q2CorrLFlow = src.Q2CorrLFlow;
|
||||
Q2CorrFlowRight = src.Q2CorrFlowRight;
|
||||
Diff2Hz8Hz = src.Diff2Hz8Hz;
|
||||
Hz2CorrectionDone = src.Hz2CorrectionDone;
|
||||
Hz2Correction = src.Hz2Correction;
|
||||
#endif
|
||||
#if ORACLE_DB
|
||||
Pruefindex = src.Pruefindex;
|
||||
HydrPruefung = src.HydrPruefung;
|
||||
#endif
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
|
||||
if (srcMtr != null)
|
||||
{
|
||||
mtr.CopyContentFrom(srcMtr);
|
||||
mtr.TestRslt.CopyContentFrom(srcMtr.TestRslt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(80);
|
||||
|
||||
@@ -30,7 +30,9 @@ namespace Results.Mappings
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.Q2CorrectionDone);
|
||||
Map(x => x.Q2Correction);
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Q2CorrRFlow);
|
||||
Map(x => x.Q2CorrLFlow);
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Diff2Hz8Hz);
|
||||
Map(x => x.Hz2CorrectionDone);
|
||||
Map(x => x.Hz2Correction);
|
||||
|
||||
@@ -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.12.486.0")]
|
||||
[assembly: AssemblyFileVersion("2.12.486.0")]
|
||||
[assembly: AssemblyVersion("2.12.544.0")]
|
||||
[assembly: AssemblyFileVersion("2.12.544.0")]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -59,6 +59,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BatchResults.cs" />
|
||||
<Compile Include="DBase.cs" />
|
||||
<Compile Include="Entities\Batch.cs" />
|
||||
<Compile Include="Entities\Components.cs" />
|
||||
<Compile Include="Entities\MeterTestRslt.cs" />
|
||||
@@ -116,6 +117,10 @@
|
||||
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Users\Users.csproj">
|
||||
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="FileWriters\" />
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ResultsBrowser.Forms
|
||||
/// <summary>
|
||||
/// Required access rights to make changes with this form
|
||||
/// </summary>
|
||||
const Config.Grp.GID RequiredGroupMembership = Config.Grp.GID.Metrologists;
|
||||
const Users.Grp.GID RequiredGroupMembership = Users.Grp.GID.Metrologists;
|
||||
public Config.Entities.TestsArrangement TestsArrangement;
|
||||
public Config.Entities.MetersArrangement MetersArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
|
||||
@@ -46,19 +46,31 @@ namespace ResultsBrowser.Forms
|
||||
columnsComboBox3.Items.Add(item.Caption);
|
||||
}
|
||||
///
|
||||
rowsComboBox.Text = rowsComboBox.Items.Contains(Program.LocalSettings.RowItemCaption) ? Program.LocalSettings.RowItemCaption : string.Empty;
|
||||
rowsComboBox2.Text = rowsComboBox2.Items.Contains(Program.LocalSettings.RowItemCaption2) ? Program.LocalSettings.RowItemCaption2 : string.Empty;
|
||||
rowsComboBox3.Text = rowsComboBox3.Items.Contains(Program.LocalSettings.RowItemCaption3) ? Program.LocalSettings.RowItemCaption3 : string.Empty;
|
||||
columnsComboBox.Text = columnsComboBox.Items.Contains(Program.LocalSettings.ColumnItemCaption) ? Program.LocalSettings.ColumnItemCaption : string.Empty;
|
||||
columnsComboBox2.Text = columnsComboBox2.Items.Contains(Program.LocalSettings.ColumnItemCaption2) ? Program.LocalSettings.ColumnItemCaption2 : string.Empty;
|
||||
columnsComboBox3.Text = columnsComboBox3.Items.Contains(Program.LocalSettings.ColumnItemCaption3) ? Program.LocalSettings.ColumnItemCaption3 : string.Empty;
|
||||
rowsComboBox.Text = (!string.IsNullOrEmpty(Program.LocalSettings.RowItemCaption) && rowsComboBox.Items.Contains(Program.LocalSettings.RowItemCaption))
|
||||
? Program.LocalSettings.RowItemCaption
|
||||
: string.Empty;
|
||||
rowsComboBox2.Text = (!string.IsNullOrEmpty(Program.LocalSettings.RowItemCaption2) && rowsComboBox2.Items.Contains(Program.LocalSettings.RowItemCaption2))
|
||||
? Program.LocalSettings.RowItemCaption2
|
||||
: string.Empty;
|
||||
rowsComboBox3.Text = (!string.IsNullOrEmpty(Program.LocalSettings.RowItemCaption3) && rowsComboBox3.Items.Contains(Program.LocalSettings.RowItemCaption3))
|
||||
? Program.LocalSettings.RowItemCaption3
|
||||
: string.Empty;
|
||||
columnsComboBox.Text = (!string.IsNullOrEmpty(Program.LocalSettings.ColumnItemCaption) && columnsComboBox.Items.Contains(Program.LocalSettings.ColumnItemCaption))
|
||||
? Program.LocalSettings.ColumnItemCaption
|
||||
: string.Empty;
|
||||
columnsComboBox2.Text = (!string.IsNullOrEmpty(Program.LocalSettings.ColumnItemCaption2) && columnsComboBox2.Items.Contains(Program.LocalSettings.ColumnItemCaption2))
|
||||
? Program.LocalSettings.ColumnItemCaption2
|
||||
: string.Empty;
|
||||
columnsComboBox3.Text = (!string.IsNullOrEmpty(Program.LocalSettings.ColumnItemCaption3) && columnsComboBox3.Items.Contains(Program.LocalSettings.ColumnItemCaption3))
|
||||
? Program.LocalSettings.ColumnItemCaption3
|
||||
: string.Empty;
|
||||
|
||||
rowTestSpecTextBox.Text = RowTestSpecifier = Program.LocalSettings.RowTestSpecifier;
|
||||
rowTestSpecTextBox2.Text = RowTestSpecifier2 = Program.LocalSettings.RowTestSpecifier2;
|
||||
rowTestSpecTextBox3.Text = RowTestSpecifier3 = Program.LocalSettings.RowTestSpecifier3;
|
||||
columnTestSpecTextBox.Text = ColumnTestSpecifier = Program.LocalSettings.ColumnTestSpecifier;
|
||||
columnTestSpecTextBox2.Text = ColumnTestSpecifier2 = Program.LocalSettings.ColumnTestSpecifier2;
|
||||
columnTestSpecTextBox3.Text = ColumnTestSpecifier3 = Program.LocalSettings.ColumnTestSpecifier3;
|
||||
rowTestSpecTextBox.Text = RowTestSpecifier = string.IsNullOrEmpty(Program.LocalSettings.RowTestSpecifier) ? string.Empty : Program.LocalSettings.RowTestSpecifier;
|
||||
rowTestSpecTextBox2.Text = RowTestSpecifier2 = string.IsNullOrEmpty(Program.LocalSettings.RowTestSpecifier2) ? string.Empty : Program.LocalSettings.RowTestSpecifier2;
|
||||
rowTestSpecTextBox3.Text = RowTestSpecifier3 = string.IsNullOrEmpty(Program.LocalSettings.RowTestSpecifier3) ? string.Empty : Program.LocalSettings.RowTestSpecifier3;
|
||||
columnTestSpecTextBox.Text = ColumnTestSpecifier = string.IsNullOrEmpty(Program.LocalSettings.ColumnTestSpecifier) ? string.Empty : Program.LocalSettings.ColumnTestSpecifier;
|
||||
columnTestSpecTextBox2.Text = ColumnTestSpecifier2 = string.IsNullOrEmpty(Program.LocalSettings.ColumnTestSpecifier2) ? string.Empty : Program.LocalSettings.ColumnTestSpecifier2;
|
||||
columnTestSpecTextBox3.Text = ColumnTestSpecifier3 = string.IsNullOrEmpty(Program.LocalSettings.ColumnTestSpecifier3) ? string.Empty : Program.LocalSettings.ColumnTestSpecifier3;
|
||||
}
|
||||
|
||||
void Localize()
|
||||
|
||||
@@ -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.12.486.0")]
|
||||
[assembly: AssemblyFileVersion("2.12.486.0")]
|
||||
[assembly: AssemblyVersion("2.12.542.0")]
|
||||
[assembly: AssemblyFileVersion("2.12.542.0")]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -31,7 +31,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -238,6 +238,10 @@
|
||||
<Project>{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}</Project>
|
||||
<Name>Results</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Users\Users.csproj">
|
||||
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -25,6 +25,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dirichlet.Numerics", "Diric
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Users", "Users\Users.csproj", "{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserManagement", "UserManagement\UserManagement.csproj", "{B2CD81B3-AF09-4978-996C-02EDB5F819B7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{743DF7DB-C7B6-42EB-986D-0F485E5588E4} = {743DF7DB-C7B6-42EB-986D-0F485E5588E4}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -111,6 +116,16 @@ Global
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Debug|x86.Build.0 = Debug|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|x86.ActiveCfg = Release|x86
|
||||
{B2CD81B3-AF09-4978-996C-02EDB5F819B7}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -47,6 +47,23 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
StreamWriter logger; /// Logs specified by LU
|
||||
|
||||
|
||||
///
|
||||
/// Information extracted from VT_PRUEFPUNKT_SOLL_SD for a given watermeter by query:
|
||||
/// SELECT * FROM VT_PRUEFPUNKT_SOLL_SD WHERE ANBID=4 AND ID_WZTyp=x AND Rev_WZTyp=y
|
||||
///
|
||||
class TestInfo
|
||||
{
|
||||
public int PruefungsNr;
|
||||
public string QBezeichnung;
|
||||
public TestInfo(int p, string q) { PruefungsNr = p; QBezeichnung = q; }
|
||||
public override string ToString() { return string.Format("({0},{1})", PruefungsNr, QBezeichnung); }
|
||||
}
|
||||
///
|
||||
static int id_WZTyp;
|
||||
static int rev_WZTyp;
|
||||
static IList<TestInfo> testInfos = new List<TestInfo>();
|
||||
|
||||
|
||||
public Database() {}
|
||||
|
||||
public Database(Generic.IComponentCfg cfg)
|
||||
@@ -69,24 +86,39 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
connection = (DBCfg.DBUsed == DBUsed.Production)
|
||||
? new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;")
|
||||
: new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
switch (DBCfg.DBUsed)
|
||||
{
|
||||
case DBUsed.Production:
|
||||
connection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
break;
|
||||
case DBUsed.Quality:
|
||||
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;"); /// TODO: Quality database specification
|
||||
break;
|
||||
case DBUsed.Test:
|
||||
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
break;
|
||||
default:
|
||||
connection = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (DBCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
///
|
||||
/// Do something with the database to see if the connection works well
|
||||
///
|
||||
connection.Open();
|
||||
if (connection != null)
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
string rslt = "none";
|
||||
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
if (dr.Read()) rslt = dr.GetString(0);
|
||||
dr.Close();
|
||||
string rslt = "none";
|
||||
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
if (dr.Read()) rslt = dr.GetString(0);
|
||||
dr.Close();
|
||||
|
||||
connection.Close();
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceBefore() {}
|
||||
@@ -215,13 +247,13 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
|
||||
bool anyError = false;
|
||||
#if ORACLE_DB
|
||||
if (DBCfg.DebugLevel != DebugMode.Simulate)
|
||||
if (DBCfg.DebugLevel != DebugMode.Simulate && connection != null)
|
||||
{
|
||||
if (WriteResultsToDatabase(connection, batch, false) == Retv.Error) anyError = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
WriteLogsToDisk(logger, batch);
|
||||
WriteLogsToDisk(logger, batch);
|
||||
|
||||
if (anyError)
|
||||
{
|
||||
@@ -501,8 +533,8 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
logger.WriteLine(string.Format("JustierWert=0,2")); /// 0,2
|
||||
logger.WriteLine(string.Format("Corrected2Hz={0}", wMtr.Hz2CorrectionDone ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Q2Corrected={0}", wMtr.Q2CorrectionDone ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Q2CorrectionRight={0}", (int)Math.Round(wMtr.Q2Correction / 2)));
|
||||
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", (int)Math.Round(wMtr.Q2Correction)));
|
||||
logger.WriteLine(string.Format("Q2CorrectionRight={0}", wMtr.Q2CorrRFlow));
|
||||
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", wMtr.Q2CorrLFlow));
|
||||
logger.WriteLine(string.Format("Q2CorrectionFlowRight={0}", wMtr.Q2CorrFlowRight));
|
||||
logger.WriteLine(string.Format("FlowDirectionRight={0}", wMtr.Q2CorrFlowRight));
|
||||
logger.WriteLine(string.Format("Position={0}", wMtr.WMPosition));
|
||||
@@ -887,12 +919,40 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
|
||||
cmd.ExecuteNonQuery(); /// Returns nr. of updated rows
|
||||
|
||||
|
||||
for (int q = 1; q <= 3; q++)
|
||||
if ((id_WZTyp != b.WaterMeters[0].WaterMeterData.WMTypeId) || (rev_WZTyp != b.WaterMeters[0].WaterMeterData.WMTypeRev) || testInfos.Count == 0)
|
||||
{
|
||||
Results.Entities.TestRslt tr = b.GetTestRslt(string.Format("Q{0}", q), 0);
|
||||
testInfos.Clear();
|
||||
id_WZTyp = b.WaterMeters[0].WaterMeterData.WMTypeId;
|
||||
rev_WZTyp = b.WaterMeters[0].WaterMeterData.WMTypeRev;
|
||||
|
||||
if (tr == null) tr = b.GetTestRslt(string.Format("Q{0}", q), 1); /// TODO: Remove this workaround for large large watermeters with multiple parts at Q3
|
||||
OracleCommand cmd1 = new OracleCommand("SELECT PruefungsNr, PosFehlerKalt, QBezeichnung FROM VT_PRUEFPUNKT_SOLL_SD WHERE ANBID=4 AND ID_WZTyp=:1 AND Rev_WZTyp=:2", conn);
|
||||
parm = new OracleParameter("ID_WZTyp", OracleDbType.Int32); parm.Value = id_WZTyp; cmd1.Parameters.Add(parm); ///:1
|
||||
parm = new OracleParameter("Rev_WZTyp", OracleDbType.Int32); parm.Value = rev_WZTyp; cmd1.Parameters.Add(parm); ///:2
|
||||
|
||||
OracleDataReader dr = cmd1.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int pruefungsNr = dr.GetInt32(0);
|
||||
double errLimHi = dr.GetDouble(1);
|
||||
string qBezeichnung = dr.GetString(2);
|
||||
if (qBezeichnung == "Q2" && errLimHi > 2.0) qBezeichnung = "Q2adj";
|
||||
if (qBezeichnung.ToLower().Contains("just") && pruefungsNr == -1) qBezeichnung = "Adjustment";
|
||||
|
||||
if (qBezeichnung.Contains("Q") || qBezeichnung == "Adjustment")
|
||||
{
|
||||
testInfos.Add(new TestInfo(pruefungsNr, qBezeichnung));
|
||||
log.WarnFormat("VT_PRUEFPUNKT_SOLL_SD info : ID_WZTyp={0} Rev_WZTyp={1} PruefungsNr={2} PosFehlerKalt={3} QBezeichnung={4}",
|
||||
id_WZTyp, rev_WZTyp, pruefungsNr, errLimHi, qBezeichnung);
|
||||
}
|
||||
}
|
||||
dr.Close();
|
||||
}
|
||||
|
||||
foreach (var testInfo in testInfos)
|
||||
{
|
||||
Results.Entities.TestRslt tr = b.GetTestRslt(testInfo.QBezeichnung, 0);
|
||||
|
||||
if (tr == null) tr = b.GetTestRslt(testInfo.QBezeichnung, 1); /// TODO: Remove this workaround for large watermeters with multiple parts at Q3
|
||||
|
||||
if (tr == null) continue;
|
||||
|
||||
@@ -908,7 +968,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd2.Parameters.Add(parm); ///:1
|
||||
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = 18000 + b.TestBenchId; cmd2.Parameters.Add(parm); ///:2
|
||||
parm = new OracleParameter("ID_WzPruefreihe", OracleDbType.Int32); parm.Value = b.BatchNr; cmd2.Parameters.Add(parm); ///:3
|
||||
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = ((q==0) ? -1 : q); cmd2.Parameters.Add(parm); ///:4
|
||||
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = testInfo.PruefungsNr; cmd2.Parameters.Add(parm); ///:4
|
||||
///
|
||||
parm = new OracleParameter("PVOL", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.l, tr.VolumeCTV); cmd2.Parameters.Add(parm); ///:5
|
||||
parm = new OracleParameter("PMasse", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassEnd-tr.MassStart); cmd2.Parameters.Add(parm); ///:6
|
||||
@@ -1012,10 +1072,17 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
log.InfoFormat("VT_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pos={1}, pruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex % 100);
|
||||
}
|
||||
|
||||
for (int q = 1; q <= 3; q++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mtr = wm.GetMeterTestRslt(string.Format("Q{0}", q));
|
||||
SaveMeterTestResult(conn, mtr, q, max_Pruefindex);
|
||||
|
||||
|
||||
foreach (var testInfo in testInfos)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mtr = wm.GetMeterTestRslt(testInfo.QBezeichnung);
|
||||
if (mtr == null)
|
||||
{
|
||||
throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.QBezeichnung, wm.WMPosition));
|
||||
}
|
||||
|
||||
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNr, max_Pruefindex);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1035,8 +1102,8 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
parm = new OracleParameter("WITHQ2CORRECTION", OracleDbType.Int32); parm.Value = wm.Q2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:7
|
||||
parm = new OracleParameter("ERRQ2", OracleDbType.Double); parm.Value = q2ErrWOCorrection; cmd.Parameters.Add(parm); ///:8
|
||||
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32);parm.Value = wm.Q2CorrFlowRight;/*1=right to left*/ cmd.Parameters.Add(parm); ///:9
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = (int)Math.Round(wm.Q2Correction); cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = (int)Math.Round(wm.Q2Correction / 2); cmd.Parameters.Add(parm); ///:11
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrLFlow; cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrRFlow; cmd.Parameters.Add(parm); ///:11
|
||||
|
||||
int rowsUpdated = cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_IP_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pruefix={1}", wm.SerialNr, max_Pruefindex);
|
||||
@@ -1049,11 +1116,10 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
/// </summary>
|
||||
/// <param name="q">q = 0, 1, 2 or 3 (Adj., Q1, Q2, Q3)</param>
|
||||
/// <returns>Nr. of rows updated</returns>
|
||||
static int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int q, int max_Pruefindex) ///
|
||||
static int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int qq, int max_Pruefindex) ///
|
||||
{
|
||||
double Q_wm = 3600.0 * mtr.VolumeMeter / mtr.TestTime; /// in [l/hour]
|
||||
double Q_wm_with_upper_bound = Math.Min(2 * 1000 * mtr.TestRslt.FlowVolume, Math.Max(0.0, Q_wm));
|
||||
int qq = (q == 0) ? -1 : q;
|
||||
|
||||
OracleCommand cmd = new OracleCommand("INSERT INTO VT_PRUEFREIHE_IST_PD(" +
|
||||
"VT_Fernum, Pruefindex, PruefungsNr, ANBID, ID_WZTyp, Rev_WZTyp, Rev_WZPruefpunkt, " +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,6 +11,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
{
|
||||
public enum DBUsed
|
||||
{
|
||||
None,
|
||||
Production,
|
||||
Test,
|
||||
Quality,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -40,6 +40,8 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
completed = false;
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
Height = 147 + WaterMetersCount * 90;
|
||||
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@@ -76,10 +76,10 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WaterMetersCount >= 1) EndStateText[0] = textBox1.Text;
|
||||
if (WaterMetersCount >= 2) EndStateText[1] = textBox3.Text;
|
||||
if (WaterMetersCount >= 3) EndStateText[2] = textBox4.Text;
|
||||
if (WaterMetersCount >= 4) EndStateText[3] = textBox5.Text;
|
||||
if (WaterMetersCount >= 5) EndStateText[4] = textBox6.Text;
|
||||
if (WaterMetersCount >= 2) EndStateText[1] = textBox2.Text;
|
||||
if (WaterMetersCount >= 3) EndStateText[2] = textBox3.Text;
|
||||
if (WaterMetersCount >= 4) EndStateText[3] = textBox4.Text;
|
||||
if (WaterMetersCount >= 5) EndStateText[4] = textBox5.Text;
|
||||
if (WaterMetersCount >= 6) EndStateText[5] = textBox6.Text;
|
||||
|
||||
completed = true;
|
||||
|
||||
@@ -124,25 +124,25 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
///
|
||||
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
|
||||
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters.Length);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(Config.Data.WMsCount);
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, disabled);
|
||||
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(Config.Data.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
myRef.modelessDlg = new TestStartEndForm(myRef.waterMeters.Length, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -242,8 +242,10 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
wm.CalibFactor = iPerl.CalibrationFactor;
|
||||
wm.Q2ErrWOCorrection = iPerl.Q2ErrorWOCorrection;
|
||||
wm.Q2CorrectionDone = iPerl.Q2CorrectionDone;
|
||||
wm.Q2Correction = iPerl.Q2CorrectionFactor;
|
||||
wm.Diff2Hz8Hz = iPerl.Diff2Hz8Hz;
|
||||
wm.Q2Correction = iPerl.Q2Correction;
|
||||
wm.Q2CorrRFlow = iPerl.Q2CorrRFlow;
|
||||
wm.Q2CorrLFlow = iPerl.Q2CorrLFlow;
|
||||
wm.Diff2Hz8Hz = iPerl.Diff2Hz8Hz;
|
||||
wm.Hz2CorrectionDone = iPerl.Hz2CorrectionDone;
|
||||
wm.Hz2Correction = iPerl.Hz2CorrectionFactor;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,7 +8,7 @@ using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.Balance
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.IBalance, IOperation
|
||||
public class Component : ComponentBase, GenericDevices.IScale, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
@@ -26,8 +26,9 @@ namespace TBF.BenchControl.Dummy.Balance
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public int BalanceNr { get { return 0; } }
|
||||
public int ScaleNr { get { return 0; } }
|
||||
public double Capacity { get { return 10000.0; } }
|
||||
public GenericDevices.IValve DrainValve { get { return null; } }
|
||||
public bool IsEmpty(double mass) { return true; }
|
||||
public bool IsEmpty() { return true; }
|
||||
public string Format { get { return "F3"; } }
|
||||
@@ -48,7 +49,7 @@ namespace TBF.BenchControl.Dummy.Balance
|
||||
return this;
|
||||
}
|
||||
|
||||
public IOperation ReadStableMassOp(ref TBF.Boxes.DoubleBox mass, int readingsCount, double maxSpread, bool method)
|
||||
public IOperation ReadStableMassOp(ref TBF.Boxes.DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
|
||||
{
|
||||
mass.Val = 0;
|
||||
return this;
|
||||
|
||||
@@ -510,7 +510,7 @@ ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent,
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation SetValvesOp(IValve valveOpen, IValve valveClose)
|
||||
{
|
||||
return new Valve.SetValvesOp(this, valveOpen, valveClose);
|
||||
return new SetValvesOp(this, valveOpen, valveClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -522,7 +522,7 @@ ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent,
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation SetValvesOp(IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
||||
{
|
||||
return new Valve.SetValvesOp(this, valvesOpen, valvesClose);
|
||||
return new SetValvesOp(this, valvesOpen, valvesClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -53,10 +53,11 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, StabTm={5}ms, FlowStable={6}s, PosReuse={7}, ReTryCmds={8}",
|
||||
return string.Format("Name={0} ({1}), Idx1={2}, Cat.={3}, ADC-Closed={4}, ADC-Open={5}, StabTm={6}ms, FlowStable={7}s, PosReuse={8}, ReTryCmds={9}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx1,
|
||||
Category,
|
||||
AdcValueClosed,
|
||||
AdcValueOpen,
|
||||
StableTimeMs,
|
||||
|
||||
+18
-18
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,7 +7,7 @@ using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using Dirichlet.Numerics;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Valve
|
||||
namespace TBF.BenchControl.Elde
|
||||
{
|
||||
public class SetValvesOp : IOperation
|
||||
{
|
||||
@@ -21,8 +21,8 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
public int TimeSec; /// Relative time in [s] from the start of the operation
|
||||
public IList<IValve> VOpen; /// List of valves to open in this point of time
|
||||
public IList<IValve> VClose; /// List of valves to close in this point of time
|
||||
public UInt128 MasksOpen; /// OR-ed bitmasks of valves to open in this point of time
|
||||
public UInt128 MasksClose; /// OR-ed bitmasks of valves to close in this point of time
|
||||
public UInt128 MasksOpen; /// OR-ed bitmasks of valves to open in this point of time
|
||||
public UInt128 MasksClose; /// OR-ed bitmasks of valves to close in this point of time
|
||||
|
||||
public SwitchPoint(int time, IList<IValve> vOpen, IList<IValve> vClose)
|
||||
{
|
||||
@@ -42,9 +42,9 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
foreach (var vlv in VOpen)
|
||||
{
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve && ((vlv as Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is PumpWithFM.Pump && ((vlv as PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is PumpWithFM.Pump && ((vlv as PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
@@ -52,9 +52,9 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
foreach (var vlv in VClose)
|
||||
{
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve && ((vlv as Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is PumpWithFM.Pump && ((vlv as PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is PumpWithFM.Pump && ((vlv as PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
@@ -152,20 +152,20 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
point.MasksOpen = 0;
|
||||
foreach (var valve in point.VOpen)
|
||||
{
|
||||
if (valve is Valve) point.MasksOpen |= (valve as Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksOpen |= (valve as Pump.Pump).Mask;
|
||||
if (valve is PumpWithFM.Pump) point.MasksOpen |= (valve as PumpWithFM.Pump).Mask;
|
||||
if (valve is Valve.Valve) point.MasksOpen |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksOpen |= (valve as Pump.Pump).Mask;
|
||||
if (valve is PumpWithFM.Pump) point.MasksOpen |= (valve as PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksOpen |= (valve as PumpTandem.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksOpen |= (valve as PumpTandem.Pump).Mask;
|
||||
}
|
||||
point.MasksClose = 0;
|
||||
foreach (var valve in point.VClose)
|
||||
{
|
||||
if (valve is Valve) point.MasksClose |= (valve as Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksClose |= (valve as Pump.Pump).Mask;
|
||||
if (valve is PumpWithFM.Pump) point.MasksClose |= (valve as PumpWithFM.Pump).Mask;
|
||||
if (valve is Valve.Valve) point.MasksClose |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksClose |= (valve as Pump.Pump).Mask;
|
||||
if (valve is PumpWithFM.Pump) point.MasksClose |= (valve as PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
|
||||
}
|
||||
point.TimeSec += timeShift;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}, Inv.={3}, Delay={4}s, Cat.={5}, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
|
||||
return string.Format("Name={0} ({1}), Bit={2}, Cat.={5}, Inv.={3}, Delay={4}s, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
|
||||
Name,
|
||||
string.IsNullOrEmpty(ParentName) ? "-" : ParentName,
|
||||
BitPosition,
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace TBF.BenchControl
|
||||
TurnPumpOnOffDone,
|
||||
|
||||
/// CheckUi events
|
||||
UiCmdReloadBatch,
|
||||
UiCmdStartTest,
|
||||
UiCmdStartQ1,
|
||||
UiCmdStartQ2,
|
||||
@@ -123,16 +124,17 @@ namespace TBF.BenchControl
|
||||
UiCmdStop,
|
||||
UiCmdPurgeBegin,
|
||||
UiCmdPurgeEnd,
|
||||
UiCmdEmptyTank1,
|
||||
UiCmdEmptyTank2,
|
||||
UiCmdEmptyTank3,
|
||||
UiCmdDrainTank1,
|
||||
UiCmdDrainTank2,
|
||||
UiCmdDrainTank3,
|
||||
UiCmdBreak,
|
||||
UiCmdResetResults,
|
||||
UiCmdAcceptResults,
|
||||
UiCmdCalibration,
|
||||
UiCmdCameraTest,
|
||||
UiCmdSensitivityTest,
|
||||
UiCmdB1,
|
||||
UiCmdCustom,
|
||||
UiCmdB1,
|
||||
UiCmdB2,
|
||||
UiCmdB3,
|
||||
|
||||
@@ -169,6 +171,8 @@ namespace TBF.BenchControl
|
||||
No,
|
||||
Next, /// To move to the next state when debugging
|
||||
OK,
|
||||
Retry,
|
||||
Abort,
|
||||
TimerBusy,
|
||||
SetOutputsDone,
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ICamera : Generic.IComponent
|
||||
{
|
||||
void ClearRois();
|
||||
void ClearRoiParams();
|
||||
|
||||
int RegisterRoi(string roiParams); /// returns 0=NOK or handle (=index)
|
||||
|
||||
int GetResult(int roiHandle); /// returns result for a registered ROI
|
||||
int GetResult(int roiHandle, out long timeMs); /// returns result for a registered ROI and camera time in ms
|
||||
|
||||
/// <summary>
|
||||
/// Display live image.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ICameraDisplay : Generic.IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Display static images.
|
||||
/// </summary>
|
||||
/// <returns>Reference to operation object instance</returns>
|
||||
IOperation ShowStaticImageOp(string[] imageFileNames, string title);
|
||||
|
||||
/// <summary>
|
||||
/// Display static images.
|
||||
/// </summary>
|
||||
/// <returns>Reference to operation object instance</returns>
|
||||
IOperation ShowLiveStreamOp(string[] imageFileNames, string title);
|
||||
|
||||
|
||||
bool[] SelectedImages { get; }
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,18 @@ namespace TBF.BenchControl.GenericDevices
|
||||
public interface IRoi : IComponent, IRegisterReader
|
||||
{
|
||||
GenericDevices.ICamera Camera { get; }
|
||||
bool Detected { get; }
|
||||
string DetectedImageName { get; }
|
||||
|
||||
bool Detected { get; set; }
|
||||
void ClearRoi();
|
||||
|
||||
void RegisterRoiToCamera();
|
||||
|
||||
double VolumeStart { get; } /// in l
|
||||
double VolumeEnd { get; } /// in l
|
||||
double TimestampStart { get; } /// in s
|
||||
double TimestampEnd { get; } /// in s
|
||||
|
||||
/// <summary>
|
||||
/// Watermeter wheel/arrow detection process.
|
||||
/// </summary>
|
||||
|
||||
+9
-4
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -10,18 +10,23 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <summary>
|
||||
/// Basic balance functions
|
||||
/// </summary>
|
||||
public interface IBalance : IComponent
|
||||
public interface IScale : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Balance number: 0-based index required for communication with the Elde component
|
||||
/// </summary>
|
||||
int BalanceNr { get; }
|
||||
int ScaleNr { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Balance water tank capacity in kg or ltr
|
||||
/// </summary>
|
||||
double Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Water tank drain valve or 'null'
|
||||
/// </summary>
|
||||
IValve DrainValve { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank s empty, mass is less then some threshold
|
||||
/// </summary>
|
||||
@@ -73,6 +78,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
/// <returns>ReadMassAverageOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadStableMassOp(ref DoubleBox mass, int readingsCount, double maxSpread, bool method);
|
||||
IOperation ReadStableMassOp(ref DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IBalance2 : IBalance, IComponent
|
||||
public interface IScale2 : IScale, IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Events: Done, Error
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IBalanceCfg : IComponentCfg
|
||||
public interface IScaleCfg : IComponentCfg
|
||||
{
|
||||
///
|
||||
/// Parameters displayed in Metrology tab page
|
||||
@@ -8,7 +8,9 @@ using System.Text;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ITankDraining
|
||||
public interface ITankDraining : ISequenceCondition
|
||||
{
|
||||
IValve DrainValve { get; }
|
||||
bool IsEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (multimeterCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
if (serialPort == null) return;
|
||||
|
||||
receivedData.Append(serialPort.ReadExisting());
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (multimeterCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
if (serialPort == null) return;
|
||||
|
||||
switch (scanState)
|
||||
{
|
||||
@@ -297,7 +297,11 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
|
||||
{
|
||||
if (multimeterCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
serialPort.Close();
|
||||
if (serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
{
|
||||
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg
|
||||
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// <note>
|
||||
/// Implemented and tested on 15.10.2013 by Milan Hanajik
|
||||
/// </note>
|
||||
public class BalanceDev : ComponentBase, IDevice, GenericDevices.IBalance
|
||||
public class BalanceDev : TankDraining, IDevice, GenericDevices.IScale
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
|
||||
@@ -48,7 +48,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
protected static SerialPort serialPort;
|
||||
protected static StringBuilder stringBuilder;
|
||||
|
||||
public int BalanceNr { get { return balanceNr; } }
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public int IdNr { get { return balanceCfg.IdNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public double Resolution { get { return balanceCfg.Resolution; } }
|
||||
@@ -276,7 +276,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (balanceCfg.IdNr == 1 && serialPort != null)
|
||||
if ((balanceCfg.DebugLevel != DebugMode.Simulate) && (balanceCfg.IdNr == 1) && (serialPort != null))
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
@@ -311,7 +311,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
/// <returns>ReadMassAverageOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadStableMassOp(ref DoubleBox mass, int readingsCount, double maxSpread, bool method)
|
||||
public IOperation ReadStableMassOp(ref DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
|
||||
{
|
||||
return new ReadStableMassOp(this, ref mass, readingsCount, maxSpread, method);
|
||||
}
|
||||
|
||||
@@ -16,19 +16,19 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
BalanceDev scale;
|
||||
DoubleBox result;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="requiredReadingsCount">Required mass readings count (>= 3)</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
public ReadMassOp(BalanceDev balanceDev, ref DoubleBox result)
|
||||
public ReadMassOp(BalanceDev scale, ref DoubleBox result)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
if (scale == null) throw new ArgumentNullException("scale");
|
||||
this.scale = scale;
|
||||
|
||||
this.result = result;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
public void Start()
|
||||
{
|
||||
done = false;
|
||||
started = BalanceDev.GetImmediateMassMeasurement(balanceDev.IdNr, balanceDev.Name);
|
||||
started = BalanceDev.GetImmediateMassMeasurement(scale.IdNr, scale.Name);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -52,22 +52,21 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
{
|
||||
if (!started)
|
||||
{
|
||||
started = BalanceDev.GetImmediateMassMeasurement(balanceDev.IdNr, balanceDev.Name);
|
||||
if (!done) return Event.Busy;
|
||||
else return Event.BalanceDone;
|
||||
started = BalanceDev.GetImmediateMassMeasurement(scale.IdNr, scale.Name);
|
||||
if (!done)
|
||||
return Event.Busy;
|
||||
else
|
||||
return Event.BalanceDone;
|
||||
}
|
||||
else if (started && balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
else if (started && scale.MsrmntState != MsrmntState.Busy)
|
||||
{
|
||||
result.Val = balanceDev.Mass;
|
||||
log.InfoFormat("ReadMassOp.Run() ... mass={0} ... returning Event.BalanceDone", balanceDev.Mass);
|
||||
if (scale.MsrmntState == MsrmntState.Valid) result.Val = scale.Mass;
|
||||
log.InfoFormat("ReadMassOp.Run() ... state={0}, mass={1} ... returning Event.BalanceDone",
|
||||
scale.MsrmntState, scale.Mass);
|
||||
done = true;
|
||||
started = false;
|
||||
return Event.BalanceDone; /// Mass read OK
|
||||
}
|
||||
else if (done)
|
||||
{
|
||||
return Event.BalanceDone; /// Mass has already been read (at least once)
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.Busy;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -22,8 +22,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
int totalReadingsCount;
|
||||
double maxSpread; /// Maximum spread of measurements in kg (otherwise the measurement continues)
|
||||
bool method; /// false = slow (precise), true = fast (immediate)
|
||||
double maxSpread; /// Maximum spread of measurements in kg (otherwise the measurement continues)
|
||||
Config.Entities.MassMethod method; /// false = slow (precise), true = fast (immediate)
|
||||
DoubleBox result;
|
||||
|
||||
bool started;
|
||||
@@ -36,24 +36,14 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// <param name="readingsCount">Required mass readings count (>= 3)</param>
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
public ReadStableMassOp(BalanceDev balanceDev, ref DoubleBox result, int readingsCount, double maxSpread, bool method)
|
||||
public ReadStableMassOp(BalanceDev balanceDev, ref DoubleBox result, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
|
||||
if (readingsCount == 0)
|
||||
this.totalReadingsCount = 5;
|
||||
else if (readingsCount < 3)
|
||||
this.totalReadingsCount = 3;
|
||||
else
|
||||
this.totalReadingsCount = readingsCount;
|
||||
|
||||
if (maxSpread == 0)
|
||||
this.maxSpread = balanceDev.Capacity / 20000;
|
||||
else
|
||||
this.maxSpread = maxSpread;
|
||||
|
||||
this.method = method;
|
||||
this.totalReadingsCount = (readingsCount < 4) ? 5 : readingsCount; /// readingsCount is at least 4
|
||||
this.maxSpread = (maxSpread == 0) ? (balanceDev.Capacity / 20000.0) : maxSpread;
|
||||
this.method = method;
|
||||
|
||||
this.result = result;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
{
|
||||
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg
|
||||
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg
|
||||
{
|
||||
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <note>
|
||||
/// Implemented and tested on 15.10.2013 by Milan Hanajik
|
||||
/// </note>
|
||||
public class BalanceDev : TankDraining, IDevice, GenericDevices.IBalance
|
||||
public class BalanceDev : TankDraining, IDevice, GenericDevices.IScale
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
|
||||
@@ -47,7 +47,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
protected SerialPort serialPort;
|
||||
protected StringBuilder stringBuilder;
|
||||
|
||||
public int BalanceNr { get { return balanceNr; } }
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
|
||||
@@ -102,6 +102,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
base.Initalize();
|
||||
|
||||
msrmntState = MsrmntState.Failed; /// Data not valid yet
|
||||
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
@@ -115,7 +117,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
public bool IsEmpty()
|
||||
public override bool IsEmpty()
|
||||
{
|
||||
return (this.mass <= balanceCfg.Empty);
|
||||
}
|
||||
@@ -242,6 +244,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
public virtual void RunDeviceBefore()
|
||||
{
|
||||
base.RunBefore();
|
||||
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
Masses[balanceNr] = TestBenchSim.GetSimMass(balanceNr);
|
||||
@@ -442,19 +446,17 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
}
|
||||
base.RunAfter();
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
try
|
||||
if ((balanceCfg.DebugLevel != DebugMode.Simulate) && (serialPort != null))
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -485,7 +487,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
/// <returns>ReadMassAverageOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadStableMassOp(ref DoubleBox mass, int readingsCount, double maxSpread, bool method)
|
||||
public IOperation ReadStableMassOp(ref DoubleBox mass, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
|
||||
{
|
||||
return new ReadStableMassOp(this, ref mass, readingsCount, maxSpread, method);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Author: Milan Hanajik
|
||||
///
|
||||
using System;
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <note>
|
||||
/// Implemented and tested on 15.10.2013 by Milan Hanajik
|
||||
/// </note>
|
||||
public class BalanceNewDev : BalanceDev, IDevice, GenericDevices.IBalance2
|
||||
public class BalanceNewDev : BalanceDev, IDevice, GenericDevices.IScale2
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
|
||||
@@ -67,6 +67,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
public override void RunDeviceBefore()
|
||||
{
|
||||
base.RunBefore();
|
||||
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
mass = TestBenchSim.GetSimMass(balanceNr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <note>
|
||||
/// Implemented and tested on 15.10.2013 by Milan Hanajik
|
||||
/// </note>
|
||||
public class BalanceOld : BalanceDev, IDevice, GenericDevices.IBalance
|
||||
public class BalanceOld : BalanceDev, IDevice, GenericDevices.IScale
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
|
||||
@@ -61,6 +61,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </summary>
|
||||
public override void RunDeviceBefore()
|
||||
{
|
||||
base.RunBefore();
|
||||
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
mass = TestBenchSim.GetSimMass(balanceNr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -12,22 +12,23 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadMassOp));
|
||||
public override string ToString() { return string.Format("ReadMassOp(.,.)"); }
|
||||
|
||||
bool started;
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
BalanceDev scale;
|
||||
DoubleBox result;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="requiredReadingsCount">Required mass readings count (>= 3)</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
public ReadMassOp(BalanceDev balanceDev, ref DoubleBox result)
|
||||
public ReadMassOp(BalanceDev scale, ref DoubleBox result)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
|
||||
this.result = result;
|
||||
|
||||
@@ -37,8 +38,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
scale.GetImmediateMassMeasurement();
|
||||
started = true;
|
||||
done = false;
|
||||
balanceDev.GetImmediateMassMeasurement();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -49,22 +51,26 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
result.Val = balanceDev.Mass;
|
||||
done = true;
|
||||
log.InfoFormat("ReadMassOp.Run() ... mass={0} ... returning Event.BalanceDone", balanceDev.Mass);
|
||||
balanceDev.GetImmediateMassMeasurement(); /// Start another measurement
|
||||
return Event.BalanceDone; /// Mass read OK
|
||||
}
|
||||
else if (done)
|
||||
{
|
||||
return Event.BalanceDone; /// Mass has already been read (at least once)
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.None;
|
||||
}
|
||||
if (!started)
|
||||
{
|
||||
scale.GetImmediateMassMeasurement();
|
||||
started = true;
|
||||
done = false;
|
||||
return Event.Busy;
|
||||
}
|
||||
else if (started && scale.MsrmntState != MsrmntState.Busy)
|
||||
{
|
||||
if (scale.MsrmntState == MsrmntState.Valid) result.Val = scale.Mass;
|
||||
log.InfoFormat("ReadMassOp.Run() ... state={0}, mass={1} ... returning Event.BalanceDone",
|
||||
scale.MsrmntState, scale.Mass);
|
||||
done = true;
|
||||
started = false;
|
||||
return Event.BalanceDone; /// Mass read OK
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.Busy;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -15,46 +15,42 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadStableMassOp));
|
||||
public override string ToString() { return string.Format("ReadStableMassOp(.,{0},.)", totalReadingsCount); }
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
int totalReadingsCount;
|
||||
double maxSpread; /// Maximum spread of measurements in kg (otherwise the measurement continues)
|
||||
Config.Entities.MassMethod method; /// by the scale, mass spread threshold or mass standard deviation threshold
|
||||
DoubleBox result;
|
||||
|
||||
/// Operation specific
|
||||
double[] massReadings;
|
||||
int currentReadingsCount;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
int totalReadingsCount;
|
||||
double maxSpread; /// Maximum spread of measurements in kg (otherwise the measurement continues)
|
||||
bool method; /// false = slow (precise), true = fast (immediate)
|
||||
DoubleBox result;
|
||||
bool measurementCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
/// <param name="readingsCount">Required mass readings count (>= 3)</param>
|
||||
/// <param name="readingsCount">Required mass readings count (>= 4)</param>
|
||||
/// <param name="maxSpread">Maximum spread of measurements in kg (otherwise the measurement continues)</param>
|
||||
/// <param name="method">Method: false = slow (precise), true = fast (immediate)</param>
|
||||
public ReadStableMassOp(BalanceDev balanceDev, ref DoubleBox result, int readingsCount, double maxSpread, bool method)
|
||||
public ReadStableMassOp(BalanceDev balanceDev, ref DoubleBox result, int readingsCount, double maxSpread, Config.Entities.MassMethod method)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
|
||||
if (readingsCount == 0)
|
||||
this.totalReadingsCount = 5;
|
||||
else if (readingsCount < 3)
|
||||
this.totalReadingsCount = 3;
|
||||
else
|
||||
this.totalReadingsCount = readingsCount;
|
||||
|
||||
if (maxSpread == 0)
|
||||
this.maxSpread = balanceDev.Capacity / 20000;
|
||||
else
|
||||
this.maxSpread = maxSpread;
|
||||
|
||||
this.method = method;
|
||||
this.totalReadingsCount = (readingsCount < 4) ? 5 : readingsCount; /// readingsCount is at least 4
|
||||
this.maxSpread = (maxSpread == 0) ? (balanceDev.Capacity / 20000.0) : maxSpread;
|
||||
this.method = method;
|
||||
|
||||
this.result = result;
|
||||
|
||||
massReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
@@ -62,12 +58,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
public void Start()
|
||||
{
|
||||
currentReadingsCount = 0;
|
||||
massReadings = new double[totalReadingsCount];
|
||||
measurementCompleted = false;
|
||||
|
||||
if (method)
|
||||
balanceDev.GetImmediateMassMeasurement();
|
||||
else
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
balanceDev.GetStableMassMeasurement();
|
||||
else
|
||||
balanceDev.GetImmediateMassMeasurement();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -78,68 +74,103 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (currentReadingsCount >= totalReadingsCount) return Event.BalanceDone; /// Mass has already been calculated
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Busy) return Event.None;
|
||||
if (measurementCompleted) return Event.BalanceDone;
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
return Event.None; /// Wait for a mass measurement
|
||||
}
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
massReadings[currentReadingsCount++] = balanceDev.Mass;
|
||||
|
||||
if (currentReadingsCount == totalReadingsCount)
|
||||
/// Save the measurement
|
||||
if (currentReadingsCount < totalReadingsCount)
|
||||
{
|
||||
#if true /// OLD_WAY_OF_MASS_CALCULATION
|
||||
/// Exclude min. and max. value, calculate average
|
||||
Array.Sort(massReadings);
|
||||
double calcMass = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++)
|
||||
{
|
||||
calcMass += massReadings[i];
|
||||
}
|
||||
calcMass = (calcMass / (totalReadingsCount - 2));
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", calcMass);
|
||||
result.Val = calcMass;
|
||||
return Event.BalanceDone; /// Mass has just been calculated
|
||||
#else
|
||||
double minimum = double.MaxValue;
|
||||
double maximum = double.MinValue;
|
||||
foreach (double val in massReadings)
|
||||
{
|
||||
if (val < minimum) minimum = val;
|
||||
if (val > maximum) maximum = val;
|
||||
}
|
||||
|
||||
if ((maximum - minimum) <= maxSpread)
|
||||
{
|
||||
double calcMass = 0;
|
||||
for (int i = 0; i < totalReadingsCount; i++)
|
||||
{
|
||||
calcMass += massReadings[i];
|
||||
}
|
||||
calcMass = (calcMass / totalReadingsCount);
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", calcMass);
|
||||
result.Val = calcMass;
|
||||
return Event.BalanceDone; /// Mass has just been calculated
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Shift data and decrement 'currentReadingsCount'
|
||||
for (int i = 0; i < totalReadingsCount - 1; i++)
|
||||
{
|
||||
massReadings[i] = massReadings[i + 1];
|
||||
}
|
||||
currentReadingsCount--;
|
||||
}
|
||||
#endif
|
||||
massReadings[currentReadingsCount++] = balanceDev.Mass;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Shift data in the (already full) buffer, save the mass into the last buffer item
|
||||
for (int i = 1; i < totalReadingsCount; i++)
|
||||
{
|
||||
massReadings[i - 1] = massReadings[i];
|
||||
}
|
||||
massReadings[totalReadingsCount - 1] = balanceDev.Mass;
|
||||
}
|
||||
}
|
||||
|
||||
if (method)
|
||||
balanceDev.GetImmediateMassMeasurement();
|
||||
else
|
||||
balanceDev.GetStableMassMeasurement();
|
||||
|
||||
return Event.None;
|
||||
if (currentReadingsCount >= totalReadingsCount)
|
||||
{
|
||||
Array.Sort(massReadings);
|
||||
|
||||
#if STABLE_MASS_EXTRAS
|
||||
if (method == Config.Entities.MassMethod.Spread)
|
||||
{
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
if ((massReadings[totalReadingsCount - 2] - massReadings[1]) <= maxSpread)
|
||||
{
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
result.Val = (massSum / (totalReadingsCount - 2));
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", result.Val);
|
||||
|
||||
measurementCompleted = true;
|
||||
return Event.BalanceDone; /// Mass has just been calculated
|
||||
}
|
||||
}
|
||||
else if (method == Config.Entities.MassMethod.StdDev)
|
||||
{
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
double ave = (massSum / (totalReadingsCount - 2));
|
||||
double sdev = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) sdev += ((massReadings[i] - ave) * (massReadings[i] - ave));
|
||||
|
||||
if (Math.Sqrt(sdev / (totalReadingsCount - 2)) <= maxSpread)
|
||||
{
|
||||
result.Val = ave;
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", result.Val);
|
||||
|
||||
measurementCompleted = true;
|
||||
return Event.BalanceDone; /// Mass has just been calculated
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/// Stable mass measurement
|
||||
|
||||
/// Sort, exclude min. and max. values, calculate the average
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
result.Val = (massSum / (totalReadingsCount - 2));
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", result.Val);
|
||||
|
||||
measurementCompleted = true;
|
||||
return Event.BalanceDone; /// Mass has just been calculated
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (measurementCompleted)
|
||||
{
|
||||
return Event.BalanceDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Start a new measurement
|
||||
///
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
balanceDev.GetStableMassMeasurement();
|
||||
else
|
||||
balanceDev.GetImmediateMassMeasurement();
|
||||
|
||||
return Event.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
|
||||
@@ -2,25 +2,155 @@
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
public class TankDraining : ComponentBase
|
||||
public enum DrainState
|
||||
{
|
||||
public GenericDevices.IValve DrainValve;
|
||||
None,
|
||||
OpeningDV_Start,
|
||||
OpeningDV_Run,
|
||||
OpeningDV_Stop,
|
||||
Draining,
|
||||
ClosingDV_Start,
|
||||
ClosingDV_Run,
|
||||
ClosingDV_Stop,
|
||||
TankClosed,
|
||||
}
|
||||
|
||||
public class TankDraining : ComponentBase, ITankDraining
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TankDraining));
|
||||
|
||||
|
||||
readonly GenericDevices.ITankDrainingCfg tankDrainingCfg;
|
||||
|
||||
private IValve drainValve;
|
||||
public GenericDevices.IValve DrainValve { get { return drainValve; } }
|
||||
|
||||
private IOperation openDrainValveOp;
|
||||
private IOperation closeDrainValveOp;
|
||||
|
||||
|
||||
DrainState drainState;
|
||||
|
||||
GenericDevices.ITankDrainingCfg tankManagementCfg;
|
||||
|
||||
public TankDraining()
|
||||
: base()
|
||||
{
|
||||
CreateConditions(false);
|
||||
}
|
||||
|
||||
public TankDraining(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
tankManagementCfg = cfg as GenericDevices.ITankDrainingCfg;
|
||||
if (tankManagementCfg == null) throw new Exception(string.Format("Cannot create component {0}", cfg.Name));
|
||||
tankDrainingCfg = cfg as GenericDevices.ITankDrainingCfg;
|
||||
if (tankDrainingCfg == null) throw new Exception(string.Format("Cannot create component {0}", cfg.Name));
|
||||
CreateConditions(true);
|
||||
}
|
||||
|
||||
protected void Initalize()
|
||||
{
|
||||
drainValve = TbfComponents.FindComponent(tankDrainingCfg.DrainValve) as IValve;
|
||||
openDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, drainValve, null);
|
||||
closeDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, null, drainValve);
|
||||
}
|
||||
|
||||
protected void RunBefore()
|
||||
{
|
||||
switch (drainState)
|
||||
{
|
||||
case DrainState.OpeningDV_Start:
|
||||
openDrainValveOp.Start();
|
||||
drainState = DrainState.OpeningDV_Run;
|
||||
return;
|
||||
|
||||
case DrainState.OpeningDV_Run:
|
||||
if (openDrainValveOp.Run() == Event.ValvesSet) drainState = DrainState.OpeningDV_Stop;
|
||||
return;
|
||||
|
||||
case DrainState.OpeningDV_Stop:
|
||||
openDrainValveOp.Stop();
|
||||
return;
|
||||
|
||||
case DrainState.Draining:
|
||||
if (IsEmpty()) drainState = DrainState.ClosingDV_Start;
|
||||
return;
|
||||
|
||||
case DrainState.ClosingDV_Start:
|
||||
closeDrainValveOp.Start();
|
||||
drainState = DrainState.ClosingDV_Run;
|
||||
return;
|
||||
|
||||
case DrainState.ClosingDV_Run:
|
||||
if (closeDrainValveOp.Run() == Event.ValvesSet) drainState = DrainState.ClosingDV_Stop;
|
||||
return;
|
||||
|
||||
case DrainState.ClosingDV_Stop:
|
||||
closeDrainValveOp.Stop();
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected void RunAfter() { } /// Not used
|
||||
|
||||
|
||||
public virtual string GetName() { return string.Empty; }
|
||||
public virtual bool IsEmpty() { return false; }
|
||||
|
||||
///
|
||||
/// ISequenceCondition interface implementation (conditions in transition sequences)
|
||||
///
|
||||
IList<string> sequenceConditionNames;
|
||||
IList<IOperation> sequenceConditions;
|
||||
|
||||
public int ConditionsCount { get { return sequenceConditions != null ? sequenceConditions.Count : 0; } }
|
||||
|
||||
/// Strings are added to the combo-box for transition sequence condition selection
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
if (sequenceConditionNames != null && i < sequenceConditionNames.Count && i >= 0)
|
||||
return sequenceConditionNames[i];
|
||||
else
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// Operations are executed as a part of a transition sequence
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
if (sequenceConditions != null && i < sequenceConditions.Count && i >= 0)
|
||||
return sequenceConditions[i];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
void ClearConditions()
|
||||
{
|
||||
sequenceConditionNames = new List<string>();
|
||||
sequenceConditions = new List<IOperation>();
|
||||
}
|
||||
|
||||
void AddCondition(string conditionName, bool createOperation, IOperation conditionOperation)
|
||||
{
|
||||
sequenceConditionNames.Add(conditionName);
|
||||
if (createOperation) sequenceConditions.Add(conditionOperation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a list of conditions
|
||||
/// </summary>
|
||||
/// <param name="createOps">true = create names and condition operations, false = create names only</param>
|
||||
void CreateConditions(bool createOps)
|
||||
{
|
||||
ClearConditions();
|
||||
AddCondition(string.Format(Strings.Wait_until_0_tank_is_empty, GetName()), createOps, new WaitTankEmptyOp(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
public class WaitTankEmptyOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaitTankEmptyOp));
|
||||
public override string ToString() { return string.Format("WaitTankEmptyOp()"); }
|
||||
|
||||
readonly GenericDevices.ITankDraining tankDraining;
|
||||
|
||||
bool conditionMet;
|
||||
|
||||
/// <summary>
|
||||
/// Events: ConditionMet, ConditionNotMet
|
||||
/// </summary>
|
||||
/// <param name="tankDraining">Tank draining (Balance device) instance</param>
|
||||
public WaitTankEmptyOp(GenericDevices.ITankDraining tankDraining)
|
||||
{
|
||||
this.tankDraining = tankDraining;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
conditionMet = tankDraining.IsEmpty();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.ConditionMet . . . tank is empty
|
||||
/// Event.ConditionNotMet . tank is not empty
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
conditionMet = conditionMet || tankDraining.IsEmpty();
|
||||
|
||||
return conditionMet ? Event.ConditionMet : Event.ConditionNotMet;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,26 +298,18 @@ namespace TBF.BenchControl.Modbus.TankSelector
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
if (sequenceConditionNames != null && i < sequenceConditionNames.Count && i >= 0)
|
||||
{
|
||||
return sequenceConditionNames[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// Operations are executed as a part of a transition sequence
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
if (sequenceConditions != null && i < sequenceConditions.Count && i >= 0)
|
||||
{
|
||||
return sequenceConditions[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void ClearConditions()
|
||||
|
||||
@@ -77,7 +77,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
Session wscpSession;
|
||||
bool wscpOpened;
|
||||
bool closeWscpThread;
|
||||
string wscpFileName;
|
||||
string wscpSrcFileName;
|
||||
string wscpDstFileName;
|
||||
enum WscpCommand
|
||||
{
|
||||
None,
|
||||
@@ -90,9 +91,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
/// ROI related parameters
|
||||
///
|
||||
IList<string> roiParams;
|
||||
long cameraTimeMs;
|
||||
int[] result;
|
||||
///
|
||||
public void ClearRois() { roiParams.Clear(); }
|
||||
public void ClearRoiParams() { roiParams.Clear(); }
|
||||
public int RegisterRoi(string rParams)
|
||||
{
|
||||
this.roiParams.Add(rParams);
|
||||
@@ -101,8 +103,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
return newHandle;
|
||||
}
|
||||
///
|
||||
public int GetResult(int roiHandle)
|
||||
public int GetResult(int roiHandle, out long timeMs)
|
||||
{
|
||||
timeMs = cameraTimeMs;
|
||||
|
||||
if (roiHandle > 0 && roiHandle <= roiParams.Count)
|
||||
{
|
||||
return result[roiHandle - 1];
|
||||
@@ -113,6 +117,18 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// UDP Port number for 'MeasurementOp'
|
||||
///
|
||||
const int UdpPortRangeStart = 13800;
|
||||
const int UdpPortRangeEnd = 13850;
|
||||
static int nextUdpPortNr = UdpPortRangeStart;
|
||||
public static int GetNextUdpPortNr() { return nextUdpPortNr++; }
|
||||
///
|
||||
readonly int measurementUdpPortNr;
|
||||
UdpClient measurementListener;
|
||||
|
||||
|
||||
public Camera() {}
|
||||
|
||||
public Camera(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
@@ -125,6 +141,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
Telnet = null;
|
||||
terminalDlg = null;
|
||||
|
||||
measurementUdpPortNr = GetNextUdpPortNr();
|
||||
|
||||
roiParams = new List<string>();
|
||||
|
||||
running = false;
|
||||
@@ -156,7 +174,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
if (cameraDetected)
|
||||
{
|
||||
/// Open telnet clint and start the log-in process
|
||||
Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, TelnetPrompt, TelnetSkipFirstLine);
|
||||
Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, TelnetPrompt, TelnetSkipFirstLine, CameraCfg.DisplayTerminal);
|
||||
|
||||
if (CameraCfg.DisplayTerminal)
|
||||
{
|
||||
@@ -179,6 +197,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
Telnet.Enqueue(new Telnet.Command(Network.Telnet.CmdAction.CONNECT, ipAddress.ToString(), 10, 30));
|
||||
|
||||
|
||||
//measurementListener = new UdpClient(measurementUdpPortNr);
|
||||
//new Thread(new ThreadStart(MeasurementUdpListener)).Start();
|
||||
|
||||
|
||||
wscpThread = new Thread(new ThreadStart(WscpWorker));
|
||||
wscpThread.Start();
|
||||
|
||||
@@ -213,10 +235,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (running)
|
||||
{
|
||||
Console.WriteLine("Time={0} IP={1} scp={2}", StateMachine.Time, IPAddress, wscpOpened ? "Opened" : "Closed");
|
||||
}
|
||||
// if (running)
|
||||
// {
|
||||
// Console.WriteLine("Time={0} IP={1} scp={2}", StateMachine.Time, IPAddress, wscpOpened ? "Opened" : "Closed");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -346,6 +368,11 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
wscpSession = new WinSCP.Session();
|
||||
wscpSession.Open(wscpSessionOptions);
|
||||
|
||||
TransferOptions transferOptions = new TransferOptions();
|
||||
transferOptions.TransferMode = TransferMode.Binary;
|
||||
|
||||
TransferOperationResult transferResult;
|
||||
|
||||
wscpOpened = wscpSession.Opened;
|
||||
|
||||
if (wscpOpened)
|
||||
@@ -356,7 +383,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
case WscpCommand.Get:
|
||||
wscpCommand = WscpCommand.None;
|
||||
wscpSession.GetFiles(wscpFileName, string.Format("c:\\TBF\\TftpRoot\\{0}-{1}", Name, wscpFileName));
|
||||
transferResult = wscpSession.GetFiles(wscpSrcFileName, wscpDstFileName, false, transferOptions);
|
||||
///transferResult.Check();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -372,15 +400,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
/// <summary>
|
||||
/// Transfer a file via SCP
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="srcFileName"></param>
|
||||
/// <returns>0 (success), -1 (busy), -2 (no session)</returns>
|
||||
|
||||
public int WscpTransferFile(string fileName)
|
||||
|
||||
public int WscpTransferFile(string srcFileName, string dstFileName)
|
||||
{
|
||||
if (!wscpOpened) return -2;
|
||||
if (wscpCommand != WscpCommand.None) return -1;
|
||||
|
||||
wscpFileName = fileName;
|
||||
wscpSrcFileName = srcFileName;
|
||||
wscpDstFileName = dstFileName;
|
||||
wscpCommand = WscpCommand.Get;
|
||||
return 0;
|
||||
}
|
||||
@@ -422,8 +451,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
/// Prepare the telent command
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var s in roiParams) sb.AppendFormat(" {0}", s);
|
||||
command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 1 0 0 0",
|
||||
ipAddress, 6378,
|
||||
command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 7 0 0 0",
|
||||
NetAdapter.IPAddress,
|
||||
measurementUdpPortNr,
|
||||
CameraCfg.UseTestImages ? (" -l " + CameraCfg.TestImagesCount.ToString()) : string.Empty,
|
||||
sb);
|
||||
|
||||
@@ -469,14 +499,69 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
string[] pulsesArr = msrmtData.MeasuredData.Split(new char[] { ';' });
|
||||
|
||||
if (result != null && result.Length + 1 == pulsesArr.Length)
|
||||
uint uiVal;
|
||||
if (result != null && result.Length + 1 == pulsesArr.Length && uint.TryParse(pulsesArr[0], out uiVal))
|
||||
{
|
||||
cameraTimeMs = (long)uiVal;
|
||||
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
{
|
||||
int val;
|
||||
if (int.TryParse(pulsesArr[i + 1], out val)) result[i] = Math.Abs(val);
|
||||
if (int.TryParse(pulsesArr[i + 1], out val))
|
||||
{
|
||||
result[i] = Math.Abs(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MeasurementUdpListener()
|
||||
{
|
||||
StringBuilder toBeProcessed = new StringBuilder();
|
||||
IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, measurementUdpPortNr);
|
||||
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
byte[] byteArray = measurementListener.Receive(ref ipEndPoint);
|
||||
toBeProcessed.Append(Encoding.ASCII.GetString(byteArray, 0, byteArray.Length));
|
||||
log.DebugFormat("MeasurementUdpListener() ... toBeProcessed = {0}", toBeProcessed);
|
||||
|
||||
while (true)
|
||||
{
|
||||
int from = toBeProcessed.ToString().IndexOf('[');
|
||||
if (from < 0) break;
|
||||
|
||||
int len = toBeProcessed.ToString(from + 1, toBeProcessed.Length - from - 1).IndexOf(']');
|
||||
if (len < 0) break;
|
||||
|
||||
string[] pulsesArr = toBeProcessed.ToString(from + 1, len).Split(new char[] { ';' });
|
||||
|
||||
uint uiVal;
|
||||
if (result != null && result.Length + 1 == pulsesArr.Length && uint.TryParse(pulsesArr[0], out uiVal))
|
||||
{
|
||||
// cameraTimeMs = (long)uiVal;
|
||||
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
{
|
||||
int val;
|
||||
if (int.TryParse(pulsesArr[i + 1], out val))
|
||||
{
|
||||
// result[i] = Math.Abs(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toBeProcessed.Remove(0, from + len + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
log.FatalFormat("Camera : MeasurementUdpListener() thread failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using TBF.BenchControl.Network.Telnet;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
public class MeasurementOp : IOperation
|
||||
{
|
||||
readonly CLP1611.Camera camera;
|
||||
readonly CLP1611.CameraCfg cameraCfg;
|
||||
readonly Telnet.TelnetClient telnet;
|
||||
|
||||
readonly string ipAddress;
|
||||
readonly int portNr;
|
||||
readonly IList<string> roiParams;
|
||||
|
||||
string command;
|
||||
bool measurementCommandSent;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Events: Event.None or Event.Error
|
||||
/// </summary>
|
||||
/// <param name="camera">CLP1611.Camera reference</param>
|
||||
public MeasurementOp(Camera camera, string ipAddress, int portNr, IList<string> roiParams)
|
||||
{
|
||||
this.camera = camera;
|
||||
this.cameraCfg = camera.CameraCfg;
|
||||
this.telnet = camera.Telnet;
|
||||
this.ipAddress = ipAddress;
|
||||
this.portNr = portNr;
|
||||
this.roiParams = roiParams;
|
||||
|
||||
measurementCommandSent = false;
|
||||
}
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
measurementCommandSent = false;
|
||||
}
|
||||
|
||||
public Event Run()
|
||||
{
|
||||
if (!measurementCommandSent)
|
||||
{
|
||||
if (telnet.State == TelnetClient.TelnetState.Inactive)
|
||||
{
|
||||
//
|
||||
// Prepare and send (=enqueue) command
|
||||
//
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var s in roiParams)
|
||||
{
|
||||
sb.Append(" ");
|
||||
sb.Append(s);
|
||||
}
|
||||
command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 1 0 0 0",
|
||||
ipAddress,
|
||||
portNr,
|
||||
cameraCfg.UseTestImages ? (" -l " + cameraCfg.TestImagesCount.ToString()) : string.Empty,
|
||||
sb);
|
||||
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_STRING, command));
|
||||
measurementCommandSent = true;
|
||||
}
|
||||
}
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (measurementCommandSent)
|
||||
{
|
||||
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_COMMAND, Telnet.TelnetClient.CtrlCCommand));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
public class Display : ComponentBase, IOperation, ICameraDisplay
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Display));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
|
||||
public readonly DisplayCfg DisplayCfg;
|
||||
///
|
||||
public Display()
|
||||
{
|
||||
}
|
||||
///
|
||||
public Display(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
DisplayCfg = cfg as DisplayCfg;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool[] SelectedImages { get { return selectedImages; } }
|
||||
bool[] selectedImages;
|
||||
|
||||
|
||||
|
||||
public enum CurrentOp
|
||||
{
|
||||
None,
|
||||
StaticImage,
|
||||
LiveStream,
|
||||
}
|
||||
CurrentOp currentOp;
|
||||
DialogResult result;
|
||||
|
||||
string title;
|
||||
string[] imageFileNames;
|
||||
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
///
|
||||
delegate void DisplayFormDlgt(Display myRef);
|
||||
///
|
||||
void OpenStaticImageDisplay(Display myRef)
|
||||
{
|
||||
myRef.modelessDlg = new DisplayForm(imageFileNames, title);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenLiveStreamDisplay(Display myRef)
|
||||
{
|
||||
myRef.modelessDlg = new DisplayForm(imageFileNames, title);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowStaticImageOp(string[] imageFileNames, string title)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
|
||||
this.imageFileNames = imageFileNames;
|
||||
this.title = title;
|
||||
currentOp = CurrentOp.StaticImage;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowLiveStreamOp(string[] imageFileNames, string title)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
|
||||
this.imageFileNames = imageFileNames;
|
||||
this.title = title;
|
||||
currentOp = CurrentOp.LiveStream;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
result = DialogResult.None;
|
||||
|
||||
switch (currentOp)
|
||||
{
|
||||
case CurrentOp.StaticImage:
|
||||
Program.MainWnd.Invoke(new DisplayFormDlgt(OpenStaticImageDisplay), this);
|
||||
break;
|
||||
|
||||
case CurrentOp.LiveStream:
|
||||
Program.MainWnd.Invoke(new DisplayFormDlgt(OpenLiveStreamDisplay), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.None</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
|
||||
{
|
||||
return Event.ModelessFormIsOpen;
|
||||
}
|
||||
|
||||
if ((result == DialogResult.None) && modelessDlg is DisplayForm)
|
||||
{
|
||||
/// Save the result (once)
|
||||
selectedImages = (modelessDlg as DisplayForm).SelectedImages;
|
||||
result = (modelessDlg as DisplayForm).Result;
|
||||
modelessDlg = null;
|
||||
}
|
||||
|
||||
if (result == DialogResult.OK) return Event.OK;
|
||||
else if (result == DialogResult.Retry) return Event.Retry;
|
||||
else if (result == DialogResult.Abort) return Event.Abort;
|
||||
else return Event.None; /// Should never happen
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (modelessDlg is IHasCompleted)
|
||||
{
|
||||
UiBridge.Bridge.OnCloseModelessForm(this, null);
|
||||
modelessDlg = null;
|
||||
}
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
public class DisplayCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
public IComponentCfgCtrl GetControl() { return new DisplayCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
DisplayCfg() {}
|
||||
|
||||
public DisplayCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
public partial class DisplayCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(DisplayCfgCtrl));
|
||||
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
DisplayCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as DisplayCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public DisplayCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PumpCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
partial class DisplayCfgCtrl
|
||||
{
|
||||
/// <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.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(99, 34);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(174, 20);
|
||||
this.nameTextBox.TabIndex = 1;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(13, 37);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 0;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(96, 11);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(114, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComponentClassName";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(-211, -147);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(57, 13);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "Arguments";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Enabled = false;
|
||||
this.textBox1.Location = new System.Drawing.Point(-125, -150);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(372, 20);
|
||||
this.textBox1.TabIndex = 6;
|
||||
//
|
||||
// DisplayCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "DisplayCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(500, 300);
|
||||
this.Load += new System.EventHandler(this.PumpCfgCtrl_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.Label label1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using System.Drawing;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
public partial class DisplayForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(DisplayForm));
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly string[] imageFileNames;
|
||||
readonly int imagesCount;
|
||||
|
||||
readonly GroupBox[] groupBoxes;
|
||||
readonly PictureBox[] pictureBoxes;
|
||||
readonly CheckBox[] checkBoxes;
|
||||
readonly int boxesCount;
|
||||
|
||||
Timer myTimer;
|
||||
|
||||
|
||||
public bool[] SelectedImages;
|
||||
public DialogResult Result; /// DialogResult.None OK Retry or Cancel
|
||||
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public DisplayForm(string[] imageFileNames, string title)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.imageFileNames = imageFileNames;
|
||||
this.imagesCount = (imageFileNames == null) ? 0 : imageFileNames.Length;
|
||||
|
||||
groupBoxes = new GroupBox[] { groupBox1, groupBox2, groupBox3, groupBox4, groupBox5, groupBox6 };
|
||||
pictureBoxes = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6 };
|
||||
checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6 };
|
||||
boxesCount = pictureBoxes.Length;
|
||||
|
||||
Text = title;
|
||||
|
||||
int lastVisibleGroupBoxIx = 0;
|
||||
for (int i = 0; i < boxesCount; i++)
|
||||
{
|
||||
if (i < imagesCount && !string.IsNullOrEmpty(imageFileNames[i]))
|
||||
{
|
||||
groupBoxes[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
|
||||
checkBoxes[i].Checked = true;
|
||||
checkBoxes[i].Text = Strings.Retry;
|
||||
lastVisibleGroupBoxIx = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
groupBoxes[i].Visible = false;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
SelectedImages = new bool[imagesCount];
|
||||
|
||||
if (lastVisibleGroupBoxIx < 3) Height = 338;
|
||||
|
||||
Result = DialogResult.None;
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
/// <summary> Parameterless constructor for all watermeters </summary>
|
||||
public DisplayForm()
|
||||
: this(null, string.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
retryButton.Text = Strings.Retry;
|
||||
abortButton.Text = Strings.Abort;
|
||||
|
||||
myTimer = new Timer();
|
||||
myTimer.Interval = (500); // 45 mins
|
||||
myTimer.Tick += new EventHandler(MyTimer_Tick);
|
||||
myTimer.Start();
|
||||
}
|
||||
|
||||
private void MyTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(imagesCount, boxesCount); i++)
|
||||
{
|
||||
if (imageFileNames[i] != null &&
|
||||
System.IO.File.Exists(imageFileNames[i]) &&
|
||||
pictureBoxes[i] != null &&
|
||||
pictureBoxes[i].Image == null)
|
||||
{
|
||||
pictureBoxes[i].Image = Image.FromFile(imageFileNames[i]); ;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UpdateData()
|
||||
{
|
||||
for (int i = 0; i < Math.Min(imagesCount, boxesCount); i++)
|
||||
{
|
||||
SelectedImages[i] = checkBoxes[i].Checked;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (myTimer != null) myTimer.Stop();
|
||||
UpdateData();
|
||||
Result = DialogResult.OK;
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void abortButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (myTimer != null) myTimer.Stop();
|
||||
UpdateData();
|
||||
Result = DialogResult.Abort;
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void retryButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (myTimer != null) myTimer.Stop();
|
||||
UpdateData();
|
||||
Result = DialogResult.Retry;
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
private void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+285
@@ -0,0 +1,285 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
partial class DisplayForm
|
||||
{
|
||||
/// <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(DisplayForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.pictureBox3 = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||
this.pictureBox4 = new System.Windows.Forms.PictureBox();
|
||||
this.retryButton = new System.Windows.Forms.Button();
|
||||
this.abortButton = new System.Windows.Forms.Button();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox5 = new System.Windows.Forms.CheckBox();
|
||||
this.pictureBox5 = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox6 = new System.Windows.Forms.CheckBox();
|
||||
this.pictureBox6 = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
this.groupBox3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
|
||||
this.groupBox4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
|
||||
this.groupBox5.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
|
||||
this.groupBox6.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
|
||||
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);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.pictureBox1);
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
resources.ApplyResources(this.checkBox1, "checkBox1");
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox1, "pictureBox1");
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.checkBox2);
|
||||
this.groupBox2.Controls.Add(this.pictureBox2);
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
resources.ApplyResources(this.checkBox2, "checkBox2");
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox2
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox2, "pictureBox2");
|
||||
this.pictureBox2.Name = "pictureBox2";
|
||||
this.pictureBox2.TabStop = false;
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.checkBox3);
|
||||
this.groupBox3.Controls.Add(this.pictureBox3);
|
||||
resources.ApplyResources(this.groupBox3, "groupBox3");
|
||||
this.groupBox3.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.TabStop = false;
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
resources.ApplyResources(this.checkBox3, "checkBox3");
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox3
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox3, "pictureBox3");
|
||||
this.pictureBox3.Name = "pictureBox3";
|
||||
this.pictureBox3.TabStop = false;
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.checkBox4);
|
||||
this.groupBox4.Controls.Add(this.pictureBox4);
|
||||
resources.ApplyResources(this.groupBox4, "groupBox4");
|
||||
this.groupBox4.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.TabStop = false;
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
resources.ApplyResources(this.checkBox4, "checkBox4");
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox4
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox4, "pictureBox4");
|
||||
this.pictureBox4.Name = "pictureBox4";
|
||||
this.pictureBox4.TabStop = false;
|
||||
//
|
||||
// retryButton
|
||||
//
|
||||
resources.ApplyResources(this.retryButton, "retryButton");
|
||||
this.retryButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.retryButton.Name = "retryButton";
|
||||
this.retryButton.UseVisualStyleBackColor = true;
|
||||
this.retryButton.Click += new System.EventHandler(this.retryButton_Click);
|
||||
//
|
||||
// abortButton
|
||||
//
|
||||
resources.ApplyResources(this.abortButton, "abortButton");
|
||||
this.abortButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.abortButton.Name = "abortButton";
|
||||
this.abortButton.UseVisualStyleBackColor = true;
|
||||
this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
|
||||
//
|
||||
// groupBox5
|
||||
//
|
||||
this.groupBox5.Controls.Add(this.checkBox5);
|
||||
this.groupBox5.Controls.Add(this.pictureBox5);
|
||||
resources.ApplyResources(this.groupBox5, "groupBox5");
|
||||
this.groupBox5.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox5.Name = "groupBox5";
|
||||
this.groupBox5.TabStop = false;
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
resources.ApplyResources(this.checkBox5, "checkBox5");
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox5
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox5, "pictureBox5");
|
||||
this.pictureBox5.Name = "pictureBox5";
|
||||
this.pictureBox5.TabStop = false;
|
||||
//
|
||||
// groupBox6
|
||||
//
|
||||
this.groupBox6.Controls.Add(this.checkBox6);
|
||||
this.groupBox6.Controls.Add(this.pictureBox6);
|
||||
resources.ApplyResources(this.groupBox6, "groupBox6");
|
||||
this.groupBox6.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox6.Name = "groupBox6";
|
||||
this.groupBox6.TabStop = false;
|
||||
//
|
||||
// checkBox6
|
||||
//
|
||||
resources.ApplyResources(this.checkBox6, "checkBox6");
|
||||
this.checkBox6.Name = "checkBox6";
|
||||
this.checkBox6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox6
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox6, "pictureBox6");
|
||||
this.pictureBox6.Name = "pictureBox6";
|
||||
this.pictureBox6.TabStop = false;
|
||||
//
|
||||
// DisplayForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.Controls.Add(this.groupBox6);
|
||||
this.Controls.Add(this.groupBox5);
|
||||
this.Controls.Add(this.abortButton);
|
||||
this.Controls.Add(this.retryButton);
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "DisplayForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox4.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
|
||||
this.groupBox6.ResumeLayout(false);
|
||||
this.groupBox6.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.Button retryButton;
|
||||
private System.Windows.Forms.Button abortButton;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
private System.Windows.Forms.PictureBox pictureBox3;
|
||||
private System.Windows.Forms.PictureBox pictureBox4;
|
||||
private System.Windows.Forms.GroupBox groupBox5;
|
||||
private System.Windows.Forms.PictureBox pictureBox5;
|
||||
private System.Windows.Forms.GroupBox groupBox6;
|
||||
private System.Windows.Forms.PictureBox pictureBox6;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.CheckBox checkBox5;
|
||||
private System.Windows.Forms.CheckBox checkBox6;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,807 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="okButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>1072, 19</value>
|
||||
</data>
|
||||
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>146, 58</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="okButton.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name=">>okButton.Name" xml:space="preserve">
|
||||
<value>okButton</value>
|
||||
</data>
|
||||
<data name=">>okButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>okButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="checkBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="checkBox1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="checkBox1.CheckAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name="checkBox1.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 12pt</value>
|
||||
</data>
|
||||
<data name="checkBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 19</value>
|
||||
</data>
|
||||
<data name="checkBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 22</value>
|
||||
</data>
|
||||
<data name="checkBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="checkBox1.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="checkBox1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name=">>checkBox1.Name" xml:space="preserve">
|
||||
<value>checkBox1</value>
|
||||
</data>
|
||||
<data name=">>checkBox1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>checkBox1.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>checkBox1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>7, 45</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 240</value>
|
||||
</data>
|
||||
<data name="pictureBox1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Name" xml:space="preserve">
|
||||
<value>pictureBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Parent" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox1.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 8</value>
|
||||
</data>
|
||||
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>335, 293</value>
|
||||
</data>
|
||||
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox1.Text" xml:space="preserve">
|
||||
<value>Watermeter 1</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Name" xml:space="preserve">
|
||||
<value>groupBox1</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox1.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="checkBox2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="checkBox2.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="checkBox2.CheckAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name="checkBox2.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 12pt</value>
|
||||
</data>
|
||||
<data name="checkBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="checkBox2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 19</value>
|
||||
</data>
|
||||
<data name="checkBox2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 22</value>
|
||||
</data>
|
||||
<data name="checkBox2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="checkBox2.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="checkBox2.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name=">>checkBox2.Name" xml:space="preserve">
|
||||
<value>checkBox2</value>
|
||||
</data>
|
||||
<data name=">>checkBox2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>checkBox2.Parent" xml:space="preserve">
|
||||
<value>groupBox2</value>
|
||||
</data>
|
||||
<data name=">>checkBox2.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>7, 45</value>
|
||||
</data>
|
||||
<data name="pictureBox2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 240</value>
|
||||
</data>
|
||||
<data name="pictureBox2.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="pictureBox2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.Name" xml:space="preserve">
|
||||
<value>pictureBox2</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.Parent" xml:space="preserve">
|
||||
<value>groupBox2</value>
|
||||
</data>
|
||||
<data name=">>pictureBox2.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox2.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>365, 8</value>
|
||||
</data>
|
||||
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>335, 293</value>
|
||||
</data>
|
||||
<data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="groupBox2.Text" xml:space="preserve">
|
||||
<value>Watermeter 2</value>
|
||||
</data>
|
||||
<data name=">>groupBox2.Name" xml:space="preserve">
|
||||
<value>groupBox2</value>
|
||||
</data>
|
||||
<data name=">>groupBox2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox2.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox2.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="checkBox3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="checkBox3.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="checkBox3.CheckAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name="checkBox3.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 12pt</value>
|
||||
</data>
|
||||
<data name="checkBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="checkBox3.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 19</value>
|
||||
</data>
|
||||
<data name="checkBox3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 22</value>
|
||||
</data>
|
||||
<data name="checkBox3.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="checkBox3.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="checkBox3.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name=">>checkBox3.Name" xml:space="preserve">
|
||||
<value>checkBox3</value>
|
||||
</data>
|
||||
<data name=">>checkBox3.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>checkBox3.Parent" xml:space="preserve">
|
||||
<value>groupBox3</value>
|
||||
</data>
|
||||
<data name=">>checkBox3.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox3.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>7, 45</value>
|
||||
</data>
|
||||
<data name="pictureBox3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 240</value>
|
||||
</data>
|
||||
<data name="pictureBox3.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="pictureBox3.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.Name" xml:space="preserve">
|
||||
<value>pictureBox3</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.Parent" xml:space="preserve">
|
||||
<value>groupBox3</value>
|
||||
</data>
|
||||
<data name=">>pictureBox3.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox3.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="groupBox3.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>717, 8</value>
|
||||
</data>
|
||||
<data name="groupBox3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>335, 293</value>
|
||||
</data>
|
||||
<data name="groupBox3.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="groupBox3.Text" xml:space="preserve">
|
||||
<value>Watermeter 3</value>
|
||||
</data>
|
||||
<data name=">>groupBox3.Name" xml:space="preserve">
|
||||
<value>groupBox3</value>
|
||||
</data>
|
||||
<data name=">>groupBox3.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox3.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox3.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="checkBox4.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="checkBox4.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="checkBox4.CheckAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name="checkBox4.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 12pt</value>
|
||||
</data>
|
||||
<data name="checkBox4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="checkBox4.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 19</value>
|
||||
</data>
|
||||
<data name="checkBox4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 22</value>
|
||||
</data>
|
||||
<data name="checkBox4.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="checkBox4.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="checkBox4.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name=">>checkBox4.Name" xml:space="preserve">
|
||||
<value>checkBox4</value>
|
||||
</data>
|
||||
<data name=">>checkBox4.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>checkBox4.Parent" xml:space="preserve">
|
||||
<value>groupBox4</value>
|
||||
</data>
|
||||
<data name=">>checkBox4.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox4.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>7, 45</value>
|
||||
</data>
|
||||
<data name="pictureBox4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 240</value>
|
||||
</data>
|
||||
<data name="pictureBox4.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="pictureBox4.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox4.Name" xml:space="preserve">
|
||||
<value>pictureBox4</value>
|
||||
</data>
|
||||
<data name=">>pictureBox4.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox4.Parent" xml:space="preserve">
|
||||
<value>groupBox4</value>
|
||||
</data>
|
||||
<data name=">>pictureBox4.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox4.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="groupBox4.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 306</value>
|
||||
</data>
|
||||
<data name="groupBox4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>335, 293</value>
|
||||
</data>
|
||||
<data name="groupBox4.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="groupBox4.Text" xml:space="preserve">
|
||||
<value>Watermeter 4</value>
|
||||
</data>
|
||||
<data name=">>groupBox4.Name" xml:space="preserve">
|
||||
<value>groupBox4</value>
|
||||
</data>
|
||||
<data name=">>groupBox4.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox4.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox4.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="retryButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="retryButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="retryButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="retryButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>1072, 96</value>
|
||||
</data>
|
||||
<data name="retryButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>146, 58</value>
|
||||
</data>
|
||||
<data name="retryButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="retryButton.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name=">>retryButton.Name" xml:space="preserve">
|
||||
<value>retryButton</value>
|
||||
</data>
|
||||
<data name=">>retryButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>retryButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>retryButton.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="abortButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="abortButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="abortButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="abortButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>1072, 173</value>
|
||||
</data>
|
||||
<data name="abortButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>146, 58</value>
|
||||
</data>
|
||||
<data name="abortButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="abortButton.Text" xml:space="preserve">
|
||||
<value>Abort</value>
|
||||
</data>
|
||||
<data name=">>abortButton.Name" xml:space="preserve">
|
||||
<value>abortButton</value>
|
||||
</data>
|
||||
<data name=">>abortButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>abortButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>abortButton.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="checkBox5.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="checkBox5.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="checkBox5.CheckAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name="checkBox5.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 12pt</value>
|
||||
</data>
|
||||
<data name="checkBox5.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="checkBox5.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 19</value>
|
||||
</data>
|
||||
<data name="checkBox5.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 22</value>
|
||||
</data>
|
||||
<data name="checkBox5.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="checkBox5.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="checkBox5.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name=">>checkBox5.Name" xml:space="preserve">
|
||||
<value>checkBox5</value>
|
||||
</data>
|
||||
<data name=">>checkBox5.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>checkBox5.Parent" xml:space="preserve">
|
||||
<value>groupBox5</value>
|
||||
</data>
|
||||
<data name=">>checkBox5.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox5.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox5.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>7, 45</value>
|
||||
</data>
|
||||
<data name="pictureBox5.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 240</value>
|
||||
</data>
|
||||
<data name="pictureBox5.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="pictureBox5.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox5.Name" xml:space="preserve">
|
||||
<value>pictureBox5</value>
|
||||
</data>
|
||||
<data name=">>pictureBox5.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox5.Parent" xml:space="preserve">
|
||||
<value>groupBox5</value>
|
||||
</data>
|
||||
<data name=">>pictureBox5.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox5.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="groupBox5.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>365, 306</value>
|
||||
</data>
|
||||
<data name="groupBox5.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>335, 293</value>
|
||||
</data>
|
||||
<data name="groupBox5.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="groupBox5.Text" xml:space="preserve">
|
||||
<value>Watermeter 5</value>
|
||||
</data>
|
||||
<data name=">>groupBox5.Name" xml:space="preserve">
|
||||
<value>groupBox5</value>
|
||||
</data>
|
||||
<data name=">>groupBox5.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox5.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox5.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="checkBox6.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="checkBox6.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="checkBox6.CheckAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name="checkBox6.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 12pt</value>
|
||||
</data>
|
||||
<data name="checkBox6.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="checkBox6.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 19</value>
|
||||
</data>
|
||||
<data name="checkBox6.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 22</value>
|
||||
</data>
|
||||
<data name="checkBox6.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="checkBox6.Text" xml:space="preserve">
|
||||
<value>Retry</value>
|
||||
</data>
|
||||
<data name="checkBox6.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleRight</value>
|
||||
</data>
|
||||
<data name=">>checkBox6.Name" xml:space="preserve">
|
||||
<value>checkBox6</value>
|
||||
</data>
|
||||
<data name=">>checkBox6.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>checkBox6.Parent" xml:space="preserve">
|
||||
<value>groupBox6</value>
|
||||
</data>
|
||||
<data name=">>checkBox6.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pictureBox6.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pictureBox6.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>7, 45</value>
|
||||
</data>
|
||||
<data name="pictureBox6.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>320, 240</value>
|
||||
</data>
|
||||
<data name="pictureBox6.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="pictureBox6.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox6.Name" xml:space="preserve">
|
||||
<value>pictureBox6</value>
|
||||
</data>
|
||||
<data name=">>pictureBox6.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox6.Parent" xml:space="preserve">
|
||||
<value>groupBox6</value>
|
||||
</data>
|
||||
<data name=">>pictureBox6.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="groupBox6.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Verdana, 14.25pt</value>
|
||||
</data>
|
||||
<data name="groupBox6.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>717, 306</value>
|
||||
</data>
|
||||
<data name="groupBox6.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>335, 293</value>
|
||||
</data>
|
||||
<data name="groupBox6.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="groupBox6.Text" xml:space="preserve">
|
||||
<value>Watermeter 6</value>
|
||||
</data>
|
||||
<data name=">>groupBox6.Name" xml:space="preserve">
|
||||
<value>groupBox6</value>
|
||||
</data>
|
||||
<data name=">>groupBox6.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBox6.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>groupBox6.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1237, 613</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>DisplayForm</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Display
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Display.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Display(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Display(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new DisplayCfg(this.GetType().Namespace.Substring(17), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(DisplayCfg), component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,27 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public class ProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public float PulsesPerLtr; /// [l^-1]
|
||||
public int DetectionImagesCount;
|
||||
public int DetectionPeriod1;
|
||||
public int DetectionPeriod2;
|
||||
public string RoiParams;
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
PulsesPerLtr = 1.0f;
|
||||
DetectionImagesCount = 10;
|
||||
DetectionPeriod1 = 1;
|
||||
DetectionPeriod2 = 19;
|
||||
RoiParams = "160 160 79 79 20 79 0 0 360 360 1 50 0 0 50 0";
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.PulsesPerLtr,
|
||||
"Images count",
|
||||
"Period1",
|
||||
"Period2",
|
||||
"Parameters"
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
@@ -32,6 +44,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
switch (i)
|
||||
{
|
||||
case 0: return PulsesPerLtr.ToString();
|
||||
case 1: return DetectionImagesCount.ToString();
|
||||
case 2: return DetectionPeriod1.ToString();
|
||||
case 3: return DetectionPeriod2.ToString();
|
||||
case 4: return RoiParams;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +58,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
switch (i)
|
||||
{
|
||||
case 0: PulsesPerLtr = Utils.ParseUFloat(strValue); return;
|
||||
case 1: DetectionImagesCount = int.Parse(strValue); return;
|
||||
case 2: DetectionPeriod1 = int.Parse(strValue); return;
|
||||
case 3: DetectionPeriod2 = int.Parse(strValue); return;
|
||||
case 4: RoiParams = strValue; return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
@@ -52,11 +72,19 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
message = string.Empty;
|
||||
|
||||
float dummy;
|
||||
int idummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
if (int.TryParse(strValue, out idummy) && idummy >= 1 && idummy <= 50) return true;
|
||||
break;
|
||||
case 4:
|
||||
return true;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
@@ -69,6 +97,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
void CopyContentTo(ProcedureParams prms)
|
||||
{
|
||||
prms.PulsesPerLtr = this.PulsesPerLtr;
|
||||
prms.DetectionImagesCount = this.DetectionImagesCount;
|
||||
prms.DetectionPeriod1 = this.DetectionPeriod1;
|
||||
prms.DetectionPeriod2 = this.DetectionPeriod2;
|
||||
prms.RoiParams = this.RoiParams;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
|
||||
@@ -35,25 +35,39 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public double PulsesPerLtr { get { return (double)RoiCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
|
||||
|
||||
int wmPulses;
|
||||
public int WMPulses { get { return wmPulses; } }
|
||||
int cameraPulses;
|
||||
int pulsesDelta; /// = (WMPulses - cameraPulses) ... WMPulses = cameraPulses + pulsesDelta, Clear() calculates pulsesDelta
|
||||
public int WMPulses { get { return cameraPulses + pulsesDelta; } }
|
||||
|
||||
long cameraTime;
|
||||
long timeDelta; /// = (WMTestTime - cameraTime) ... WMTestTime = cameraTime + timeDelta, Clear() calculates timeDelta
|
||||
public double WMTestTime { get { return (cameraTime + timeDelta) / 1000.0; } }
|
||||
|
||||
int wmRefPulses;
|
||||
public int WMRefPulses { get { return wmRefPulses; } }
|
||||
|
||||
public double WMVolume { get { return LtrsPerPulse * (double)wmPulses; } }
|
||||
public double WMVolume { get { return LtrsPerPulse * (double)WMPulses; } }
|
||||
|
||||
public double BeginWMState { get { return 0; } } /// Always 0
|
||||
public double EndWMState { get { return WMVolume; } } /// Derived from WMVolume
|
||||
public double BeginWMState { get { return 0; } } /// Always 0
|
||||
public double EndWMState { get { return WMVolume; } } /// Derived from WMVolume
|
||||
|
||||
|
||||
double volumeStart;
|
||||
public double VolumeStart { get { return volumeStart; } } /// in l
|
||||
|
||||
double volumeEnd;
|
||||
public double VolumeEnd { get { return volumeEnd; } } /// in l
|
||||
|
||||
double timestampStart;
|
||||
public double TimestampStart { get { return timestampStart; } } /// in s
|
||||
|
||||
double timestampEnd;
|
||||
public double TimestampEnd { get { return timestampEnd; } } /// in s
|
||||
|
||||
///
|
||||
/// Roi specific
|
||||
///
|
||||
public bool Detected
|
||||
{
|
||||
get { return detected; }
|
||||
set { detected = value; }
|
||||
}
|
||||
public bool Detected { get { return detected; } }
|
||||
bool detected;
|
||||
///
|
||||
public Boxes.IntBox RoiX;
|
||||
@@ -61,6 +75,23 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public Boxes.IntBox RoiWid;
|
||||
public Boxes.IntBox RoiHgh;
|
||||
///
|
||||
public void ClearRoi()
|
||||
{
|
||||
detected = false;
|
||||
}
|
||||
///
|
||||
public void SetRoi(int x, int y, int wid, int hgh)
|
||||
{
|
||||
RoiX.Val = x;
|
||||
RoiY.Val = y;
|
||||
RoiWid.Val = wid;
|
||||
RoiHgh.Val = hgh;
|
||||
detected = true;
|
||||
}
|
||||
///
|
||||
public string DetectedImageName { get { return detectedImageName; } }
|
||||
string detectedImageName;
|
||||
///
|
||||
private int roiHandle;
|
||||
///
|
||||
public void RegisterRoiToCamera()
|
||||
@@ -115,11 +146,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
RoiCfg.RoiParams = tmpcfg.RoiParams;
|
||||
RoiCfg.UseTestImages = tmpcfg.UseTestImages;
|
||||
RoiCfg.DetectionImagesCount = tmpcfg.DetectionImagesCount;
|
||||
RoiCfg.DetectionPeriod1 = tmpcfg.DetectionPeriod1;
|
||||
RoiCfg.DetectionPeriod2 = tmpcfg.DetectionPeriod2;
|
||||
RoiCfg.LoadImages = tmpcfg.LoadImages;
|
||||
RoiCfg.SaveImages = tmpcfg.SaveImages;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -129,7 +157,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
wmPulses = 0;
|
||||
pulsesDelta = -cameraPulses;
|
||||
timeDelta = -cameraTime;
|
||||
wmRefPulses = 0;
|
||||
}
|
||||
|
||||
@@ -140,8 +169,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
{
|
||||
if (NetCamera != null && NetCamera.Telnet != null)
|
||||
{
|
||||
Telnet = NetCamera.Telnet;
|
||||
return new RoiDetectionOp(this, RoiX, RoiY, RoiWid, RoiHgh);
|
||||
Telnet = NetCamera.Telnet;
|
||||
detectedImageName = string.Format("{0}{1}-det-{2}.jpg", Program.ImagesDir, RoiCfg.Name, StateMachine.Time);
|
||||
return new RoiDetectionOp(this, RoiX, RoiY, RoiWid, RoiHgh);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -157,7 +187,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
{
|
||||
if (detected && roiHandle != 0)
|
||||
{
|
||||
wmPulses = NetCamera.GetResult(roiHandle);
|
||||
cameraPulses = NetCamera.GetResult(roiHandle, out cameraTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +203,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public void Start()
|
||||
{
|
||||
UdatePulses();
|
||||
Clear();
|
||||
volumeStart = WMVolume;
|
||||
timestampStart = WMTestTime;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -180,6 +213,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public Event Run()
|
||||
{
|
||||
UdatePulses();
|
||||
volumeEnd = WMVolume;
|
||||
timestampEnd = WMTestTime;
|
||||
return Event.ReadRegisterDone;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
/// Serialized parameters
|
||||
///
|
||||
public string PreviousRoi;
|
||||
public string RoiParams;
|
||||
public int DetectionImagesCount;
|
||||
public int DetectionPeriod1;
|
||||
public int DetectionPeriod2;
|
||||
public bool UseTestImages;
|
||||
public bool LoadImages;
|
||||
public bool SaveImages;
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
@@ -32,6 +29,12 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
return procParams;
|
||||
}
|
||||
|
||||
public int DetectionImagesCount { get { return ProcParams.DetectionImagesCount; } }
|
||||
public int DetectionPeriod1 { get { return ProcParams.DetectionPeriod1; } }
|
||||
public int DetectionPeriod2 { get { return ProcParams.DetectionPeriod2; } }
|
||||
public string RoiParams { get { return ProcParams.RoiParams; } }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RoiCfg()
|
||||
{
|
||||
@@ -44,15 +47,11 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = "Camera";
|
||||
RoiParams = string.Empty;
|
||||
DetectionImagesCount = 15;
|
||||
DetectionPeriod1 = 1;
|
||||
DetectionPeriod2 = 1;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Params={2}", Name, ParentName, RoiParams);
|
||||
return string.Format("{0} ({1}) {2}", Name, ParentName, (LoadImages ? " load images" : (SaveImages ? " save images" : "")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +68,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
nameTextBox.Text = config.Name;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
previousRoiComboBox.Text = string.IsNullOrEmpty(config.PreviousRoi) ? "---" : config.PreviousRoi;
|
||||
argsTextBox.Text = config.RoiParams;
|
||||
useTestImagesCheckBox.Checked = config.UseTestImages;
|
||||
imagesCountTextBox.Text = config.DetectionImagesCount.ToString();
|
||||
period1TextBox.Text = config.DetectionPeriod1.ToString();
|
||||
period2TextBox.Text = config.DetectionPeriod2.ToString();
|
||||
loadImagesCheckBox.Checked = config.LoadImages;
|
||||
saveImagesCheckBox.Checked = config.SaveImages;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -80,75 +77,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
previousRoiComboBox.Enabled = true;
|
||||
argsTextBox.Enabled = true;
|
||||
useTestImagesCheckBox.Enabled = true;
|
||||
imagesCountTextBox.Enabled = true;
|
||||
period1TextBox.Enabled = true;
|
||||
period2TextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
string newParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
if (config.ParentName != newParentName)
|
||||
{
|
||||
config.ParentName = newParentName;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
string newPreviousRoi = previousRoiComboBox.Text.Equals("---") ? string.Empty : previousRoiComboBox.Text;
|
||||
if (config.PreviousRoi != newPreviousRoi)
|
||||
{
|
||||
config.PreviousRoi = newPreviousRoi;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.RoiParams != argsTextBox.Text)
|
||||
{
|
||||
config.RoiParams = argsTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.UseTestImages != useTestImagesCheckBox.Checked)
|
||||
{
|
||||
config.UseTestImages = useTestImagesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.DetectionImagesCount != int.Parse(imagesCountTextBox.Text))
|
||||
{
|
||||
config.DetectionImagesCount = int.Parse(imagesCountTextBox.Text);
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.DetectionPeriod1 != int.Parse(period1TextBox.Text))
|
||||
{
|
||||
config.DetectionPeriod1 = int.Parse(period1TextBox.Text);
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.DetectionPeriod2 != int.Parse(period2TextBox.Text))
|
||||
{
|
||||
config.DetectionPeriod2 = int.Parse(period2TextBox.Text);
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
}
|
||||
|
||||
return flags;
|
||||
loadImagesCheckBox.Enabled = true;
|
||||
saveImagesCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -167,31 +97,56 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
message += Environment.NewLine + "Invalid 'Previous RoI'";
|
||||
}
|
||||
|
||||
int cnt, p1, p2;
|
||||
if (!int.TryParse(imagesCountTextBox.Text, out cnt) || cnt < 1 || cnt > 50)
|
||||
if (loadImagesCheckBox.Checked && saveImagesCheckBox.Checked)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Images count' should be between 1 and 50";
|
||||
message += Environment.NewLine + "Images cannot be Loaded and Saved at the same time";
|
||||
}
|
||||
if (!int.TryParse(period1TextBox.Text, out p1) || p1 < 1 || p1 > 50)
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Period 1' should be between 1 and 50";
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
if (!int.TryParse(period2TextBox.Text, out p2) || p2 < 1 || p2 > 50)
|
||||
|
||||
string newParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
if (config.ParentName != newParentName)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Period 2' should be between 1 and 50";
|
||||
config.ParentName = newParentName;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
if (p2 < p1)
|
||||
|
||||
string newPreviousRoi = previousRoiComboBox.Text.Equals("---") ? string.Empty : previousRoiComboBox.Text;
|
||||
if (config.PreviousRoi != newPreviousRoi)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Period2 should >= Period1";
|
||||
config.PreviousRoi = newPreviousRoi;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
if (p2 > p1 && (cnt % 2) != 0)
|
||||
|
||||
if (config.LoadImages != loadImagesCheckBox.Checked)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "When Period2 > Period1, 'Images count' should be even";
|
||||
config.LoadImages = loadImagesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.SaveImages != saveImagesCheckBox.Checked)
|
||||
{
|
||||
config.SaveImages = saveImagesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
}
|
||||
|
||||
return flags;
|
||||
|
||||
+36
-129
@@ -31,8 +31,6 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.argsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.argsLabel = new System.Windows.Forms.Label();
|
||||
this.parentNameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
@@ -44,41 +42,17 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.previousRoiLabel = new System.Windows.Forms.Label();
|
||||
this.helpLabel1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.imagesCountTextBox = new System.Windows.Forms.TextBox();
|
||||
this.imagesCountLabel = new System.Windows.Forms.Label();
|
||||
this.useTestImagesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.period1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.period1Label = new System.Windows.Forms.Label();
|
||||
this.period2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.period2Label = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.loadImagesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.saveImagesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// argsTextBox
|
||||
//
|
||||
this.argsTextBox.Enabled = false;
|
||||
this.argsTextBox.Location = new System.Drawing.Point(92, 19);
|
||||
this.argsTextBox.Name = "argsTextBox";
|
||||
this.argsTextBox.Size = new System.Drawing.Size(361, 20);
|
||||
this.argsTextBox.TabIndex = 7;
|
||||
//
|
||||
// argsLabel
|
||||
//
|
||||
this.argsLabel.AutoSize = true;
|
||||
this.argsLabel.Location = new System.Drawing.Point(6, 22);
|
||||
this.argsLabel.Name = "argsLabel";
|
||||
this.argsLabel.Size = new System.Drawing.Size(57, 13);
|
||||
this.argsLabel.TabIndex = 6;
|
||||
this.argsLabel.Text = "Arguments";
|
||||
//
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(13, 60);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 2;
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
this.parentNameLabel.Text = "Parent Name";
|
||||
//
|
||||
// nameTextBox
|
||||
@@ -87,7 +61,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.nameTextBox.Location = new System.Drawing.Point(99, 34);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(174, 20);
|
||||
this.nameTextBox.TabIndex = 1;
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
@@ -95,7 +69,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.nameLabel.Location = new System.Drawing.Point(13, 37);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 0;
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
@@ -114,7 +88,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(99, 57);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(174, 21);
|
||||
this.parentNameComboBox.TabIndex = 3;
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@@ -140,7 +114,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.previousRoiComboBox.Location = new System.Drawing.Point(99, 81);
|
||||
this.previousRoiComboBox.Name = "previousRoiComboBox";
|
||||
this.previousRoiComboBox.Size = new System.Drawing.Size(174, 21);
|
||||
this.previousRoiComboBox.TabIndex = 5;
|
||||
this.previousRoiComboBox.TabIndex = 6;
|
||||
//
|
||||
// previousRoiLabel
|
||||
//
|
||||
@@ -148,117 +122,60 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.previousRoiLabel.Location = new System.Drawing.Point(13, 84);
|
||||
this.previousRoiLabel.Name = "previousRoiLabel";
|
||||
this.previousRoiLabel.Size = new System.Drawing.Size(68, 13);
|
||||
this.previousRoiLabel.TabIndex = 4;
|
||||
this.previousRoiLabel.TabIndex = 5;
|
||||
this.previousRoiLabel.Text = "Previous RoI";
|
||||
//
|
||||
// helpLabel1
|
||||
//
|
||||
this.helpLabel1.AutoSize = true;
|
||||
this.helpLabel1.Location = new System.Drawing.Point(91, 44);
|
||||
this.helpLabel1.Location = new System.Drawing.Point(38, 186);
|
||||
this.helpLabel1.Name = "helpLabel1";
|
||||
this.helpLabel1.Size = new System.Drawing.Size(379, 13);
|
||||
this.helpLabel1.TabIndex = 8;
|
||||
this.helpLabel1.TabIndex = 2;
|
||||
this.helpLabel1.Text = "roiWid roiHgh cx cy innerR outerR R3 ang1 ang2 fullAngle teethCount ..." +
|
||||
"";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(90, 62);
|
||||
this.label2.Location = new System.Drawing.Point(68, 204);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(350, 13);
|
||||
this.label2.TabIndex = 9;
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "... angSpeed( - ccw +cw) initSpeed minMvmt maxFwdMvmt bkgndCorr";
|
||||
//
|
||||
// imagesCountTextBox
|
||||
// loadImagesCheckBox
|
||||
//
|
||||
this.imagesCountTextBox.Enabled = false;
|
||||
this.imagesCountTextBox.Location = new System.Drawing.Point(92, 84);
|
||||
this.imagesCountTextBox.Name = "imagesCountTextBox";
|
||||
this.imagesCountTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.imagesCountTextBox.TabIndex = 19;
|
||||
this.loadImagesCheckBox.AutoSize = true;
|
||||
this.loadImagesCheckBox.Enabled = false;
|
||||
this.loadImagesCheckBox.Location = new System.Drawing.Point(99, 117);
|
||||
this.loadImagesCheckBox.Name = "loadImagesCheckBox";
|
||||
this.loadImagesCheckBox.Size = new System.Drawing.Size(112, 17);
|
||||
this.loadImagesCheckBox.TabIndex = 6;
|
||||
this.loadImagesCheckBox.Text = "Load images (test)";
|
||||
this.loadImagesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// imagesCountLabel
|
||||
// saveImagesCheckBox
|
||||
//
|
||||
this.imagesCountLabel.AutoSize = true;
|
||||
this.imagesCountLabel.Location = new System.Drawing.Point(6, 87);
|
||||
this.imagesCountLabel.Name = "imagesCountLabel";
|
||||
this.imagesCountLabel.Size = new System.Drawing.Size(71, 13);
|
||||
this.imagesCountLabel.TabIndex = 18;
|
||||
this.imagesCountLabel.Text = "Images count";
|
||||
//
|
||||
// useTestImagesCheckBox
|
||||
//
|
||||
this.useTestImagesCheckBox.AutoSize = true;
|
||||
this.useTestImagesCheckBox.Enabled = false;
|
||||
this.useTestImagesCheckBox.Location = new System.Drawing.Point(183, 87);
|
||||
this.useTestImagesCheckBox.Name = "useTestImagesCheckBox";
|
||||
this.useTestImagesCheckBox.Size = new System.Drawing.Size(101, 17);
|
||||
this.useTestImagesCheckBox.TabIndex = 17;
|
||||
this.useTestImagesCheckBox.Text = "Use test images";
|
||||
this.useTestImagesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// period1TextBox
|
||||
//
|
||||
this.period1TextBox.Enabled = false;
|
||||
this.period1TextBox.Location = new System.Drawing.Point(92, 107);
|
||||
this.period1TextBox.Name = "period1TextBox";
|
||||
this.period1TextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.period1TextBox.TabIndex = 21;
|
||||
//
|
||||
// period1Label
|
||||
//
|
||||
this.period1Label.AutoSize = true;
|
||||
this.period1Label.Location = new System.Drawing.Point(6, 110);
|
||||
this.period1Label.Name = "period1Label";
|
||||
this.period1Label.Size = new System.Drawing.Size(46, 13);
|
||||
this.period1Label.TabIndex = 20;
|
||||
this.period1Label.Text = "Period 1";
|
||||
//
|
||||
// period2TextBox
|
||||
//
|
||||
this.period2TextBox.Enabled = false;
|
||||
this.period2TextBox.Location = new System.Drawing.Point(92, 130);
|
||||
this.period2TextBox.Name = "period2TextBox";
|
||||
this.period2TextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.period2TextBox.TabIndex = 23;
|
||||
//
|
||||
// period2Label
|
||||
//
|
||||
this.period2Label.AutoSize = true;
|
||||
this.period2Label.Location = new System.Drawing.Point(6, 133);
|
||||
this.period2Label.Name = "period2Label";
|
||||
this.period2Label.Size = new System.Drawing.Size(46, 13);
|
||||
this.period2Label.TabIndex = 22;
|
||||
this.period2Label.Text = "Period 2";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.argsTextBox);
|
||||
this.groupBox1.Controls.Add(this.period2TextBox);
|
||||
this.groupBox1.Controls.Add(this.argsLabel);
|
||||
this.groupBox1.Controls.Add(this.period2Label);
|
||||
this.groupBox1.Controls.Add(this.helpLabel1);
|
||||
this.groupBox1.Controls.Add(this.period1TextBox);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.period1Label);
|
||||
this.groupBox1.Controls.Add(this.useTestImagesCheckBox);
|
||||
this.groupBox1.Controls.Add(this.imagesCountTextBox);
|
||||
this.groupBox1.Controls.Add(this.imagesCountLabel);
|
||||
this.groupBox1.Location = new System.Drawing.Point(7, 110);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(477, 169);
|
||||
this.groupBox1.TabIndex = 24;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "ROI Detection";
|
||||
this.saveImagesCheckBox.AutoSize = true;
|
||||
this.saveImagesCheckBox.Enabled = false;
|
||||
this.saveImagesCheckBox.Location = new System.Drawing.Point(99, 140);
|
||||
this.saveImagesCheckBox.Name = "saveImagesCheckBox";
|
||||
this.saveImagesCheckBox.Size = new System.Drawing.Size(132, 17);
|
||||
this.saveImagesCheckBox.TabIndex = 7;
|
||||
this.saveImagesCheckBox.Text = "Save images (analyze)";
|
||||
this.saveImagesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// RoiCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.helpLabel1);
|
||||
this.Controls.Add(this.saveImagesCheckBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.previousRoiComboBox);
|
||||
this.Controls.Add(this.previousRoiLabel);
|
||||
this.Controls.Add(this.loadImagesCheckBox);
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
@@ -269,8 +186,6 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
this.Name = "RoiCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(500, 300);
|
||||
this.Load += new System.EventHandler(this.PumpCfgCtrl_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -278,8 +193,6 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox argsTextBox;
|
||||
private System.Windows.Forms.Label argsLabel;
|
||||
private System.Windows.Forms.Label parentNameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
@@ -291,13 +204,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
private System.Windows.Forms.Label previousRoiLabel;
|
||||
private System.Windows.Forms.Label helpLabel1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox imagesCountTextBox;
|
||||
private System.Windows.Forms.Label imagesCountLabel;
|
||||
private System.Windows.Forms.CheckBox useTestImagesCheckBox;
|
||||
private System.Windows.Forms.TextBox period1TextBox;
|
||||
private System.Windows.Forms.Label period1Label;
|
||||
private System.Windows.Forms.TextBox period2TextBox;
|
||||
private System.Windows.Forms.Label period2Label;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.CheckBox loadImagesCheckBox;
|
||||
private System.Windows.Forms.CheckBox saveImagesCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
using TBF.BenchControl.Network.Telnet;
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Network.Telnet;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Roi
|
||||
{
|
||||
public class RoiDetectionOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RoiDetectionOp));
|
||||
public override string ToString() { return string.Format("RoiDetectionOp()"); }
|
||||
|
||||
|
||||
readonly Roi roi;
|
||||
readonly RoiCfg roiCfg;
|
||||
readonly CLP1611.Camera camera;
|
||||
@@ -93,9 +102,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
previous.RoiWid.Val, previous.RoiHgh.Val);
|
||||
previous = previous.PreviousRoi;
|
||||
}
|
||||
command = string.Format("clp/RoiDetection{0}{1}{2}{3} {4}",
|
||||
command = string.Format("clp/RoiDetection{0}{1}{2}{3}{4} {5}",
|
||||
masks,
|
||||
string.Format(roiCfg.UseTestImages ? " -l {0}" : " -n {0}", roiCfg.DetectionImagesCount),
|
||||
string.Format(roiCfg.LoadImages ? " -l {0}" : " -n {0}", roiCfg.DetectionImagesCount),
|
||||
roiCfg.SaveImages ? " -s" : "",
|
||||
string.Format(" -p1 {0}", roiCfg.DetectionPeriod1),
|
||||
string.Format(" -p2 {0}", roiCfg.DetectionPeriod2),
|
||||
roiCfg.RoiParams);
|
||||
@@ -109,13 +119,41 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
}
|
||||
return Event.CameraBusy;
|
||||
}
|
||||
else if (passed)
|
||||
{
|
||||
if (transferringDetectedImage)
|
||||
{
|
||||
/// ROI detection passed and image transfer is in progress
|
||||
return Event.RoiDetectionPassed;
|
||||
}
|
||||
else if (0 == camera.WscpTransferFile("detected.jpg", roi.DetectedImageName))
|
||||
{
|
||||
/// Start the file transfer
|
||||
transferringDetectedImage = true;
|
||||
return Event.RoiDetectionPassed;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Wait until the previous image transfer completes
|
||||
return Event.CameraBusy;
|
||||
}
|
||||
}
|
||||
else if (failed)
|
||||
{
|
||||
/// ROI detection failed, there in no image to transfer
|
||||
return Event.RoiDetectionFailed;
|
||||
}
|
||||
else if (previousFailed)
|
||||
{
|
||||
return Event.RoiDetectionPreviousFailed;
|
||||
}
|
||||
else if (response != null)
|
||||
{
|
||||
int from = response.IndexOf('[');
|
||||
int to = response.IndexOf(']');
|
||||
if (!response.Contains("RESULT=0\r\n") || from < 0 || to < 0 || to < from)
|
||||
{
|
||||
roi.Detected = false;
|
||||
roi.ClearRoi();
|
||||
failed = true;
|
||||
return Event.RoiDetectionFailed;
|
||||
}
|
||||
@@ -127,47 +165,30 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
if (terms.Length != 5 || !int.TryParse(terms[0], out x) || !int.TryParse(terms[1], out y)
|
||||
|| !int.TryParse(terms[2], out w) || !int.TryParse(terms[3], out h))
|
||||
{
|
||||
roi.Detected = false;
|
||||
roi.ClearRoi();
|
||||
failed = true;
|
||||
return Event.RoiDetectionFailed;
|
||||
}
|
||||
else
|
||||
{
|
||||
roiX.Val = x;
|
||||
roiY.Val = y;
|
||||
roiWid.Val = w;
|
||||
roiHgh.Val = h;
|
||||
|
||||
roi.Detected = true;
|
||||
roi.SetRoi(x, y, w, h);
|
||||
passed = true;
|
||||
return Event.RoiDetectionPassed;
|
||||
|
||||
///
|
||||
/// Start the file transfer
|
||||
///
|
||||
if (0 == camera.WscpTransferFile("detected.jpg", roi.DetectedImageName))
|
||||
{
|
||||
transferringDetectedImage = true;
|
||||
return Event.RoiDetectionPassed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.CameraBusy; /// File transfer not started
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (passed)
|
||||
{
|
||||
if (transferringDetectedImage)
|
||||
{
|
||||
return Event.RoiDetectionPassed;
|
||||
}
|
||||
else if (0 == camera.WscpTransferFile("detected.jpg"))
|
||||
{
|
||||
transferringDetectedImage = true;
|
||||
return Event.RoiDetectionPassed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.CameraBusy;
|
||||
}
|
||||
}
|
||||
else if (failed)
|
||||
{
|
||||
return Event.RoiDetectionFailed;
|
||||
}
|
||||
else if (previousFailed)
|
||||
{
|
||||
return Event.RoiDetectionPreviousFailed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.CameraBusy;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Network.Telnet
|
||||
{
|
||||
public class DummyVT : IVirtualTerminal
|
||||
{
|
||||
public DummyVT() { }
|
||||
|
||||
public void ClearScreen() { }
|
||||
public void WriteVt(char c) { }
|
||||
public void WriteVt(string txt) { }
|
||||
public string Text { get { return string.Empty; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Network.Telnet
|
||||
{
|
||||
public interface IVirtualTerminal
|
||||
{
|
||||
void ClearScreen();
|
||||
void WriteVt(char c);
|
||||
void WriteVt(string txt);
|
||||
string Text { get; }
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
/// Private fields
|
||||
///
|
||||
object objRef; /// Reference to object to be included in info sent by event handlers
|
||||
VirtualTerminal vt; /// Virtual terminal
|
||||
IVirtualTerminal vt; /// Virtual terminal
|
||||
string hostname; /// Telnet server host name or IP address.
|
||||
int portNr = DefaultTelnetPortNumber; /// Telnet server port number.
|
||||
TcpClient tcp = null; /// Reference to TcpClient
|
||||
@@ -223,7 +223,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
/// Hostname (IP address) and the port number is passed to worker thread
|
||||
/// in a Command with CmdAction.CONNECT and str=hostname.
|
||||
/// </summary>
|
||||
public TelnetClient(object objRef, string threadId, string userName, string password, string defaultPrompt, bool skipFirstLine)
|
||||
public TelnetClient(object objRef, string threadId, string userName, string password, string defaultPrompt, bool skipFirstLine, bool useVT)
|
||||
{
|
||||
this.objRef = objRef;
|
||||
this.telnetUserName = userName;
|
||||
@@ -232,7 +232,17 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
this.skipFirstLine = skipFirstLine;
|
||||
|
||||
state = TelnetState.Inactive; /// Device's icon is being updated by HNIP
|
||||
vt = new VirtualTerminal(); /// TODO: pass a VirtualTerminal reference
|
||||
///
|
||||
if (useVT)
|
||||
{
|
||||
vt = new VirtualTerminal();
|
||||
}
|
||||
else
|
||||
{
|
||||
vt = new DummyVT();
|
||||
}
|
||||
|
||||
/// TODO: pass a VirtualTerminal reference
|
||||
this.portNr = DefaultTelnetPortNumber;
|
||||
queueEvent = new AutoResetEvent(false);
|
||||
disconnectDone = new AutoResetEvent(false);
|
||||
@@ -986,7 +996,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
///
|
||||
/// Public properties (read only)
|
||||
///
|
||||
public VirtualTerminal Vt { get { return vt; } }
|
||||
public IVirtualTerminal Vt { get { return vt; } }
|
||||
public string Hostname { get { return hostname; } }
|
||||
public string NotificationText { get { return notificationText; } }
|
||||
public string ErrorText { get { return fatalErrorText; } }
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Network.Telnet
|
||||
/// - ClearScreen() and WriteVt() methods called from one thread only
|
||||
/// - properties Text, etc. can be safely read from an arbitrary thread
|
||||
/// </summary>
|
||||
public class VirtualTerminal
|
||||
public class VirtualTerminal : IVirtualTerminal
|
||||
{
|
||||
const uint DefaultVtRowsCount = 80; /// Default VT height (number of rows)
|
||||
const uint DefaultVtColumnsCount = 132; /// Default VT width (number of columns)
|
||||
|
||||
@@ -77,7 +77,8 @@ namespace TBF.BenchControl.Operations
|
||||
switch (cmd)
|
||||
{
|
||||
/// Bench Control Panel buttons
|
||||
case UI2BenchCmd.StartTest: return Event.UiCmdStartTest;
|
||||
case UI2BenchCmd.ReloadBatch: return Event.UiCmdReloadBatch;
|
||||
case UI2BenchCmd.StartTest: return Event.UiCmdStartTest;
|
||||
case UI2BenchCmd.StartQ1: return Event.UiCmdStartQ1;
|
||||
case UI2BenchCmd.StartQ2: return Event.UiCmdStartQ2;
|
||||
case UI2BenchCmd.StartQ3: return Event.UiCmdStartQ3;
|
||||
@@ -85,15 +86,16 @@ namespace TBF.BenchControl.Operations
|
||||
case UI2BenchCmd.Stop: return Event.UiCmdStop;
|
||||
case UI2BenchCmd.PurgeBegin: return Event.UiCmdPurgeBegin;
|
||||
case UI2BenchCmd.PurgeEnd: return Event.UiCmdPurgeEnd;
|
||||
case UI2BenchCmd.EmptyTank1: return Event.UiCmdEmptyTank1;
|
||||
case UI2BenchCmd.EmptyTank2: return Event.UiCmdEmptyTank2;
|
||||
case UI2BenchCmd.EmptyTank3: return Event.UiCmdEmptyTank3;
|
||||
case UI2BenchCmd.DrainTank1: return Event.UiCmdDrainTank1;
|
||||
case UI2BenchCmd.DrainTank2: return Event.UiCmdDrainTank2;
|
||||
case UI2BenchCmd.DrainTank3: return Event.UiCmdDrainTank3;
|
||||
case UI2BenchCmd.Break: return Event.UiCmdBreak;
|
||||
case UI2BenchCmd.ResetResults: return Event.UiCmdResetResults;
|
||||
case UI2BenchCmd.AcceptResults: return Event.UiCmdAcceptResults;
|
||||
case UI2BenchCmd.Calibration: return Event.UiCmdCalibration;
|
||||
case UI2BenchCmd.CameraTest: return Event.UiCmdCameraTest;
|
||||
case UI2BenchCmd.SensitivityTest: return Event.UiCmdSensitivityTest;
|
||||
case UI2BenchCmd.Custom: return Event.UiCmdCustom;
|
||||
|
||||
case UI2BenchCmd.Next: return Event.Next;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
@@ -22,15 +24,14 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
/// <summary>
|
||||
/// Result items to print
|
||||
/// </summary>
|
||||
IList<Results.WMeterRsltItemSpec> rsltItems;
|
||||
readonly IList<Results.WMeterRsltItemSpec> rsltItems;
|
||||
|
||||
/// <summary>
|
||||
/// Results to print
|
||||
/// </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
StreamWriter writer;
|
||||
StreamWriter writer2;
|
||||
Thread thread1; /// Thread where one file is saved
|
||||
Thread thread2; /// Thread where another file is saved
|
||||
bool completed1; /// Set to 'true' by the first thread when writing to the file completed
|
||||
bool completed2; /// Set to 'true' by the second thread when writing to the file completed
|
||||
bool abort; /// Set to 'true' by Stop() operation to abort writing to the file
|
||||
|
||||
|
||||
public Writer() {}
|
||||
@@ -50,6 +51,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
case Separator.Semicolon: separatorStr = ";"; break;
|
||||
}
|
||||
|
||||
rsltItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.SelectedItems);
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
@@ -130,36 +133,31 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
|
||||
/// Writes the test cycle results into a file
|
||||
/// Events:
|
||||
/// Event.ResultsWritten
|
||||
/// Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to write into the file</param>
|
||||
/// <param name="batch">Results to write into a file</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batchResults)
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batch)
|
||||
{
|
||||
this.batch = batchResults;
|
||||
|
||||
if (batch.WaterMeters.Count <= 0)
|
||||
{
|
||||
writer = null;
|
||||
writer2 = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
rsltItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.SelectedItems);
|
||||
|
||||
writer = null;
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath))
|
||||
thread1 = new Thread(() =>
|
||||
{
|
||||
try { writer = File.AppendText(GetFilename(writerCfg.DestinationPath, batch.EndTime)); }
|
||||
catch { };
|
||||
}
|
||||
WriteRslts(batch, writerCfg.DestinationPath);
|
||||
completed1 = true;
|
||||
});
|
||||
|
||||
writer2 = null;
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath2))
|
||||
thread2 = new Thread(() =>
|
||||
{
|
||||
try { writer2 = File.AppendText(GetFilename(writerCfg.DestinationPath2, batch.EndTime)); }
|
||||
catch { };
|
||||
WriteRslts(batch, writerCfg.DestinationPath2);
|
||||
completed2 = true;
|
||||
});
|
||||
|
||||
if (writerCfg.Culture > Culture.system && writerCfg.Culture < Culture.Count)
|
||||
{
|
||||
thread1.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
thread2.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -168,16 +166,57 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
completed1 = false;
|
||||
completed2 = false;
|
||||
abort = false;
|
||||
thread1.Start();
|
||||
thread2.Start();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (completed1 && completed2)
|
||||
return Event.ResultsWritten;
|
||||
else
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (!completed1 || !completed2) abort = true;
|
||||
}
|
||||
|
||||
|
||||
void WriteRslts(Results.Entities.Batch batch, string destination)
|
||||
{
|
||||
if (batch == null || batch.WaterMeters == null || batch.WaterMeters.Count <= 0) return;
|
||||
if (rsltItems == null || rsltItems.Count == 0) return;
|
||||
|
||||
StreamWriter writer = StreamWriter.Null;
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
writer = File.AppendText(GetFilename(writerCfg.DestinationPath, batch.EndTime));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (!writerCfg.SaveGoodOnly || wm.Passed)
|
||||
{
|
||||
if (writer != null) WriteWM(writer, wm);
|
||||
if (writer2 != null) WriteWM(writer2, wm);
|
||||
WriteWM(writer, wm);
|
||||
if (abort) return;
|
||||
}
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -188,6 +227,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
{
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
if (abort) return;
|
||||
|
||||
wr.Write(rsltItems[i].Print(wm));
|
||||
|
||||
if (i < rsltItems.Count - 1)
|
||||
@@ -200,22 +241,5 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (writer != null) writer.Close();
|
||||
writer = null;
|
||||
|
||||
if (writer2 != null) writer2.Close();
|
||||
writer2 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
public MonthFolders MonthFolders;
|
||||
public DayFolders DayFolders;
|
||||
public string FileNameFormat;
|
||||
public Separator Separator;
|
||||
public Culture Culture;
|
||||
public Separator Separator;
|
||||
public bool SaveGoodOnly;
|
||||
public string[] SelectedItems;
|
||||
|
||||
|
||||
@@ -38,15 +38,11 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
for (YearFolders s = 0; s < YearFolders.Count; s++) yearFoldersComboBox.Items.Add(s.ToString());
|
||||
for (MonthFolders s = 0; s < MonthFolders.Count; s++) monthFoldersComboBox.Items.Add(s.ToString());
|
||||
for (DayFolders s = 0; s < DayFolders.Count; s++) dayFoldersComboBox.Items.Add(s.ToString());
|
||||
|
||||
for (int i = 0; i < (int)Separator.Count; i++)
|
||||
{
|
||||
separatorComboBox.Items.Add(((Separator)i).ToString());
|
||||
}
|
||||
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
|
||||
selectedItems = config.SelectedItems;
|
||||
|
||||
@@ -68,7 +64,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
monthFoldersComboBox.Text = config.MonthFolders.ToString();
|
||||
dayFoldersComboBox.Text = config.DayFolders.ToString();
|
||||
fileNameFmtTextBox.Text = config.FileNameFormat;
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
cultureComboBox.Text = config.Culture.ToString();
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
goodOnlyCheckBox.Checked = config.SaveGoodOnly;
|
||||
}
|
||||
|
||||
@@ -83,7 +80,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
monthFoldersComboBox.Enabled = true;
|
||||
dayFoldersComboBox.Enabled = true;
|
||||
fileNameFmtTextBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
cultureComboBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
goodOnlyCheckBox.Enabled = true;
|
||||
selectItemsButton.Enabled = true;
|
||||
}
|
||||
@@ -110,6 +108,12 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
message += Environment.NewLine + "Invalid day folder selection";
|
||||
}
|
||||
|
||||
if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid culture";
|
||||
}
|
||||
|
||||
if (!separatorComboBox.Items.Contains(separatorComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
@@ -176,6 +180,16 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
flags = CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
for (Culture i = 0; i < Culture.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
|
||||
{
|
||||
config.Culture = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Separator i = 0; i < Separator.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(separatorComboBox.Text) && (config.Separator != i))
|
||||
|
||||
+32
-8
@@ -52,6 +52,8 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
this.fileNameFmtTextBox = new System.Windows.Forms.TextBox();
|
||||
this.fileNameFmtLabel = new System.Windows.Forms.Label();
|
||||
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.cultureComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.cultureLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
@@ -111,25 +113,25 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
// separatorLabel
|
||||
//
|
||||
this.separatorLabel.AutoSize = true;
|
||||
this.separatorLabel.Location = new System.Drawing.Point(17, 184);
|
||||
this.separatorLabel.Location = new System.Drawing.Point(17, 206);
|
||||
this.separatorLabel.Name = "separatorLabel";
|
||||
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.separatorLabel.TabIndex = 15;
|
||||
this.separatorLabel.TabIndex = 17;
|
||||
this.separatorLabel.Text = "Separator";
|
||||
//
|
||||
// separatorComboBox
|
||||
//
|
||||
this.separatorComboBox.Enabled = false;
|
||||
this.separatorComboBox.FormattingEnabled = true;
|
||||
this.separatorComboBox.Location = new System.Drawing.Point(108, 181);
|
||||
this.separatorComboBox.Location = new System.Drawing.Point(108, 203);
|
||||
this.separatorComboBox.Name = "separatorComboBox";
|
||||
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.separatorComboBox.TabIndex = 16;
|
||||
this.separatorComboBox.TabIndex = 18;
|
||||
//
|
||||
// selectItemsButton
|
||||
//
|
||||
this.selectItemsButton.Enabled = false;
|
||||
this.selectItemsButton.Location = new System.Drawing.Point(108, 203);
|
||||
this.selectItemsButton.Location = new System.Drawing.Point(108, 225);
|
||||
this.selectItemsButton.Name = "selectItemsButton";
|
||||
this.selectItemsButton.Size = new System.Drawing.Size(145, 23);
|
||||
this.selectItemsButton.TabIndex = 20;
|
||||
@@ -238,17 +240,37 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
// goodOnlyCheckBox
|
||||
//
|
||||
this.goodOnlyCheckBox.AutoSize = true;
|
||||
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 207);
|
||||
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 229);
|
||||
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
|
||||
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
|
||||
this.goodOnlyCheckBox.TabIndex = 17;
|
||||
this.goodOnlyCheckBox.TabIndex = 19;
|
||||
this.goodOnlyCheckBox.Text = "Good only";
|
||||
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cultureComboBox
|
||||
//
|
||||
this.cultureComboBox.Enabled = false;
|
||||
this.cultureComboBox.FormattingEnabled = true;
|
||||
this.cultureComboBox.Location = new System.Drawing.Point(108, 181);
|
||||
this.cultureComboBox.Name = "cultureComboBox";
|
||||
this.cultureComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.cultureComboBox.TabIndex = 16;
|
||||
//
|
||||
// cultureLabel
|
||||
//
|
||||
this.cultureLabel.AutoSize = true;
|
||||
this.cultureLabel.Location = new System.Drawing.Point(17, 184);
|
||||
this.cultureLabel.Name = "cultureLabel";
|
||||
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
|
||||
this.cultureLabel.TabIndex = 15;
|
||||
this.cultureLabel.Text = "Cullture";
|
||||
//
|
||||
// WriterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.cultureComboBox);
|
||||
this.Controls.Add(this.cultureLabel);
|
||||
this.Controls.Add(this.goodOnlyCheckBox);
|
||||
this.Controls.Add(this.fileNameFmtTextBox);
|
||||
this.Controls.Add(this.fileNameFmtLabel);
|
||||
@@ -271,7 +293,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "WriterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 230);
|
||||
this.Size = new System.Drawing.Size(300, 282);
|
||||
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@@ -301,5 +323,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
|
||||
private System.Windows.Forms.TextBox fileNameFmtTextBox;
|
||||
private System.Windows.Forms.Label fileNameFmtLabel;
|
||||
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
|
||||
private System.Windows.Forms.ComboBox cultureComboBox;
|
||||
private System.Windows.Forms.Label cultureLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
@@ -24,18 +26,16 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
string footer;
|
||||
IList<Results.WMeterRsltItemSpec> commonItems;
|
||||
IList<Results.WMeterRsltItemSpec> testItems;
|
||||
|
||||
///
|
||||
/// Results to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
string footer;
|
||||
|
||||
|
||||
StreamWriter writer;
|
||||
StreamWriter writer2;
|
||||
Thread thread1; /// Thread where one file is saved
|
||||
Thread thread2; /// Thread where another file is saved
|
||||
bool completed1; /// Set to 'true' by the first thread when writing to the file completed
|
||||
bool completed2; /// Set to 'true' by the second thread when writing to the file completed
|
||||
bool abort; /// Set to 'true' by Stop() operation to abort writing to the file
|
||||
|
||||
|
||||
public Writer() {}
|
||||
@@ -54,11 +54,11 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
switch (writerCfg.Separator)
|
||||
{
|
||||
default:
|
||||
case Separator.None: separatorStr = string.Empty; break;
|
||||
case Separator.Space: separatorStr = " "; break;
|
||||
case Separator.Tabulator: separatorStr = "\t"; break;
|
||||
case Separator.Comma: separatorStr = ","; break;
|
||||
case Separator.Semicolon: separatorStr = ";"; break;
|
||||
case Separator.None: separatorStr = string.Empty; break;
|
||||
case Separator.Space: separatorStr = " "; break;
|
||||
case Separator.Tabulator: separatorStr = "\t"; break;
|
||||
case Separator.Comma: separatorStr = ","; break;
|
||||
case Separator.Semicolon: separatorStr = ";"; break;
|
||||
}
|
||||
|
||||
header = string.IsNullOrEmpty(writerCfg.Header) ? string.Empty : writerCfg.Header.Replace("~", Environment.NewLine);
|
||||
@@ -94,8 +94,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
writerCfg.MonthFolders = newCfg.MonthFolders;
|
||||
writerCfg.DayFolders = newCfg.DayFolders;
|
||||
writerCfg.FileNameFormat = newCfg.FileNameFormat;
|
||||
writerCfg.Separator = newCfg.Separator;
|
||||
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
|
||||
writerCfg.Culture = newCfg.Culture;
|
||||
writerCfg.Separator = newCfg.Separator;
|
||||
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
|
||||
writerCfg.CommonItems = newCfg.CommonItems;
|
||||
writerCfg.SelectedItems = newCfg.SelectedItems;
|
||||
writerCfg.Header = newCfg.Header;
|
||||
@@ -199,55 +200,89 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
|
||||
/// Writes the test cycle results into a file
|
||||
/// Events:
|
||||
/// Event.ResultsWritten
|
||||
/// Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to write into the file</param>
|
||||
/// <param name="batch">Results to write into a file</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batchResults)
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batch)
|
||||
{
|
||||
this.batch = batchResults;
|
||||
thread1 = new Thread(() =>
|
||||
{
|
||||
WriteRslts(batch, writerCfg.DestinationPath);
|
||||
completed1 = true;
|
||||
});
|
||||
|
||||
if (batch.WaterMeters.Count <= 0)
|
||||
{
|
||||
writer = null;
|
||||
writer2 = null;
|
||||
return this;
|
||||
}
|
||||
thread2 = new Thread(() =>
|
||||
{
|
||||
WriteRslts(batch, writerCfg.DestinationPath2);
|
||||
completed2 = true;
|
||||
});
|
||||
|
||||
writer = null;
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath))
|
||||
if (writerCfg.Culture > Culture.system && writerCfg.Culture < Culture.Count)
|
||||
{
|
||||
try { writer = File.AppendText(GetFilename(writerCfg.DestinationPath, batch.EndTime)); }
|
||||
catch { };
|
||||
thread1.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
thread2.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
}
|
||||
|
||||
writer2 = null;
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath2))
|
||||
{
|
||||
try { writer2 = File.AppendText(GetFilename(writerCfg.DestinationPath2, batch.EndTime)); }
|
||||
catch { };
|
||||
}
|
||||
|
||||
return this;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (writer != null) WriteRslts(writer);
|
||||
if (writer2 != null) WriteRslts(writer2);
|
||||
completed1 = false;
|
||||
completed2 = false;
|
||||
abort = false;
|
||||
thread1.Start();
|
||||
thread2.Start();
|
||||
}
|
||||
|
||||
void WriteRslts(StreamWriter wr)
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (completed1 && completed2)
|
||||
return Event.ResultsWritten;
|
||||
else
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (!completed1 || !completed2) abort = true;
|
||||
}
|
||||
|
||||
|
||||
void WriteRslts(Results.Entities.Batch batch, string destination)
|
||||
{
|
||||
StreamWriter writer;
|
||||
try
|
||||
{
|
||||
writer = File.AppendText(GetFilename(destination, batch.EndTime));
|
||||
}
|
||||
catch
|
||||
{
|
||||
writer = StreamWriter.Null;
|
||||
}
|
||||
WriteRslts2(batch, writer);
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
|
||||
void WriteRslts2(Results.Entities.Batch batch, StreamWriter wrtr)
|
||||
{
|
||||
///----------
|
||||
/// Header
|
||||
///----------
|
||||
if (!string.IsNullOrEmpty(writerCfg.Header)) wr.Write(header);
|
||||
wr.WriteLine(batch.ProtocolTitle);
|
||||
wr.WriteLine(string.Empty);
|
||||
if (!string.IsNullOrEmpty(writerCfg.Header)) wrtr.Write(header);
|
||||
wrtr.WriteLine(batch.ProtocolTitle);
|
||||
wrtr.WriteLine(string.Empty);
|
||||
|
||||
///----------------
|
||||
/// Common items
|
||||
@@ -259,7 +294,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
foreach (var v in commonItems)
|
||||
{
|
||||
leftColumn[cnt] = v.Caption;
|
||||
rightColumn[cnt] = v.Print(batch.WaterMeters[0]);
|
||||
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
@@ -270,27 +305,33 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
wr.Write(leftColumn[i]);
|
||||
wr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
|
||||
wr.WriteLine(rightColumn[i]);
|
||||
if (abort) return;
|
||||
|
||||
wrtr.Write(leftColumn[i]);
|
||||
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
|
||||
wrtr.WriteLine(rightColumn[i]);
|
||||
}
|
||||
|
||||
///--------
|
||||
/// Body
|
||||
///--------
|
||||
foreach (var wm in batch.WaterMeters) WriteWM(wr, wm);
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
WriteWM(wrtr, wm);
|
||||
if (abort) return;
|
||||
}
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
if (!string.IsNullOrEmpty(writerCfg.Footer)) wr.Write(footer);
|
||||
if (!string.IsNullOrEmpty(writerCfg.Footer)) wrtr.Write(footer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wmNr">Water meter number (0-based)</param>
|
||||
void WriteWM(StreamWriter wr, Results.Entities.WaterMeter wm)
|
||||
void WriteWM(StreamWriter wr, Results.Entities.WaterMeter wm)
|
||||
{
|
||||
wr.WriteLine(string.Empty);
|
||||
|
||||
@@ -298,15 +339,24 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
#if BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
|
||||
wr.Write(string.Format("Water meter {0} s/n: {1}", wm.WMPosition, wm.SerialNr));
|
||||
#else
|
||||
wr.Write(string.Format(Strings.Water_Meter_nr, wm.WMPosition));
|
||||
wr.Write(string.Format(Strings.Water_Meter_nr, wm.WMPosition));
|
||||
if (!wm.Compound())
|
||||
{
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr)) wr.Write(string.Format(", {0} {1}", Strings.SerialNr, wm.SerialNr));
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
wr.Write(string.Format(", {0} {1}", Strings.SerialNr, wm.SerialNr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr)) wr.Write(string.Format(", {0} {1}", Strings.Main_WM_SerialNr, wm.SerialNr));
|
||||
if (!string.IsNullOrEmpty(wm.SerialNrAux)) wr.Write(string.Format(", {0} {1}", Strings.Aux_WM_SerialNr, wm.SerialNrAux));
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
wr.Write(string.Format(", {0} {1}", Strings.Main_WM_SerialNr, wm.SerialNr));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(wm.SerialNrAux))
|
||||
{
|
||||
wr.Write(string.Format(", {0} {1}", Strings.Aux_WM_SerialNr, wm.SerialNrAux));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
wr.WriteLine(string.Empty);
|
||||
@@ -316,7 +366,9 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
int totalWidth = 0;
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
columnWidths[i] = ElSpaces(testItems[i].Caption).Length;
|
||||
if (abort) return;
|
||||
|
||||
columnWidths[i] = ElSpaces(testItems[i].Caption).Length;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
@@ -335,37 +387,41 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
}
|
||||
totalWidth += 3 * (testItems.Count - 1);
|
||||
if (totalWidth < 0) totalWidth = 0;
|
||||
|
||||
wr.WriteLine(new String('-', totalWidth)); /// Horizontal line above the header
|
||||
|
||||
string horizontalLine = new String('-', totalWidth);
|
||||
|
||||
wr.WriteLine(horizontalLine); /// Horizontal line above the header
|
||||
|
||||
/// Write column headers
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
wr.Write(ElSpaces(testItems[i].Caption));
|
||||
if (abort) return;
|
||||
|
||||
string caption = ElSpaces(testItems[i].Caption);
|
||||
wr.Write(caption);
|
||||
|
||||
if (i < testItems.Count - 1)
|
||||
{
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
wr.Write(new string(' ', columnWidths[i] - testItems[i].Caption.Length + 3));
|
||||
}
|
||||
}
|
||||
wr.Write(separatorStr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wr.WriteLine(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wr.WriteLine(new String('-', totalWidth)); /// Horizontal line between the header and the body
|
||||
|
||||
wr.WriteLine(horizontalLine); /// Horizontal line between the header and the body
|
||||
|
||||
/// Write table data
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
if (abort) return;
|
||||
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
{
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
@@ -377,41 +433,26 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
/// Print the item
|
||||
wr.Write(ElSpaces(itemText));
|
||||
string itemText2 = ElSpaces(itemText);
|
||||
wr.Write(itemText2);
|
||||
|
||||
if (i < testItems.Count - 1)
|
||||
{
|
||||
if (!writerCfg.EliminateSpaces)
|
||||
{
|
||||
wr.Write(new string(' ', columnWidths[i] - itemText.Length + 3));
|
||||
}
|
||||
}
|
||||
wr.Write(separatorStr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wr.WriteLine(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wr.WriteLine(new String('-', totalWidth)); /// Horizontal line below the body
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (writer != null) writer.Close();
|
||||
if (writer2 != null) writer2.Close();
|
||||
}
|
||||
wr.WriteLine(horizontalLine); /// Horizontal line below the body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
public MonthFolders MonthFolders;
|
||||
public DayFolders DayFolders;
|
||||
public string FileNameFormat;
|
||||
public Culture Culture;
|
||||
public Separator Separator;
|
||||
public bool EliminateSpaces;
|
||||
public string[] CommonItems;
|
||||
|
||||
@@ -42,15 +42,11 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
for (YearFolders s = 0; s < YearFolders.Count; s++) yearFoldersComboBox.Items.Add(s.ToString());
|
||||
for (MonthFolders s = 0; s < MonthFolders.Count; s++) monthFoldersComboBox.Items.Add(s.ToString());
|
||||
for (DayFolders s = 0; s < DayFolders.Count; s++) dayFoldersComboBox.Items.Add(s.ToString());
|
||||
|
||||
for (int i = 0; i < (int)Separator.Count; i++)
|
||||
{
|
||||
separatorComboBox.Items.Add(((Separator)i).ToString());
|
||||
}
|
||||
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
|
||||
header = config.Header;
|
||||
commonItems = config.CommonItems;
|
||||
@@ -69,6 +65,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
monthFoldersLabel.Text = "Month folders";
|
||||
dayFoldersLabel.Text = "Day folders";
|
||||
fileNameFmtLabel.Text = "File name format";
|
||||
cultureLabel.Text = "Culture";
|
||||
separatorLabel.Text = "Separator";
|
||||
eliminateSpacesCheckBox.Text = "No spaces";
|
||||
headerButton.Text = Strings.Header;
|
||||
@@ -93,7 +90,8 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
monthFoldersComboBox.Text = config.MonthFolders.ToString();
|
||||
dayFoldersComboBox.Text = config.DayFolders.ToString();
|
||||
fileNameFmtTextBox.Text = config.FileNameFormat;
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
cultureComboBox.Text = config.Culture.ToString();
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
|
||||
}
|
||||
|
||||
@@ -108,7 +106,8 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
monthFoldersComboBox.Enabled = true;
|
||||
dayFoldersComboBox.Enabled = true;
|
||||
fileNameFmtTextBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
cultureComboBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
eliminateSpacesCheckBox.Enabled = true;
|
||||
headerButton.Enabled = true;
|
||||
commonItemsButton.Enabled = true;
|
||||
@@ -138,6 +137,12 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
message += Environment.NewLine + "Invalid day folder selection";
|
||||
}
|
||||
|
||||
if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid culture";
|
||||
}
|
||||
|
||||
if (!separatorComboBox.Items.Contains(separatorComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
@@ -208,6 +213,15 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
for (Culture i = 0; i < Culture.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
|
||||
{
|
||||
config.Culture = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Separator i = 0; i < Separator.Count; i++)
|
||||
{
|
||||
|
||||
+57
-33
@@ -56,12 +56,14 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
this.footerButton = new System.Windows.Forms.Button();
|
||||
this.commonItemsButton = new System.Windows.Forms.Button();
|
||||
this.upgradeWizardButton = new System.Windows.Forms.Button();
|
||||
this.cultureComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.cultureLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(108, 31);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(108, 28);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
@@ -69,7 +71,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(17, 34);
|
||||
this.nameLabel.Location = new System.Drawing.Point(17, 31);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
@@ -78,7 +80,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(105, 9);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(105, 6);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
@@ -87,7 +89,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destinationTextBox
|
||||
//
|
||||
this.destinationTextBox.Enabled = false;
|
||||
this.destinationTextBox.Location = new System.Drawing.Point(108, 52);
|
||||
this.destinationTextBox.Location = new System.Drawing.Point(108, 49);
|
||||
this.destinationTextBox.Name = "destinationTextBox";
|
||||
this.destinationTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.destinationTextBox.TabIndex = 4;
|
||||
@@ -95,7 +97,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destinationLabel
|
||||
//
|
||||
this.destinationLabel.AutoSize = true;
|
||||
this.destinationLabel.Location = new System.Drawing.Point(17, 55);
|
||||
this.destinationLabel.Location = new System.Drawing.Point(17, 52);
|
||||
this.destinationLabel.Name = "destinationLabel";
|
||||
this.destinationLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.destinationLabel.TabIndex = 3;
|
||||
@@ -104,7 +106,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destinationButton
|
||||
//
|
||||
this.destinationButton.Enabled = false;
|
||||
this.destinationButton.Location = new System.Drawing.Point(269, 52);
|
||||
this.destinationButton.Location = new System.Drawing.Point(269, 49);
|
||||
this.destinationButton.Name = "destinationButton";
|
||||
this.destinationButton.Size = new System.Drawing.Size(30, 20);
|
||||
this.destinationButton.TabIndex = 5;
|
||||
@@ -115,28 +117,28 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// separatorLabel
|
||||
//
|
||||
this.separatorLabel.AutoSize = true;
|
||||
this.separatorLabel.Location = new System.Drawing.Point(17, 184);
|
||||
this.separatorLabel.Location = new System.Drawing.Point(17, 203);
|
||||
this.separatorLabel.Name = "separatorLabel";
|
||||
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.separatorLabel.TabIndex = 17;
|
||||
this.separatorLabel.TabIndex = 19;
|
||||
this.separatorLabel.Text = "Separator";
|
||||
//
|
||||
// separatorComboBox
|
||||
//
|
||||
this.separatorComboBox.Enabled = false;
|
||||
this.separatorComboBox.FormattingEnabled = true;
|
||||
this.separatorComboBox.Location = new System.Drawing.Point(108, 181);
|
||||
this.separatorComboBox.Location = new System.Drawing.Point(108, 200);
|
||||
this.separatorComboBox.Name = "separatorComboBox";
|
||||
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.separatorComboBox.TabIndex = 18;
|
||||
this.separatorComboBox.TabIndex = 20;
|
||||
//
|
||||
// testItemsButton
|
||||
//
|
||||
this.testItemsButton.Enabled = false;
|
||||
this.testItemsButton.Location = new System.Drawing.Point(108, 278);
|
||||
this.testItemsButton.Location = new System.Drawing.Point(108, 297);
|
||||
this.testItemsButton.Name = "testItemsButton";
|
||||
this.testItemsButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.testItemsButton.TabIndex = 22;
|
||||
this.testItemsButton.TabIndex = 24;
|
||||
this.testItemsButton.Text = "Test items";
|
||||
this.testItemsButton.UseVisualStyleBackColor = true;
|
||||
this.testItemsButton.Click += new System.EventHandler(this.testItemsButton_Click);
|
||||
@@ -144,7 +146,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// yearFoldersLabel
|
||||
//
|
||||
this.yearFoldersLabel.AutoSize = true;
|
||||
this.yearFoldersLabel.Location = new System.Drawing.Point(17, 97);
|
||||
this.yearFoldersLabel.Location = new System.Drawing.Point(17, 94);
|
||||
this.yearFoldersLabel.Name = "yearFoldersLabel";
|
||||
this.yearFoldersLabel.Size = new System.Drawing.Size(63, 13);
|
||||
this.yearFoldersLabel.TabIndex = 9;
|
||||
@@ -153,7 +155,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// monthFoldersLabel
|
||||
//
|
||||
this.monthFoldersLabel.AutoSize = true;
|
||||
this.monthFoldersLabel.Location = new System.Drawing.Point(17, 119);
|
||||
this.monthFoldersLabel.Location = new System.Drawing.Point(17, 116);
|
||||
this.monthFoldersLabel.Name = "monthFoldersLabel";
|
||||
this.monthFoldersLabel.Size = new System.Drawing.Size(71, 13);
|
||||
this.monthFoldersLabel.TabIndex = 11;
|
||||
@@ -162,7 +164,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// dayFoldersLabel
|
||||
//
|
||||
this.dayFoldersLabel.AutoSize = true;
|
||||
this.dayFoldersLabel.Location = new System.Drawing.Point(17, 141);
|
||||
this.dayFoldersLabel.Location = new System.Drawing.Point(17, 138);
|
||||
this.dayFoldersLabel.Name = "dayFoldersLabel";
|
||||
this.dayFoldersLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.dayFoldersLabel.TabIndex = 13;
|
||||
@@ -172,7 +174,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
//
|
||||
this.yearFoldersComboBox.Enabled = false;
|
||||
this.yearFoldersComboBox.FormattingEnabled = true;
|
||||
this.yearFoldersComboBox.Location = new System.Drawing.Point(108, 94);
|
||||
this.yearFoldersComboBox.Location = new System.Drawing.Point(108, 91);
|
||||
this.yearFoldersComboBox.Name = "yearFoldersComboBox";
|
||||
this.yearFoldersComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.yearFoldersComboBox.TabIndex = 10;
|
||||
@@ -181,7 +183,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
//
|
||||
this.monthFoldersComboBox.Enabled = false;
|
||||
this.monthFoldersComboBox.FormattingEnabled = true;
|
||||
this.monthFoldersComboBox.Location = new System.Drawing.Point(108, 116);
|
||||
this.monthFoldersComboBox.Location = new System.Drawing.Point(108, 113);
|
||||
this.monthFoldersComboBox.Name = "monthFoldersComboBox";
|
||||
this.monthFoldersComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.monthFoldersComboBox.TabIndex = 12;
|
||||
@@ -190,7 +192,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
//
|
||||
this.dayFoldersComboBox.Enabled = false;
|
||||
this.dayFoldersComboBox.FormattingEnabled = true;
|
||||
this.dayFoldersComboBox.Location = new System.Drawing.Point(108, 138);
|
||||
this.dayFoldersComboBox.Location = new System.Drawing.Point(108, 135);
|
||||
this.dayFoldersComboBox.Name = "dayFoldersComboBox";
|
||||
this.dayFoldersComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.dayFoldersComboBox.TabIndex = 14;
|
||||
@@ -198,7 +200,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destination2Button
|
||||
//
|
||||
this.destination2Button.Enabled = false;
|
||||
this.destination2Button.Location = new System.Drawing.Point(269, 73);
|
||||
this.destination2Button.Location = new System.Drawing.Point(269, 70);
|
||||
this.destination2Button.Name = "destination2Button";
|
||||
this.destination2Button.Size = new System.Drawing.Size(30, 20);
|
||||
this.destination2Button.TabIndex = 8;
|
||||
@@ -208,7 +210,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destination2TextBox
|
||||
//
|
||||
this.destination2TextBox.Enabled = false;
|
||||
this.destination2TextBox.Location = new System.Drawing.Point(108, 73);
|
||||
this.destination2TextBox.Location = new System.Drawing.Point(108, 70);
|
||||
this.destination2TextBox.Name = "destination2TextBox";
|
||||
this.destination2TextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.destination2TextBox.TabIndex = 7;
|
||||
@@ -216,7 +218,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// destination2Label
|
||||
//
|
||||
this.destination2Label.AutoSize = true;
|
||||
this.destination2Label.Location = new System.Drawing.Point(17, 76);
|
||||
this.destination2Label.Location = new System.Drawing.Point(17, 73);
|
||||
this.destination2Label.Name = "destination2Label";
|
||||
this.destination2Label.Size = new System.Drawing.Size(69, 13);
|
||||
this.destination2Label.TabIndex = 6;
|
||||
@@ -225,7 +227,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// fileNameFmtTextBox
|
||||
//
|
||||
this.fileNameFmtTextBox.Enabled = false;
|
||||
this.fileNameFmtTextBox.Location = new System.Drawing.Point(108, 160);
|
||||
this.fileNameFmtTextBox.Location = new System.Drawing.Point(108, 157);
|
||||
this.fileNameFmtTextBox.Name = "fileNameFmtTextBox";
|
||||
this.fileNameFmtTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.fileNameFmtTextBox.TabIndex = 16;
|
||||
@@ -233,7 +235,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// fileNameFmtLabel
|
||||
//
|
||||
this.fileNameFmtLabel.AutoSize = true;
|
||||
this.fileNameFmtLabel.Location = new System.Drawing.Point(17, 163);
|
||||
this.fileNameFmtLabel.Location = new System.Drawing.Point(17, 160);
|
||||
this.fileNameFmtLabel.Name = "fileNameFmtLabel";
|
||||
this.fileNameFmtLabel.Size = new System.Drawing.Size(84, 13);
|
||||
this.fileNameFmtLabel.TabIndex = 15;
|
||||
@@ -242,20 +244,20 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// eliminateSpacesCheckBox
|
||||
//
|
||||
this.eliminateSpacesCheckBox.AutoSize = true;
|
||||
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(108, 208);
|
||||
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(108, 227);
|
||||
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
|
||||
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(77, 17);
|
||||
this.eliminateSpacesCheckBox.TabIndex = 19;
|
||||
this.eliminateSpacesCheckBox.TabIndex = 21;
|
||||
this.eliminateSpacesCheckBox.Text = "No spaces";
|
||||
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// headerButton
|
||||
//
|
||||
this.headerButton.Enabled = false;
|
||||
this.headerButton.Location = new System.Drawing.Point(108, 228);
|
||||
this.headerButton.Location = new System.Drawing.Point(108, 247);
|
||||
this.headerButton.Name = "headerButton";
|
||||
this.headerButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.headerButton.TabIndex = 20;
|
||||
this.headerButton.TabIndex = 22;
|
||||
this.headerButton.Text = "Header";
|
||||
this.headerButton.UseVisualStyleBackColor = true;
|
||||
this.headerButton.Click += new System.EventHandler(this.headerButton_Click);
|
||||
@@ -263,10 +265,10 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// footerButton
|
||||
//
|
||||
this.footerButton.Enabled = false;
|
||||
this.footerButton.Location = new System.Drawing.Point(108, 303);
|
||||
this.footerButton.Location = new System.Drawing.Point(108, 322);
|
||||
this.footerButton.Name = "footerButton";
|
||||
this.footerButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.footerButton.TabIndex = 23;
|
||||
this.footerButton.TabIndex = 25;
|
||||
this.footerButton.Text = "Footer";
|
||||
this.footerButton.UseVisualStyleBackColor = true;
|
||||
this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
|
||||
@@ -274,28 +276,48 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
// commonItemsButton
|
||||
//
|
||||
this.commonItemsButton.Enabled = false;
|
||||
this.commonItemsButton.Location = new System.Drawing.Point(108, 253);
|
||||
this.commonItemsButton.Location = new System.Drawing.Point(108, 272);
|
||||
this.commonItemsButton.Name = "commonItemsButton";
|
||||
this.commonItemsButton.Size = new System.Drawing.Size(146, 23);
|
||||
this.commonItemsButton.TabIndex = 21;
|
||||
this.commonItemsButton.TabIndex = 23;
|
||||
this.commonItemsButton.Text = "Common items";
|
||||
this.commonItemsButton.UseVisualStyleBackColor = true;
|
||||
this.commonItemsButton.Click += new System.EventHandler(this.commonItemsButton_Click);
|
||||
//
|
||||
// upgradeWizardButton
|
||||
//
|
||||
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 253);
|
||||
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 272);
|
||||
this.upgradeWizardButton.Name = "upgradeWizardButton";
|
||||
this.upgradeWizardButton.Size = new System.Drawing.Size(80, 48);
|
||||
this.upgradeWizardButton.TabIndex = 24;
|
||||
this.upgradeWizardButton.TabIndex = 26;
|
||||
this.upgradeWizardButton.Text = "Upgrade wizard";
|
||||
this.upgradeWizardButton.UseVisualStyleBackColor = true;
|
||||
this.upgradeWizardButton.Click += new System.EventHandler(this.upgradeWizardButton_Click);
|
||||
//
|
||||
// cultureComboBox
|
||||
//
|
||||
this.cultureComboBox.Enabled = false;
|
||||
this.cultureComboBox.FormattingEnabled = true;
|
||||
this.cultureComboBox.Location = new System.Drawing.Point(108, 178);
|
||||
this.cultureComboBox.Name = "cultureComboBox";
|
||||
this.cultureComboBox.Size = new System.Drawing.Size(146, 21);
|
||||
this.cultureComboBox.TabIndex = 18;
|
||||
//
|
||||
// cultureLabel
|
||||
//
|
||||
this.cultureLabel.AutoSize = true;
|
||||
this.cultureLabel.Location = new System.Drawing.Point(17, 181);
|
||||
this.cultureLabel.Name = "cultureLabel";
|
||||
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
|
||||
this.cultureLabel.TabIndex = 17;
|
||||
this.cultureLabel.Text = "Cullture";
|
||||
//
|
||||
// WriterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.cultureComboBox);
|
||||
this.Controls.Add(this.cultureLabel);
|
||||
this.Controls.Add(this.upgradeWizardButton);
|
||||
this.Controls.Add(this.commonItemsButton);
|
||||
this.Controls.Add(this.footerButton);
|
||||
@@ -356,5 +378,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
private System.Windows.Forms.Button footerButton;
|
||||
private System.Windows.Forms.Button commonItemsButton;
|
||||
private System.Windows.Forms.Button upgradeWizardButton;
|
||||
private System.Windows.Forms.ComboBox cultureComboBox;
|
||||
private System.Windows.Forms.Label cultureLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,4 +37,13 @@ namespace TBF.BenchControl.Output.FileWriters
|
||||
Semicolon,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum Culture
|
||||
{
|
||||
system,
|
||||
EN,
|
||||
DE,
|
||||
SK,
|
||||
Count
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
@@ -24,15 +26,17 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
IList<Results.WMeterRsltItemSpec> commonItems1;
|
||||
string rootTag;
|
||||
string testTag;
|
||||
IList<Results.WMeterRsltItemSpec> commonItems;
|
||||
IList<Results.WMeterRsltItemSpec> testItems;
|
||||
IList<Results.WMeterRsltItemSpec> commonItems2;
|
||||
string footer;
|
||||
|
||||
///
|
||||
/// Results to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
Thread thread1; /// Thread where one file is saved
|
||||
Thread thread2; /// Thread where another file is saved
|
||||
bool completed1; /// Set to 'true' by the first thread when writing to the file completed
|
||||
bool completed2; /// Set to 'true' by the second thread when writing to the file completed
|
||||
bool abort; /// Set to 'true' by Stop() operation to abort writing to the file
|
||||
|
||||
|
||||
public Writer() {}
|
||||
@@ -48,21 +52,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
|
||||
void ApplyConfig()
|
||||
{
|
||||
switch (writerCfg.Separator)
|
||||
{
|
||||
default:
|
||||
case Separator.None: separatorStr = string.Empty; break;
|
||||
case Separator.Space: separatorStr = " "; break;
|
||||
case Separator.Tabulator: separatorStr = "\t"; break;
|
||||
case Separator.Comma: separatorStr = ","; break;
|
||||
case Separator.Semicolon: separatorStr = ";"; break;
|
||||
}
|
||||
|
||||
/// TODO: Apply culture info
|
||||
rootTag = writerCfg.RootTag;
|
||||
testTag = writerCfg.RootTag;
|
||||
header = string.IsNullOrEmpty(writerCfg.Header) ? string.Empty : writerCfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems1 = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.CommonItems1);
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.SelectedItems); /// TestID info will be overwritten later on
|
||||
commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.CommonItems2);
|
||||
footer = string.IsNullOrEmpty(writerCfg.Footer) ? string.Empty : writerCfg.Footer.Replace("~", Environment.NewLine);
|
||||
commonItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.CommonItems);
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(writerCfg.TestItems); /// TestID info will be overwritten later on
|
||||
}
|
||||
|
||||
|
||||
@@ -92,12 +87,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
writerCfg.MonthFolders = newCfg.MonthFolders;
|
||||
writerCfg.DayFolders = newCfg.DayFolders;
|
||||
writerCfg.FileNameFormat = newCfg.FileNameFormat;
|
||||
writerCfg.Separator = newCfg.Separator;
|
||||
writerCfg.CommonItems1 = newCfg.CommonItems1;
|
||||
writerCfg.SelectedItems = newCfg.SelectedItems;
|
||||
writerCfg.CommonItems2 = newCfg.CommonItems2;
|
||||
writerCfg.Culture = newCfg.Culture;
|
||||
writerCfg.Header = newCfg.Header;
|
||||
writerCfg.Footer = newCfg.Footer;
|
||||
writerCfg.RootTag = newCfg.RootTag;
|
||||
writerCfg.TestTag = newCfg.TestTag;
|
||||
writerCfg.CommonItems = newCfg.CommonItems;
|
||||
writerCfg.TestItems = newCfg.TestItems;
|
||||
|
||||
ApplyConfig();
|
||||
}
|
||||
@@ -184,41 +179,81 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
|
||||
/// Writes the test cycle results into a file
|
||||
/// Events:
|
||||
/// Event.ResultsWritten
|
||||
/// Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="procedure">Procedure to print the results of</param>
|
||||
/// <param name="unsortedResults">Results to write into the file</param>
|
||||
/// <param name="batch">Results to write into files</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batchResults)
|
||||
public IOperation WriteResultsOp(Results.Entities.Batch batch)
|
||||
{
|
||||
this.batch = batchResults;
|
||||
return this;
|
||||
thread1 = new Thread(() =>
|
||||
{
|
||||
WriteRslts(batch, writerCfg.DestinationPath);
|
||||
completed1 = true;
|
||||
});
|
||||
|
||||
thread2 = new Thread(() =>
|
||||
{
|
||||
WriteRslts(batch, writerCfg.DestinationPath2);
|
||||
completed2 = true;
|
||||
});
|
||||
|
||||
if (writerCfg.Culture > Culture.system && writerCfg.Culture < Culture.Count)
|
||||
{
|
||||
thread1.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
thread2.CurrentCulture = new CultureInfo(writerCfg.Culture.ToString());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
IList<string> destPaths = new List<string>();
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath)) destPaths.Add(writerCfg.DestinationPath);
|
||||
if (!string.IsNullOrEmpty(writerCfg.DestinationPath2)) destPaths.Add(writerCfg.DestinationPath2);
|
||||
|
||||
foreach (var dest in destPaths)
|
||||
{
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
try
|
||||
{
|
||||
StreamWriter writer = File.AppendText(GetFilename(writerCfg.DestinationPath, batch.EndTime, wm.WMPosition));
|
||||
WriteWM(writer, wm);
|
||||
writer.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
completed1 = false;
|
||||
completed2 = false;
|
||||
abort = false;
|
||||
thread1.Start();
|
||||
thread2.Start();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (completed1 && completed2)
|
||||
return Event.ResultsWritten;
|
||||
else
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (!completed1 || !completed2) abort = true;
|
||||
}
|
||||
|
||||
|
||||
void WriteRslts(Results.Entities.Batch batch, string destination)
|
||||
{
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
try
|
||||
{
|
||||
StreamWriter writer = File.AppendText(GetFilename(destination, batch.EndTime, wm.WMPosition));
|
||||
WriteWM(writer, wm);
|
||||
writer.Close();
|
||||
if (abort) return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Write one water meter results
|
||||
/// </summary>
|
||||
@@ -227,11 +262,14 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
{
|
||||
/// Header
|
||||
if (!string.IsNullOrEmpty(writerCfg.Header)) wr.Write(header);
|
||||
wr.WriteLine(string.Format("<{0}>", rootTag));
|
||||
|
||||
/// Common items 1
|
||||
foreach (var v in commonItems1)
|
||||
foreach (var v in commonItems)
|
||||
{
|
||||
/// Fetch the item and strip color information
|
||||
if (abort) return;
|
||||
|
||||
/// Fetch the item and strip color information
|
||||
string itemText = v.Print(wm);
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
@@ -242,9 +280,11 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
/// Test items
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
if (abort) return;
|
||||
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
{
|
||||
wr.WriteLine(" <prueflauf>");
|
||||
wr.WriteLine(string.Format(" <{0}>", testTag));
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
/// Fetch the item and strip color information
|
||||
@@ -255,37 +295,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
/// Print the item
|
||||
wr.WriteLine(" <{0}>{1}</{0}>", testItems[i].Caption, itemText);
|
||||
}
|
||||
wr.WriteLine(" </prueflauf>");
|
||||
wr.WriteLine(string.Format(" </{0}>", testTag));
|
||||
}
|
||||
}
|
||||
|
||||
/// Common items 2
|
||||
foreach (var v in commonItems2)
|
||||
{
|
||||
/// Fetch the item and strip color information
|
||||
string itemText = v.Print(wm);
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
wr.WriteLine(" <{0}>{1}</{0}>", v.Caption, itemText);
|
||||
}
|
||||
|
||||
/// Footer
|
||||
if (!string.IsNullOrEmpty(writerCfg.Footer)) wr.Write(footer);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsWritten</returns>
|
||||
public Event Run()
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
wr.WriteLine(string.Format("</{0}>", rootTag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
public MonthFolders MonthFolders;
|
||||
public DayFolders DayFolders;
|
||||
public string FileNameFormat;
|
||||
public Separator Separator;
|
||||
public Culture Culture;
|
||||
public string Header;
|
||||
public string[] CommonItems1;
|
||||
public string[] SelectedItems;
|
||||
public string[] CommonItems2;
|
||||
public string Footer;
|
||||
public string RootTag;
|
||||
public string TestTag;
|
||||
public string[] CommonItems;
|
||||
public string[] TestItems;
|
||||
|
||||
[XmlIgnore]
|
||||
public Config.Entities.MetersKind MetersKind;
|
||||
@@ -47,23 +47,24 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
DestinationPath2 = string.Empty;
|
||||
YearFolders = YearFolders.FourDigit;
|
||||
MonthFolders = MonthFolders.Digit;
|
||||
DayFolders = DayFolders.Digit;
|
||||
DayFolders = DayFolders.Digit;
|
||||
FileNameFormat = "{0:yyMMdd-HHmm}-{2:D2}.xml";
|
||||
Separator = Separator.None;
|
||||
Header = string.Empty;
|
||||
Footer = string.Empty;
|
||||
Culture = Culture.EN;
|
||||
Header = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
RootTag = "gwzPruefung";
|
||||
TestTag = "prueflauf";
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Path={1}, Y={2}, M={3}, D={4}, FNameFmt={5}, Separator={6}",
|
||||
return string.Format("Name={0}, Path={1}, Y={2}, M={3}, D={4}, FNameFmt={5}, Culture={6}",
|
||||
Name,
|
||||
DestinationPath,
|
||||
YearFolders,
|
||||
MonthFolders,
|
||||
DayFolders,
|
||||
FileNameFormat,
|
||||
Separator);
|
||||
Culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,8 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
}
|
||||
|
||||
string header;
|
||||
string[] commonItems1;
|
||||
string[] commonItems;
|
||||
string[] testItems;
|
||||
string[] commonItems2;
|
||||
string footer;
|
||||
|
||||
public WriterCfgCtrl()
|
||||
{
|
||||
@@ -43,21 +41,14 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (Separator s = 0; s < Separator.Count; s++) separatorComboBox.Items.Add(s.ToString());
|
||||
for (YearFolders s = 0; s < YearFolders.Count; s++) yearFoldersComboBox.Items.Add(s.ToString());
|
||||
for (MonthFolders s = 0; s < MonthFolders.Count; s++) monthFoldersComboBox.Items.Add(s.ToString());
|
||||
for (DayFolders s = 0; s < DayFolders.Count; s++) dayFoldersComboBox.Items.Add(s.ToString());
|
||||
|
||||
for (int i = 0; i < (int)Separator.Count; i++)
|
||||
{
|
||||
separatorComboBox.Items.Add(((Separator)i).ToString());
|
||||
}
|
||||
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
|
||||
|
||||
header = config.Header;
|
||||
commonItems1 = config.CommonItems1;
|
||||
testItems = config.SelectedItems;
|
||||
commonItems2 = config.CommonItems2;
|
||||
footer = config.Footer;
|
||||
commonItems = config.CommonItems;
|
||||
testItems = config.TestItems;
|
||||
|
||||
Redraw();
|
||||
}
|
||||
@@ -71,12 +62,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
monthFoldersLabel.Text = "Month folders";
|
||||
dayFoldersLabel.Text = "Day folders";
|
||||
fileNameFmtLabel.Text = "File name format";
|
||||
separatorLabel.Text = "Separator";
|
||||
cultureLabel.Text = "Culture";
|
||||
headerButton.Text = Strings.Header;
|
||||
commonItemsButton1.Text = "Common items 1";
|
||||
testItemsButton.Text = "Test items";
|
||||
commonItemsButton2.Text = "Common items 2";
|
||||
footerButton.Text = Strings.Footer;
|
||||
rootTagLabel.Text = "Root tag";
|
||||
commonItemsButton.Text = "Common items";
|
||||
testTagLabel.Text = "Test tag";
|
||||
testItemsButton.Text = "Test items";
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
@@ -94,7 +85,9 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
monthFoldersComboBox.Text = config.MonthFolders.ToString();
|
||||
dayFoldersComboBox.Text = config.DayFolders.ToString();
|
||||
fileNameFmtTextBox.Text = config.FileNameFormat;
|
||||
separatorComboBox.Text = config.Separator.ToString();
|
||||
cultureComboBox.Text = config.Culture.ToString();
|
||||
rootTagTextBox.Text = config.RootTag;
|
||||
testTagTextBox.Text = config.TestTag;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -108,12 +101,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
monthFoldersComboBox.Enabled = true;
|
||||
dayFoldersComboBox.Enabled = true;
|
||||
fileNameFmtTextBox.Enabled = true;
|
||||
separatorComboBox.Enabled = true;
|
||||
cultureComboBox.Enabled = true;
|
||||
headerButton.Enabled = true;
|
||||
commonItemsButton1.Enabled = true;
|
||||
testItemsButton.Enabled = true;
|
||||
commonItemsButton2.Enabled = true;
|
||||
footerButton.Enabled = true;
|
||||
rootTagTextBox.Enabled = true;
|
||||
commonItemsButton.Enabled = true;
|
||||
testTagTextBox.Enabled = true;
|
||||
testItemsButton.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -138,11 +131,24 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
message += Environment.NewLine + "Invalid day folder selection";
|
||||
}
|
||||
|
||||
if (!separatorComboBox.Items.Contains(separatorComboBox.Text))
|
||||
if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid separator";
|
||||
message += Environment.NewLine + "Invalid culture";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(rootTagTextBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Root tag field is empty";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(testTagTextBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Test tag field is empty";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -208,48 +214,47 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
|
||||
for (Separator i = 0; i < Separator.Count; i++)
|
||||
for (Culture i = 0; i < Culture.Count; i++)
|
||||
{
|
||||
if (i.ToString().Equals(separatorComboBox.Text) && (config.Separator != i))
|
||||
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
|
||||
{
|
||||
config.Separator = i;
|
||||
config.Culture = i;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (config.Header != header)
|
||||
{
|
||||
config.Header = header;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.CommonItems1 != commonItems1)
|
||||
{
|
||||
config.CommonItems1 = commonItems1;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.SelectedItems != testItems)
|
||||
{
|
||||
config.SelectedItems = testItems;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.CommonItems2 != commonItems2)
|
||||
if (config.RootTag != rootTagTextBox.Text)
|
||||
{
|
||||
config.CommonItems2 = commonItems2;
|
||||
config.RootTag = rootTagTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.CommonItems != commonItems)
|
||||
{
|
||||
config.CommonItems = commonItems;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.Footer != footer)
|
||||
{
|
||||
config.Footer = footer;
|
||||
if (config.TestTag != testTagTextBox.Text)
|
||||
{
|
||||
config.TestTag = testTagTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.TestItems != testItems)
|
||||
{
|
||||
config.TestItems = testItems;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
@@ -273,12 +278,12 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
}
|
||||
}
|
||||
|
||||
private void commonItemsButton1_Click(object sender, EventArgs e)
|
||||
private void commonItemsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems1),
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
@@ -286,27 +291,10 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
commonItems1 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
commonItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
}
|
||||
}
|
||||
|
||||
private void commonItemsButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
|
||||
{
|
||||
MetersKind = config.MetersKind,
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(commonItems2),
|
||||
AvailableItems = new List<Results.WMeterRsltItemSpec>()
|
||||
};
|
||||
|
||||
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
commonItems2 = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
}
|
||||
}
|
||||
|
||||
private void testItemsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg(true)
|
||||
@@ -324,15 +312,6 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
|
||||
}
|
||||
}
|
||||
|
||||
private void footerButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
HeaderFooterDlg dlg = new HeaderFooterDlg(false, string.IsNullOrEmpty(footer) ? string.Empty : footer.Replace("~", Environment.NewLine));
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
footer = dlg.EditedText.Replace(Environment.NewLine, "~");
|
||||
}
|
||||
}
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnCmdResponse(object sender, CmdResponseArgs args)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user