Compare commits

...
Author SHA1 Message Date
Milan Hanajik 128734de01 Reconfigured for ROMA_200 2020-11-23 13:01:28 +01:00
Milan Hanajik 8846f16546 ver. 2.26.1545 2020-11-20 11:24:38 +01:00
Milan Hanajik 37ec839807 ver. 2.26.1544 2020-11-18 14:58:52 +01:00
Milan Hanajik 5f44fd4bdb Saving events to Events DB : Fixed bugs when connection string was not defined, ver. 2.26.1543 2020-11-18 10:46:00 +01:00
Milan Hanajik 5f5063663c iPerlCommunicationForm bug fix, ver. 2.26.1542 2020-11-13 08:40:41 +01:00
Milan Hanajik 75f0cb2930 UI.Procedures.ProceduresCtrl : More column content is optional. 2020-11-09 09:18:51 +01:00
Milan Hanajik 705f4de0b0 DB.SensusOracle.Database : (1) Procedure params., (2) S620 support, (3) SensusTestInfo for 620. 2020-11-06 14:33:32 +01:00
Milan Hanajik 1f581a72c1 Register readers cleanup, IRegReaderPulses added. 2020-11-06 14:33:32 +01:00
Milan Hanajik 6ec3b7b287 UI.Procedures.ProcedureDlg 'Copy' a test feature added 2020-11-06 14:33:31 +01:00
Milan Hanajik 9758411519 Statistics : IP addresses updated, export in CSV format implemented. 2020-11-06 14:33:31 +01:00
Milan Hanajik e1a185efdf MettlerToledo.Standard (1) Always reads imm.mass when idle (2) Changes in logging 2020-11-06 14:33:31 +01:00
Milan Hanajik a2556bec35 TBF/CameraBinaryFiles2 folder with synchronization for SD v.2.x (!!! file upload NOK). 2020-11-06 14:33:31 +01:00
Milan Hanajik 483e2b4eb7 DataEntry.Camera (1) loads next image after 'Enter' key, (2) dealing with test parts fixed. 2020-11-06 14:33:31 +01:00
Milan Hanajik f1d46782d3 Luxemburg component, LUXEMBURG_40 symbol incl. StatusP, TestMethods.DiverterTest fixed. 2020-11-06 14:33:23 +01:00
Milan Hanajik d1adde9b63 Changes in FlyingStartMassCollProlong in v 2.26.1522 (Gelsenwasser) reverted back. 2020-11-06 14:31:36 +01:00
Milan Hanajik 95c7257d6f Defined symbols in expressions are sorted. 2020-10-22 10:26:27 +02:00
Milan Hanajik 91392f9452 Camera binary files are only synchronized for SD v.1.x, ver. 2.26.1528 2020-10-16 14:07:57 +02:00
Milan Hanajik b145c71ee3 Improved file name formatting for Output.FileWrites.Basic/Enhanced/Xml/XmlBatch components. 2020-10-14 14:12:00 +02:00
Milan Hanajik 1cf2eb8e06 TODO, ver. 2.26.1527 2020-10-14 14:09:22 +02:00
Milan Hanajik 037a5be3b3 SyncRoute( ) called in RunDeviceBefore( ), this should fix FixedStartMassCollection. 2020-10-09 09:41:03 +02:00
Milan Hanajik 0fc7d831b0 1. Login to camera v.2.x with user 'pi', 2. DeviceTest shutdown fix, ver. 2.26.1525 2020-10-08 12:55:38 +02:00
Milan Hanajik abf54f765f SummaryResults : try/catch and more logging, ver. 2.26.1524 2020-10-08 09:00:50 +02:00
Milan Hanajik 0e7ba933d8 ResultsBrowser : Custom query : Batch numbers and test bench 2020-09-28 13:56:21 +02:00
Milan Hanajik fa03c09f09 DataStreamInterface: (1) supports multiple meters, (2) Shutdown() added 2020-09-25 12:20:56 +02:00
Milan Hanajik 3ac90ee622 TURA_SPECIAL : MaxOptoDataCount = 250000 2020-09-23 11:04:56 +02:00
Milan Hanajik 774f561fcf Gelsenwasser component upgraded, ver. 2.26.1523 2020-09-18 08:52:13 +02:00
Milan Hanajik 3a626740c7 !!! Bug fix in FlyStMassCollProlonged test method, ver. 2.26.1521 2020-09-17 11:19:51 +02:00
Milan Hanajik 97ce601d31 DataStreamInterfaceTest and DataStreamMeter projects added 2020-09-09 10:00:23 +02:00
Milan Hanajik 49d4cf1ac0 HONGKONG_50 symbol added, HongKong component added, ver. 2.26.1519 2020-09-09 09:58:58 +02:00
Milan Hanajik dcb0ee680c ver. 2.26.1518 2020-09-08 09:10:17 +02:00
Milan Hanajik e94eb83c1d ver. 2.26.1517 2020-09-08 09:01:39 +02:00
Milan Hanajik ff3de55593 TracingDB/Enums.cs updated, Output/DB/ProductionTracing/Enums.cs removed 2020-09-03 14:45:51 +02:00
Milan Hanajik 1e50cc6fb7 ver. 2.26.1516 2020-09-03 14:45:51 +02:00
Milan Hanajik 7b31c6b2b6 Modbus.WaterAnalyzer2 : Conductivity comm. and conversion from 4-20 mA 2020-09-03 14:45:07 +02:00
Milan Hanajik 38ee1cc067 English and US units added. 2020-08-28 09:06:27 +02:00
Milan Hanajik e27dfe570d Genesis component updated (21.8.2020). 2020-08-27 16:40:06 +02:00
Milan Hanajik b2f2f595e5 Output.EventTriggers.Standard bug fix (E13 cannot be changed). 2020-08-27 16:40:06 +02:00
Milan Hanajik 67f4683026 FixedStart methods : order of operations fixed (1. open start valve, 2. start measurement) 2020-08-12 10:10:49 +02:00
Milan Hanajik 42f8d02a68 (1) Heat Meters related fixes, (2) SLM50 component upgraded (7.8.2020), ver. 2.26.1513 2020-08-07 14:24:57 +02:00
Milan Hanajik 14717d5d46 ver. 2.26.1512 2020-08-07 12:14:04 +02:00
Milan Hanajik 450530a707 In FIxedStart methods there is a delay after start of a test before the flow regulation starts. 2020-08-07 12:14:04 +02:00
Milan Hanajik adf30d615b (1) MettlerToledo: Zero instead of Taring, (2) RegValveCalib array size fixed for ADC#8..11, ver. 2.26.1511 2020-08-07 11:11:44 +02:00
Milan Hanajik 610387e071 (1) Compound WM results are displayed correctly, ver. 2.26.1510 2020-08-05 10:27:34 +02:00
Milan Hanajik 114e628305 (1) Diverter.flowMtrNr4Cmd for SLM_150, (2) Config.Data cleanup 2020-08-05 09:36:00 +02:00
Milan Hanajik 68d01aab14 Bug fix in CombinedWithDetectionSeq related to test.Part, ver. 2.26.1509 2020-07-31 11:58:30 +02:00
Milan Hanajik eaf0e2cf22 Barcode printing in Output.Printers.Enhanced and Output.Printers.OnePerMeter, ver. 2.26.1508 2020-07-29 10:06:43 +02:00
Milan Hanajik 02ec8d8124 Camera.CLP1611 : More comments, TODO list, ver. 2.26.1505 2020-07-17 14:13:57 +02:00
Milan Hanajik 1dc328746d Gelsenwasser component upgraded. 2020-07-15 10:31:46 +02:00
Milan Hanajik 5bb94666a4 (1) Diverter.nextIdx not incremented when DebugMode.Off, (2) VR1 accepts number entry, ver. 2.26.1499 2020-07-09 13:31:24 +02:00
Milan Hanajik c1f23b8481 ResultsBrowser with a custom query for SUEZ, ver. 2.26.1498 2020-07-09 13:22:52 +02:00
Milan Hanajik 70c11ad6d9 German resources, ver. 2.26.1498 2020-07-08 10:16:33 +02:00
Milan Hanajik 3a8c6b4d3e ResultsBrowser : DEWA custom queries. 2020-07-07 12:57:45 +02:00
Milan Hanajik b8f1b9293a (1) Units : Quantity.Enumerated added, (2) LoginDlgWithBenchSelection : List of benches is alphabetically sorted. 2020-06-25 12:10:55 +02:00
Milan Hanajik 6558951857 ver. 2.26.1497 2020-06-25 09:53:48 +02:00
Milan Hanajik 54e964ffde Flow calculation : TestRslt.FlowVolume is always the most accurate CTV flow (calculated from the measured mass in case of mass collection methods) 2020-06-25 09:35:10 +02:00
Milan Hanajik a5b270eec8 Two documents added. 2020-06-24 14:08:36 +02:00
Milan Hanajik 6f9c6596d5 ResultsBrowser: 1 WR13 IP addr.updated, 2 default DbType=MySql, 3 changes in progress, ver. 2.26.1496 2020-06-24 12:01:37 +02:00
Milan Hanajik d99c53bc8e (1) psi unit, (2) Transition seq. fixed (ISequenceCondition seqCondition null after renaming a component). 2020-06-08 14:34:51 +02:00
Milan Hanajik 3496fcbbba Critical bug fixes in sequences - STOP not working !!! 2020-05-21 16:37:09 +02:00
Milan Hanajik 77a29dadfc ResetBatchNr console application added to solution. 2020-05-18 12:59:17 +02:00
260 changed files with 10023 additions and 2479 deletions
+6
View File
@@ -4,6 +4,10 @@ Config/bin/
Config/obj/
DataStreamInterface/bin/
DataStreamInterface/obj/
DataStreamInterfaceTest/bin/
DataStreamInterfaceTest/obj/
DataStreamMeter/bin/
DataStreamMeter/obj/
Decrypt/bin/
Decrypt/obj/
DeviceTest/bin/
@@ -24,6 +28,8 @@ GraphLib/bin
GraphLib/obj
TracingDB/bin
TracingDB/obj
ResetBatchNr/bin
ResetBatchNr/obj
RestClient/bin
RestClient/obj
Results/bin/
+2 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;ROMA_200;LANG_IT;TEST_PROFILES</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -30,7 +30,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;ROMA_200;LANG_IT;TEST_PROFILES</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+36 -54
View File
@@ -8,31 +8,43 @@ namespace Config
public const string AdminPassword = "staratura";
public const string SQLiteDbFName = "SQLite.db";
#if MUNICH
#if DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif MUNICH
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
#elif MALTA_WSD25
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
public const int MaxPartNr = 1;
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50 || TURA_SPECIAL
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif PUCHONG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DEWA_300 || ROMA_200
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DEWA_300 || FUZHOU_100 || ROMA_200 || LUXEMBURG_40
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
@@ -44,63 +56,33 @@ namespace Config
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_100
public const int WMsCount = 10;
public const int LineSize = 10;
#elif SLM_END || WARSAW_END
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN || GELSENWASSER
public const int WMsCount = 6;
public const int LineSize = 6;
public const int MaxPartNr = 4;
#elif SLM_50
public const int WMsCount = 12;
public const int LineSize = 12;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
public const int HeatMetersCount = 6;
public const int MaxPartNr = WMsCount / LineSize;
#elif ALZIR_25 || BAHRAIN_50 || CEVAK_40 || FEWA_50 || FILIPINY_50 || FUZHOU_50 || HONGKONG_50 || IZRAEL_25 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || MURES_40 || PETERSBURG_50 || TORUN_50 || ZAMBIA || ZODINO
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_IPERL || TURA_IPERL_NEW
public const int WMsCount = 40;
public const int LineSize = 20;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_SPECIAL || SENTEC
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif SLM_50
public const int WMsCount = 12;
public const int LineSize = 12;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 6;
public const int MaxPartNr = WMsCount / LineSize;
#elif SLM_END || WARSAW_END
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 4;
#elif MALTA_WSD25
public const int WMsCount = 6;
public const int LineSize = 6;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
+7 -1
View File
@@ -10,7 +10,7 @@ namespace Config
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable
public class DatabaseSettings : ICloneable, IComparable
{
// Public fields
public string BenchName;
@@ -45,6 +45,12 @@ namespace Config
return result;
}
public int CompareTo(object dbs2)
{
if (!(dbs2 is DatabaseSettings)) return 0;
return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName);
}
public override string ToString()
{
return string.Format("{0} config={1} results={2} events={3} users={4}",
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.26.1458.0")]
[assembly: AssemblyFileVersion("2.26.1458.0")]
[assembly: AssemblyVersion("2.26.1519.0")]
[assembly: AssemblyFileVersion("2.26.1519.0")]
+3 -3
View File
@@ -118,15 +118,15 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Failed" xml:space="preserve">
<value>NiO</value>
<value>Nicht OK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>iO</value>
<value>OK</value>
</data>
<data name="Error" xml:space="preserve">
<value>Fehler</value>
</data>
<data name="Cannot_open_DB_Cause_0" xml:space="preserve">
<value>Datenbank kann nicht geöffnet.\\r\\nUrsache:\\r\\n{0}</value>
<value>Datenbank kann nicht geöffnet werden.\\r\\nUrsache:\\r\\n{0}</value>
</data>
</root>
+166 -130
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
///
using System;
using System.Reflection;
@@ -17,24 +17,31 @@ namespace Config
#else
[Description("degree")] degree,
#endif
[Description("ml")] ml, /// 1 ml = 0.001 l
[Description("l")] l, /// * 1 liter
[Description("dm3")] dm3, /// 1 dm3 = 1 liter
[Description("m3")] m3, /// 1000 l
[Description("gal(UK)")] gal_UK, /// 1 gal(UK) = 4.54609 l
[Description("gal(US)")] gal_US, /// 1 gal(US) = 3.78541178 l
[Description("dm3")] dm3, /// 1 dm3 = 1 l
[Description("US gal")] USgal, /// 1 US gallon = 3.78541178 l
[Description("imper.gal")] UKgal, /// 1 imperial gallon = 4.54609 l
[Description("cf")] cf, /// 1 cubic foot = 28.316846592 l
[Description("m3")] m3, /// 1 m3 = 1000 l
[Description("l/h")] lph, /// 1 liter/h
[Description("m3/h")] m3ph, /// * 1 m3/h = 1000 l/h
[Description("l/h")] lph, /// 1 l/h = 0.001 m3/h
[Description("l/m")] lpm, /// 1 l/m = 60 l/h = 0.06 m3/h
[Description("m3/h")] m3ph, /// * 1 m3/h
[Description("l/s")] lps, /// 1 liter/s = 3.6 m3/h
[Description("US gal/s")] USgalps, /// 1 US gallon per second = 13.627482408 m3/h
[Description("m3/m")] m3pm, /// 1 m3/m = 60 m3/h
[Description("cf/s")] cfs, /// 1 cubic foot per second = 101.9406477312 m3/h
[Description("g")] g, /// 0.001 kg
[Description("lb")] lb, /// 0.45359237 kg
[Description("kg")] kg, /// * 1 kilogram
[Description("t")] t, /// 1000 kg
[Description("lb")] lb, /// 0.45359237 kg
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("s")] s, /// * 1 second
[Description("min")] min, /// 1 min = 60 s
[Description("hr")] hour, /// 1 hour = 60 min = 3600 s
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("°C")] C, /// * degree Celsius (°C)
[Description("°F")] F, /// degree Fahrenheit
@@ -42,21 +49,25 @@ namespace Config
[Description("Pa")] Pa, /// 1 Pa = 0.01 hPa
[Description("hPa")] hPa, /// 1 hPa = 100 Pa
[Description("kPa")] kPa, /// 1 kPa = 10 HPa
[Description("MPa")] MPa, /// 1 MPa = 10000 hPa
[Description("mbar")] mbar, /// 1 mbar = 1 hPa = 100 Pa
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
[Description("kPa")] kPa, /// 1 kPa = 10 hPa = 1000 Pa
[Description("inHg")] inHg, /// 1 inHg = 33.864 hPa
[Description("psi")] psi, /// 1 psi = 0.0689475729 bar
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
[Description("MPa")] MPa, /// 1 MPa = 10000 hPa
[Description("R%")] RPct, /// * 1 R%
[Description("%")] Pct, /// * 1 %
[Description("promile")] Promile, /// 1 promile = 0.1 %
[Description("%")] Pct, /// * 1 %
[Description("mm")] mm, /// * 1 millimeter
[Description("cm")] cm, /// 1 cm = 10 mm
[Description("m")] m, /// 1 m = 1000 mm
[Description("in")] inch, /// 1 inch = 25.4 mm
[Description("dm")] dm, /// 1 dm = 100 mm
[Description("ft")] foot, /// 1 foot = 304.8 mm
[Description("yd")] yard, /// 1 yard = 914.4 mm
[Description("m")] m, /// 1 m = 1000 mm
[Description("kg/m3")] kgpm3, /// * 1 kg/m3 = 0.001 kg/l
[Description("kg/l")] kgpl, /// 1 kg/l = 1000 kg/m3
@@ -69,6 +80,7 @@ namespace Config
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
[Description("uS/cm")] uSpcm, /// * 1 uS/cm
[Description("mS/m")] mSpm, /// 1 mS/m = 10 uS/cm
#if LANG_PL
[Description("imp/l")] ppl, /// * 1 pulse/l
@@ -81,17 +93,17 @@ namespace Config
[Description("dm3/stopień")] dm3pdeg, /// * 1 dm3/degree
#else
[Description("pulse/l")] ppl, /// * 1 pulse/l
[Description("pulse/dm3")] ppdm3, /// * 1 pulse/dm3
[Description("degree/l")] degpl, /// * 1 degree/l
[Description("degree/dm3")] degpdm3, /// * 1 degree/dm3
[Description("l/pulse")] lpp, /// * 1 l/pulse
[Description("dm3/pulse")] dm3pp, /// * 1 dm3/pulse
[Description("l/degree")] lpdeg, /// * 1 l/degree
[Description("dm3/degree")] dm3pdeg, /// * 1 dm3/degree
[Description("pulse/dm3")] ppdm3, /// 1 pulse/dm3
[Description("degree/l")] degpl, /// 1 degree/l
[Description("degree/dm3")] degpdm3, /// 1 degree/dm3
[Description("l/pulse")] lpp, /// 1 l/pulse
[Description("dm3/pulse")] dm3pp, /// 1 dm3/pulse
[Description("l/degree")] lpdeg, /// 1 l/degree
[Description("dm3/degree")] dm3pdeg, /// 1 dm3/degree
#endif
///
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
[Description("kWh/pulse")] kWhpp, /// * 1 kWh/pulse
[Description("kWh/pulse")] kWhpp, /// 1 kWh/pulse
Count
}
@@ -121,6 +133,7 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum und Uhrzeit")] DateTime,
[Description("Aufgezählt")] Enumerated,
#elif LANG_PL
[Description("Objętość")] Volume,
[Description("Przepływ")] Flow,
@@ -143,6 +156,7 @@ namespace Config
[Description("Tekst")] String,
[Description("Boolean")] Boolean,
[Description("Data i czas")] DateTime,
[Description("Wyliczone")] Enumerated,
#elif LANG_CS
[Description("Objem")] Volume,
[Description("Průtok")] Flow,
@@ -165,6 +179,7 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum a čas")] DateTime,
[Description("Vyjmenované")] Enumerated,
#elif LANG_IT
[Description("Volume")] Volume,
[Description("Flusso")] Flow,
@@ -187,6 +202,7 @@ namespace Config
[Description("Stringa")] String,
[Description("Boolean")] Boolean,
[Description("Data e ora")] DateTime,
[Description("Enumerato")] Enumerated,
#else
[Description("Volume")] Volume,
[Description("Flow")] Flow,
@@ -209,7 +225,7 @@ namespace Config
[Description("String")] String,
[Description("Boolean")] Boolean,
[Description("Date and time")] DateTime,
[Description("Enum")] Enum,
[Description("Enumerated")] Enumerated,
#endif
Count,
}
@@ -223,8 +239,9 @@ namespace Config
public static bool IsDefaultUnit(Unit unit)
{
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C || unit == Unit.bar || unit == Unit.RPct ||
unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 || unit == Unit.J || unit == Unit.ppl || unit == Unit.ppkWh || unit == Unit.uSpcm;
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
}
public static bool IsQuantity(Unit units, Quantity quantity)
@@ -238,61 +255,72 @@ namespace Config
{
case Unit.pulse:
case Unit.degree:
return Config.Quantity.Pulses;
return Quantity.Pulses;
case Unit.ml:
case Unit.l:
case Unit.dm3:
case Unit.USgal:
case Unit.UKgal:
case Unit.cf:
case Unit.m3:
case Unit.gal_UK:
case Unit.gal_US:
return Config.Quantity.Volume;
return Quantity.Volume;
case Unit.lph:
case Unit.lpm:
case Unit.m3ph:
return Config.Quantity.Flow;
case Unit.lps:
case Unit.USgalps:
case Unit.m3pm:
case Unit.cfs:
return Quantity.Flow;
case Unit.g:
case Unit.lb:
case Unit.kg:
case Unit.t:
case Unit.lb:
return Config.Quantity.Mass;
return Quantity.Mass;
case Unit.ms:
case Unit.s:
case Unit.min:
case Unit.hour:
case Unit.ms:
return Config.Quantity.Time;
return Quantity.Time;
case Unit.C:
case Unit.F:
case Unit.K:
return Config.Quantity.Temperature;
return Quantity.Temperature;
case Unit.Pa:
case Unit.hPa:
case Unit.mbar:
case Unit.kPa:
case Unit.inHg:
case Unit.psi:
case Unit.bar:
case Unit.MPa:
case Unit.inHg:
return Config.Quantity.Pressure;
return Quantity.Pressure;
case Unit.RPct:
return Config.Quantity.Humidity;
return Quantity.Humidity;
case Unit.Pct:
case Unit.Promile:
return Config.Quantity.Error;
case Unit.Pct:
return Quantity.Error;
case Unit.mm:
case Unit.cm:
case Unit.m:
case Unit.inch:
return Config.Quantity.Length;
case Unit.dm:
case Unit.foot:
case Unit.yard:
case Unit.m:
return Quantity.Length;
case Unit.kgpm3:
case Unit.kgpl:
return Config.Quantity.Density;
return Quantity.Density;
case Unit.J:
case Unit.kJ:
@@ -300,7 +328,11 @@ namespace Config
case Unit.Wh:
case Unit.kWh:
case Unit.MWh:
return Config.Quantity.Energy;
return Quantity.Energy;
case Unit.uSpcm:
case Unit.mSpm:
return Quantity.Conductivity;
case Unit.ppl:
case Unit.ppdm3:
@@ -310,17 +342,14 @@ namespace Config
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg:
return Config.Quantity.PulsePerLtr;
return Quantity.PulsePerLtr;
case Unit.ppkWh:
case Unit.kWhpp:
return Config.Quantity.PulsePerKWh;
case Unit.uSpcm:
return Config.Quantity.Conductivity;
return Quantity.PulsePerKWh;
default:
return Config.Quantity.Number;
return Quantity.Number;
}
}
@@ -341,77 +370,80 @@ namespace Config
public static bool IsConductivity(Unit units) { return IsQuantity(units, Config.Quantity.Conductivity); }
public static double ConvertTo(Unit units, double v)
{
switch (units)
{
/// Volume: internal representation in l
case Unit.dm3:
case Unit.l: return v; /// 1 liter
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
case Unit.gal_UK: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
case Unit.gal_US: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
case Unit.ml: return 1000 * v; /// 1 ml = 0.001 l
case Unit.USgal: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 0.0353146667215 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 1000 * v; /// 1 liter/h
case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h
case Unit.lph: return 1000 * v; /// 1 l/h
case Unit.lpm: return v / 0.06; /// 1 l/m
case Unit.lps: return v / 3.6; /// 1 l/s
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
case Unit.m3pm: return v / 60; /// 1 m3/m
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
case Unit.kg: return v; /// 1 kilogram
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.s: return v;
case Unit.ms: return 1000 * v;
case Unit.min: return v / 60;
case Unit.hour: return v / 3600;
case Unit.ms: return 1000 * v;
/// Temperature: internal representation in °C
case Unit.C: return v; /// degree Celsius (°C)
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 100000 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
case Unit.inHg: return 29.53 * v; /// 1 inHg = 33.864 hPa
case Unit.Pa: return 100000 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 29.53 * v; /// 1 inHg =
case Unit.psi: return 14.5037738 * v; /// 1 psi =
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
/// Error: internal representation in %
case Unit.Pct: return v; /// 1 %
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
/// Relative error: internal representation in %
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.mm: return v; /// 1 mm
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
case Unit.dm: return 0.01 * v; /// 1 dm = 100 mm
case Unit.foot: return v / 304.8; /// 1 foot = 304.8 mm
case Unit.yard: return v / 914.4; /// 1 yard = 914,4 mm
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpm3: return v;
case Unit.kgpl: return 0.001 * v;
/// Energy, internal representation in Joul
case Unit.J: return v; /// 1 Joul
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0; /// 1 MWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 0.1 * v;
/// Invert pulses
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return ((v <= float.Epsilon) ? 0 : 1 / v);
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v;
default: return v; /// Do not convert
}
}
@@ -420,71 +452,75 @@ namespace Config
switch (units)
{
/// Volume: internal representation in l
case Unit.dm3:
case Unit.l: return v; /// 1 liter
case Unit.m3: return 1000 * v; /// 1000 l
case Unit.gal_UK: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
case Unit.gal_US: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
case Unit.ml: return 0.001 * v; /// 0.001 l
case Unit.USgal: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 28.316846592 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 1000 * v; /// 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 0.001 * v; /// 1 liter/h
case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h
case Unit.lph: return 0.001 * v; /// 1 l/h
case Unit.lpm: return 0.06 * v; /// 1 l/m
case Unit.lps: return 3.6 * v; /// 1 l/s
case Unit.USgalps: return 13.627482408 * v; /// 1 US gallon per second
case Unit.m3pm: return 60 * v; /// 1 m3/m
case Unit.cfs: return 101.9406477312 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
case Unit.kg: return v; /// 1 kilogram
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.s: return v;
case Unit.ms: return 0.001 * v;
case Unit.min: return 60 * v;
case Unit.hour: return 3600 * v;
case Unit.ms: return v / 1000;
/// Temperature: internal representation in °C
case Unit.C: return v; /// degree Celsius (°C)
case Unit.F: return 5 * (v-32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.psi: return 0.0689475729 * v; /// 1 psi = 0.0689475729 bar
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
/// Error: internal representation in %
case Unit.Pct: return v; /// 1 %
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
/// Relative error: internal representation in %
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.mm: return v; /// 1 mm
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
case Unit.dm: return 100 * v; /// 1 dm = 100 mm
case Unit.foot: return 304.8 * v; /// 1 foot = 304.8 mm
case Unit.yard: return 914.4 * v; /// 1 yard = 914,4 mm
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpm3: return v;
case Unit.kgpl: return 1000 * v;
/// Energy, internal representation in Joul
case Unit.J: return v; /// 1 Joul
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 10 * v;
/// Invert
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return ((v == 0) ? 0 : 1 / v);
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v;
default: return v; /// Do not convert
}
}
}
+2 -2
View File
@@ -7,12 +7,12 @@ namespace DataStreamInterface
{
public class DataFrame
{
public readonly UInt64 ID; /// Frame ID
public readonly Int64 ID; /// Frame ID
public readonly double Time; /// Time stamp in units of time
public readonly double Volume; /// Volume in units of volume
public readonly double[] Quantity; /// An array of optional quantities in their respective units
public DataFrame(UInt64 id, double time, double volume, double[] quantity)
public DataFrame(Int64 id, double time, double volume, double[] quantity)
{
ID = id;
Time = time;
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamInterface</RootNamespace>
<AssemblyName>DataStreamInterface</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -29,9 +30,11 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
+324 -18
View File
@@ -13,22 +13,28 @@ namespace DataStreamInterface
degree,
/// Volume
ml, /// 0.001 l
l, /// * 1 liter = 1 l
ml, /// 1 ml = 0.001 l
l, /// * 1 liter
dm3, /// 1 dm3 = 1 l
m3, /// 1000 l
gal_UK, /// 1 gal(UK) = 4.54609 l
gal_US, /// 1 gal(US) = 3.78541178 l
USgal, /// 1 US gallon = 3.78541178 l
UKgal, /// 1 imperial gallon = 4.54609 l
cf, /// 1 cubic foot = 28.316846592 l
m3, /// 1 m3 = 1000 l
/// Flow
lph, /// 1 liter/h
m3ph, /// * 1 m3/h = 1000 l/h
lph, /// 1 l/h = 0.001 m3/h
lpm, /// 1 l/m = 60 l/h = 0.06 m3/h
m3ph, /// * 1 m3/h
lps, /// 1 liter/s = 3.6 m3/h
USgalps, /// 1 US gallon per second = 13.627482408 m3/h
m3pm, /// 1 m3/m = 60 m3/h
cfs, /// 1 cubic foot per second = 101.9406477312 m3/h
/// Mass
g, /// 0.001 kg
lb, /// 0.45359237 kg
kg, /// * 1 kilogram
t, /// 1000 kg
lb, /// 0.45359237 kg
/// Time
ms, /// 1 ms = 0.001 s
@@ -47,6 +53,7 @@ namespace DataStreamInterface
mbar, /// 1 mbar = 1 hPa = 100 Pa
kPa, /// 1 kPa = 10 HPa
inHg, /// 1 inHg = 33.864 hPa
psi, /// 1 psi = 0.0689475729 bar
bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
MPa, /// 1 MPa = 10000 hPa
@@ -61,7 +68,9 @@ namespace DataStreamInterface
mm, /// * 1 millimeter
cm, /// 1 cm = 10 mm
inch, /// 1 inch = 25.4 mm
dm, /// 1 dm = 100 mm
foot, /// 1 foot = 304.8 mm
yard, /// 1 yard = 914.4 mm
m, /// 1 m = 1000 mm
/// Density
@@ -76,20 +85,317 @@ namespace DataStreamInterface
kWh, /// 1 kWh = 3600000 J
MWh, /// 1 MWh = 3600000000 J
/// Electrical conductivity
uSpcm, /// * 1 uS/cm
mSpm, /// 1 mS/m = 10 uS/cm
/// Meter coefficient - volume
ppl, /// * 1 pulse/l
ppdm3, /// * 1 pulse/dm3
degpl, /// * 1 degree/l
degpdm3, /// * 1 degree/dm3
lpp, /// * 1 l/pulse
dm3pp, /// * 1 dm3/pulse
lpdeg, /// * 1 l/degree
dm3pdeg, /// * 1 dm3/degree
ppdm3, /// 1 pulse/dm3
degpl, /// 1 degree/l
degpdm3, /// 1 degree/dm3
lpp, /// 1 l/pulse
dm3pp, /// 1 dm3/pulse
lpdeg, /// 1 l/degree
dm3pdeg, /// 1 dm3/degree
/// Meter coefficient - energy
ppkWh, /// * 1 pulse/kWh
kWhpp, /// * 1 kWh/pulse
Count
kWhpp, /// 1 kWh/pulse
}
public enum Quantity
{
/// Quantities with units and conversions (double -> double)
Volume,
Flow,
Mass,
Time,
Temperature,
Pressure,
Humidity,
Error,
Length,
Density,
Energy,
Pulses,
PulsePerLtr,
PulsePerKWh,
Conductivity,
/// Quantities without units and conversions
Number,
String,
Boolean,
DateTime,
Enumerated,
}
public static class Units
{
public static bool IsDefaultUnit(Unit unit)
{
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
}
public static Quantity GetQuantity(Unit units)
{
switch (units)
{
case Unit.pulse:
case Unit.degree:
return Quantity.Pulses;
case Unit.ml:
case Unit.l:
case Unit.dm3:
case Unit.USgal:
case Unit.UKgal:
case Unit.cf:
case Unit.m3:
return Quantity.Volume;
case Unit.lph:
case Unit.lpm:
case Unit.m3ph:
case Unit.lps:
case Unit.USgalps:
case Unit.m3pm:
case Unit.cfs:
return Quantity.Flow;
case Unit.g:
case Unit.lb:
case Unit.kg:
case Unit.t:
return Quantity.Mass;
case Unit.ms:
case Unit.s:
case Unit.min:
case Unit.hour:
return Quantity.Time;
case Unit.C:
case Unit.F:
case Unit.K:
return Quantity.Temperature;
case Unit.Pa:
case Unit.hPa:
case Unit.mbar:
case Unit.kPa:
case Unit.inHg:
case Unit.psi:
case Unit.bar:
case Unit.MPa:
return Quantity.Pressure;
case Unit.RPct:
return Quantity.Humidity;
case Unit.Promile:
case Unit.Pct:
return Quantity.Error;
case Unit.mm:
case Unit.cm:
case Unit.inch:
case Unit.dm:
case Unit.foot:
case Unit.yard:
case Unit.m:
return Quantity.Length;
case Unit.kgpm3:
case Unit.kgpl:
return Quantity.Density;
case Unit.J:
case Unit.kJ:
case Unit.MJ:
case Unit.Wh:
case Unit.kWh:
case Unit.MWh:
return Quantity.Energy;
case Unit.uSpcm:
case Unit.mSpm:
return Quantity.Conductivity;
case Unit.ppl:
case Unit.ppdm3:
case Unit.degpl:
case Unit.degpdm3:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg:
return Quantity.PulsePerLtr;
case Unit.ppkWh:
case Unit.kWhpp:
return Quantity.PulsePerKWh;
default:
return Quantity.Number;
}
}
public static double ConvertTo(Unit units, double v)
{
switch (units)
{
/// Volume: internal representation in l
case Unit.ml: return 1000 * v; /// 1 l = 1000 ml
case Unit.USgal: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 0.0353146667215 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 1000 * v; /// 1 l/h
case Unit.lpm: return v / 0.06; /// 1 l/m
case Unit.lps: return v / 3.6; /// 1 l/s
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
case Unit.m3pm: return v / 60; /// 1 m3/m
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.ms: return 1000 * v;
case Unit.min: return v / 60;
case Unit.hour: return v / 3600;
/// Temperature: internal representation in °C
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 100000 * v;
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 29.53 * v; /// 1 inHg =
case Unit.psi: return 14.5037738 * v; /// 1 psi =
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
/// Relative error: internal representation in %
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
case Unit.dm: return 0.01 * v; /// 1 dm = 100 mm
case Unit.foot: return v / 304.8; /// 1 foot = 304.8 mm
case Unit.yard: return v / 914.4; /// 1 yard = 914,4 mm
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpl: return 0.001 * v;
/// Energy, internal representation in Joul
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0; /// 1 MWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 0.1 * v;
/// Invert pulses
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v; /// Do not convert
}
}
public static double ConvertFrom(Unit units, double v)
{
switch (units)
{
/// Volume: internal representation in l
case Unit.ml: return 0.001 * v; /// 0.001 l
case Unit.USgal: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
case Unit.UKgal: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
case Unit.cf: return 28.316846592 * v; /// 1 cubic foot = 28.316846592 l
case Unit.m3: return 1000 * v; /// 1000 l
/// Flow: internal representation in m3/h
case Unit.lph: return 0.001 * v; /// 1 l/h
case Unit.lpm: return 0.06 * v; /// 1 l/m
case Unit.lps: return 3.6 * v; /// 1 l/s
case Unit.USgalps: return 13.627482408 * v; /// 1 US gallon per second
case Unit.m3pm: return 60 * v; /// 1 m3/m
case Unit.cfs: return 101.9406477312 * v; /// 1 cubic foot per second
/// Mass: internal representation in kg
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
/// Time or duration: internal representation in seconds [s]
case Unit.ms: return 0.001 * v;
case Unit.min: return 60 * v;
case Unit.hour: return 3600 * v;
/// Temperature: internal representation in °C
case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
/// Pressure: internal representation in bar = 0.1 MPa
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
case Unit.psi: return 0.0689475729 * v; /// 1 psi = 0.0689475729 bar
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
/// Relative error: internal representation in %
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
/// Diameter, length: internal representation in mm
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
case Unit.dm: return 100 * v; /// 1 dm = 100 mm
case Unit.foot: return 304.8 * v; /// 1 foot = 304.8 mm
case Unit.yard: return 914.4 * v; /// 1 yard = 914,4 mm
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
/// Density: internal representation in kg/m3
case Unit.kgpl: return 1000 * v;
/// Energy, internal representation in Joul
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
/// Electrical conductivity
case Unit.mSpm: return 10 * v;
/// Invert
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
default: return v; /// Do not convert
}
}
}
}
+47 -21
View File
@@ -2,58 +2,82 @@
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataStreamInterface
{
public interface IDataStreamMeter
{
/// <summary>
/// Returns count of water meters supported by the data stream component
/// </summary>
/// <returns>Water meters count</returns>
int GetMetersCount();
/// <summary>
/// Get state of the connected data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="state">Current state of the meter</param>
/// <param name="parameter">Current extra parameter of the meter</param>
/// <returns>true when successful</returns>
bool GetState(out int state, out string parameter);
bool GetState(int meterIx, out int state, out string parameter);
/// <summary>
/// Set state of the connected data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="state">Required state of the meter</param>
/// <param name="parameter">Required extra parameter of the meter</param>
/// <returns>true when successful</returns>
bool SetState(int state, string parameter);
bool SetState(int meterIx, int state, string parameter);
bool SetStateAll(int state, string parameter);
/// <summary>
/// Establish connection with a data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="connectionParameters">Connection parameters</param>
/// <param name="meterId">Meter ID (e.g. serial number)</param>
/// <returns>true when successful</returns>
bool OpenConnection(string connectionParameters, out string meterId);
/// <summary>
/// Closes connection with the data stream meter
/// </summary>
/// <returns>true when successful</returns>
bool CloseConnection();
bool OpenConnection(int meterIx, string connectionParameters, out string meterId);
/// <summary>
/// Stars saving measurement results into internal data structures of the component.
/// Each data frame obtains a unique ID.
/// The very first data fraim obrains ID = 0.
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <returns>true when successful</returns>
bool StartMeasurement();
bool StartMeasurement(int meterIx);
bool StartMeasurementAll();
/// <summary>
/// Stops saving measurement results into internal data structures of the component.
/// Updates ID of the last date frame received from the meter.
/// </summary>
/// <param name="lastFrameID">ID of the last date frame</param>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="storedFramesCount">Number of stored date frames</param>
/// <returns>true when successful</returns>
bool StopMeasurement(out UInt64 lastFrameID);
bool StopMeasurement(int meterIx, out Int64 storedFramesCount);
bool StopMeasurementAll(out Int64[] storedFramesCounts);
/// <summary>
/// Closes connection with the data stream meter
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <returns>true when successful</returns>
bool CloseConnection(int meterIx);
bool CloseConnectionAll();
/// <summary>
/// This function is called when TBF program is shutting down.
/// </summary>
/// <returns>true when successful</returns>
bool Shutdown();
///------------------------------------------------
/// Units of time, volume and optional quantities
@@ -70,7 +94,7 @@ namespace DataStreamInterface
Unit GetVolumeUnits();
///-----------------------------------------------
/// Ooptional quantities: count, units, captions
/// Optional quantities: count, units, captions
///-----------------------------------------------
/// <summary>
@@ -83,13 +107,13 @@ namespace DataStreamInterface
/// Returns units of the specified quantity
/// </summary>
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
Unit GetQuantityUnits(int quanityNr);
Unit GetQuantityUnits(int quantityNr);
/// <summary>
/// Returns caption of the specified quantity
/// </summary>
/// <param name="quanityNr">Zero based quantity number 0 .. quantites count-1</param>
string GetQuantityCaption(int quanityNr);
string GetQuantityCaption(int quantityNr);
///---------------------------
/// Datastream data exchange
@@ -98,17 +122,19 @@ namespace DataStreamInterface
/// <summary>
/// Retuns 'count' data frames starting with data frame with ID = 'id'
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="id">First frame ID</param>
/// <param name="count">Frames count</param>
/// <returns>Selected data frames</returns>
DataFrame[] GetFrames(UInt64 id, int count);
DataFrame[] GetFrames(int meterIx, Int64 id, int count);
/// <summary>
/// Returns ID of the data frame where time equals or exceeds the specified time.
/// When time of the first frame (ID=0) is larger then specified time, function returns 0.
/// </summary>
/// <param name="meterIx">Index of the meter in range 0 .. (GetMetersCount() - 1)</param>
/// <param name="time">Time</param>
/// <returns>ID of the data frame at or after the pecified time</returns>
UInt64 GetID(double time);
Int64 GetID(int meterIx, double time);
}
}
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Text;
using System.Windows.Forms;
namespace DataStreamInterfaceTest
{
public class ActivityLog
{
const int LinesCount = 50;
TextBox textBox;
string[] lines;
string activity;
public ActivityLog(TextBox textBox)
{
this.textBox = textBox;
lines = new string[LinesCount];
for (int i = 0; i < LinesCount; i++) lines[i] = string.Empty;
}
public void Print(string log)
{
for (int i = LinesCount - 1; i > 0; i--) lines[i] = lines[i - 1];
lines[0] = log;
DisplayLines();
}
private void DisplayLines()
{
StringBuilder sb = new StringBuilder();
foreach (var line in lines) sb.AppendLine(line);
textBox.Text = sb.ToString();
}
}
}
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamInterfaceTest</RootNamespace>
<AssemblyName>DataStreamInterfaceTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ActivityLog.cs" />
<Compile Include="DemoMainWnd.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DemoMainWnd.Designer.cs">
<DependentUpon>DemoMainWnd.cs</DependentUpon>
</Compile>
<Compile Include="GetDblValueDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GetDblValueDlg.designer.cs">
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
</Compile>
<Compile Include="GetFrameBoundariesDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GetFrameBoundariesDlg.designer.cs">
<DependentUpon>GetFrameBoundariesDlg.cs</DependentUpon>
</Compile>
<Compile Include="GetIntegerNumberDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GetIntegerNumberDlg.Designer.cs">
<DependentUpon>GetIntegerNumberDlg.cs</DependentUpon>
</Compile>
<Compile Include="GetStateDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GetStateDlg.designer.cs">
<DependentUpon>GetStateDlg.cs</DependentUpon>
</Compile>
<Compile Include="LviIDComparer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="DemoMainWnd.resx">
<DependentUpon>DemoMainWnd.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GetDblValueDlg.resx">
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GetFrameBoundariesDlg.resx">
<DependentUpon>GetFrameBoundariesDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GetIntegerNumberDlg.resx">
<DependentUpon>GetIntegerNumberDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GetStateDlg.resx">
<DependentUpon>GetStateDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DataStreamInterface\DataStreamInterface.csproj">
<Project>{7ebeea14-91c4-48d7-af0a-7a4bc3ff9a28}</Project>
<Name>DataStreamInterface</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+380
View File
@@ -0,0 +1,380 @@
namespace DataStreamInterfaceTest
{
partial class DemoMainWnd
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.getIDButton = new System.Windows.Forms.Button();
this.getFramesButton = new System.Windows.Forms.Button();
this.measurementLabel = new System.Windows.Forms.Label();
this.stateLabel = new System.Windows.Forms.Label();
this.capabilitiesLabel = new System.Windows.Forms.Label();
this.getQuantityUnitsButton = new System.Windows.Forms.Button();
this.getQuantityCaptionButton = new System.Windows.Forms.Button();
this.getQuantitiesCountButton = new System.Windows.Forms.Button();
this.getVolumeUnitsButton = new System.Windows.Forms.Button();
this.getTimeUnitsButton = new System.Windows.Forms.Button();
this.setStateButton = new System.Windows.Forms.Button();
this.getStateButton = new System.Windows.Forms.Button();
this.stopMeasurementButton = new System.Windows.Forms.Button();
this.startMeasurementButton = new System.Windows.Forms.Button();
this.closeConnectionButton = new System.Windows.Forms.Button();
this.openConnectionButton = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.logsTextBox = new System.Windows.Forms.TextBox();
this.dataTabControl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.framesListView = new System.Windows.Forms.ListView();
this.tabPage2 = new System.Windows.Forms.TabPage();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.dataTabControl.SuspendLayout();
this.tabPage1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.getIDButton);
this.splitContainer1.Panel1.Controls.Add(this.getFramesButton);
this.splitContainer1.Panel1.Controls.Add(this.measurementLabel);
this.splitContainer1.Panel1.Controls.Add(this.stateLabel);
this.splitContainer1.Panel1.Controls.Add(this.capabilitiesLabel);
this.splitContainer1.Panel1.Controls.Add(this.getQuantityUnitsButton);
this.splitContainer1.Panel1.Controls.Add(this.getQuantityCaptionButton);
this.splitContainer1.Panel1.Controls.Add(this.getQuantitiesCountButton);
this.splitContainer1.Panel1.Controls.Add(this.getVolumeUnitsButton);
this.splitContainer1.Panel1.Controls.Add(this.getTimeUnitsButton);
this.splitContainer1.Panel1.Controls.Add(this.setStateButton);
this.splitContainer1.Panel1.Controls.Add(this.getStateButton);
this.splitContainer1.Panel1.Controls.Add(this.stopMeasurementButton);
this.splitContainer1.Panel1.Controls.Add(this.startMeasurementButton);
this.splitContainer1.Panel1.Controls.Add(this.closeConnectionButton);
this.splitContainer1.Panel1.Controls.Add(this.openConnectionButton);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(826, 583);
this.splitContainer1.SplitterDistance = 150;
this.splitContainer1.TabIndex = 0;
//
// getIDButton
//
this.getIDButton.Location = new System.Drawing.Point(12, 480);
this.getIDButton.Name = "getIDButton";
this.getIDButton.Size = new System.Drawing.Size(128, 24);
this.getIDButton.TabIndex = 12;
this.getIDButton.Text = "Get ID";
this.getIDButton.UseVisualStyleBackColor = true;
this.getIDButton.Click += new System.EventHandler(this.getIDButton_Click);
//
// getFramesButton
//
this.getFramesButton.Location = new System.Drawing.Point(12, 450);
this.getFramesButton.Name = "getFramesButton";
this.getFramesButton.Size = new System.Drawing.Size(128, 24);
this.getFramesButton.TabIndex = 11;
this.getFramesButton.Text = "Get frames";
this.getFramesButton.UseVisualStyleBackColor = true;
this.getFramesButton.Click += new System.EventHandler(this.getFramesButton_Click);
//
// measurementLabel
//
this.measurementLabel.AutoSize = true;
this.measurementLabel.Location = new System.Drawing.Point(12, 374);
this.measurementLabel.Name = "measurementLabel";
this.measurementLabel.Size = new System.Drawing.Size(74, 13);
this.measurementLabel.TabIndex = 15;
this.measurementLabel.Text = "Measurement:";
//
// stateLabel
//
this.stateLabel.AutoSize = true;
this.stateLabel.Location = new System.Drawing.Point(12, 194);
this.stateLabel.Name = "stateLabel";
this.stateLabel.Size = new System.Drawing.Size(112, 13);
this.stateLabel.TabIndex = 14;
this.stateLabel.Text = "State and connection:";
//
// capabilitiesLabel
//
this.capabilitiesLabel.AutoSize = true;
this.capabilitiesLabel.Location = new System.Drawing.Point(12, 9);
this.capabilitiesLabel.Name = "capabilitiesLabel";
this.capabilitiesLabel.Size = new System.Drawing.Size(63, 13);
this.capabilitiesLabel.TabIndex = 13;
this.capabilitiesLabel.Text = "Capabilities:";
//
// getQuantityUnitsButton
//
this.getQuantityUnitsButton.Location = new System.Drawing.Point(12, 145);
this.getQuantityUnitsButton.Name = "getQuantityUnitsButton";
this.getQuantityUnitsButton.Size = new System.Drawing.Size(128, 24);
this.getQuantityUnitsButton.TabIndex = 4;
this.getQuantityUnitsButton.Text = "Get quantity units";
this.getQuantityUnitsButton.UseVisualStyleBackColor = true;
this.getQuantityUnitsButton.Click += new System.EventHandler(this.getQuantityUnitsButton_Click);
//
// getQuantityCaptionButton
//
this.getQuantityCaptionButton.Location = new System.Drawing.Point(12, 115);
this.getQuantityCaptionButton.Name = "getQuantityCaptionButton";
this.getQuantityCaptionButton.Size = new System.Drawing.Size(128, 24);
this.getQuantityCaptionButton.TabIndex = 3;
this.getQuantityCaptionButton.Text = "Get quantity caption";
this.getQuantityCaptionButton.UseVisualStyleBackColor = true;
this.getQuantityCaptionButton.Click += new System.EventHandler(this.getQuantityCaptionButton_Click);
//
// getQuantitiesCountButton
//
this.getQuantitiesCountButton.Location = new System.Drawing.Point(12, 85);
this.getQuantitiesCountButton.Name = "getQuantitiesCountButton";
this.getQuantitiesCountButton.Size = new System.Drawing.Size(128, 24);
this.getQuantitiesCountButton.TabIndex = 2;
this.getQuantitiesCountButton.Text = "Get quantities count";
this.getQuantitiesCountButton.UseVisualStyleBackColor = true;
this.getQuantitiesCountButton.Click += new System.EventHandler(this.getQuantitiesCountButton_Click);
//
// getVolumeUnitsButton
//
this.getVolumeUnitsButton.Location = new System.Drawing.Point(12, 55);
this.getVolumeUnitsButton.Name = "getVolumeUnitsButton";
this.getVolumeUnitsButton.Size = new System.Drawing.Size(128, 24);
this.getVolumeUnitsButton.TabIndex = 1;
this.getVolumeUnitsButton.Text = "Get volume units";
this.getVolumeUnitsButton.UseVisualStyleBackColor = true;
this.getVolumeUnitsButton.Click += new System.EventHandler(this.getVolumeUnitsButton_Click);
//
// getTimeUnitsButton
//
this.getTimeUnitsButton.Location = new System.Drawing.Point(12, 25);
this.getTimeUnitsButton.Name = "getTimeUnitsButton";
this.getTimeUnitsButton.Size = new System.Drawing.Size(128, 24);
this.getTimeUnitsButton.TabIndex = 0;
this.getTimeUnitsButton.Text = "Get time units";
this.getTimeUnitsButton.UseVisualStyleBackColor = true;
this.getTimeUnitsButton.Click += new System.EventHandler(this.getTimeUnitsButton_Click);
//
// setStateButton
//
this.setStateButton.Location = new System.Drawing.Point(12, 315);
this.setStateButton.Name = "setStateButton";
this.setStateButton.Size = new System.Drawing.Size(128, 24);
this.setStateButton.TabIndex = 8;
this.setStateButton.Text = "Set state";
this.setStateButton.UseVisualStyleBackColor = true;
this.setStateButton.Click += new System.EventHandler(this.setStateButton_Click);
//
// getStateButton
//
this.getStateButton.Location = new System.Drawing.Point(12, 285);
this.getStateButton.Name = "getStateButton";
this.getStateButton.Size = new System.Drawing.Size(128, 24);
this.getStateButton.TabIndex = 7;
this.getStateButton.Text = "Get state";
this.getStateButton.UseVisualStyleBackColor = true;
this.getStateButton.Click += new System.EventHandler(this.getStateButton_Click);
//
// stopMeasurementButton
//
this.stopMeasurementButton.Location = new System.Drawing.Point(12, 420);
this.stopMeasurementButton.Name = "stopMeasurementButton";
this.stopMeasurementButton.Size = new System.Drawing.Size(128, 24);
this.stopMeasurementButton.TabIndex = 10;
this.stopMeasurementButton.Text = "Stop measurement";
this.stopMeasurementButton.UseVisualStyleBackColor = true;
this.stopMeasurementButton.Click += new System.EventHandler(this.stopMeasurementButton_Click);
//
// startMeasurementButton
//
this.startMeasurementButton.Location = new System.Drawing.Point(12, 390);
this.startMeasurementButton.Name = "startMeasurementButton";
this.startMeasurementButton.Size = new System.Drawing.Size(128, 24);
this.startMeasurementButton.TabIndex = 9;
this.startMeasurementButton.Text = "Start measurement";
this.startMeasurementButton.UseVisualStyleBackColor = true;
this.startMeasurementButton.Click += new System.EventHandler(this.startMeasurementButton_Click);
//
// closeConnectionButton
//
this.closeConnectionButton.Location = new System.Drawing.Point(12, 240);
this.closeConnectionButton.Name = "closeConnectionButton";
this.closeConnectionButton.Size = new System.Drawing.Size(128, 24);
this.closeConnectionButton.TabIndex = 6;
this.closeConnectionButton.Text = "Close connection";
this.closeConnectionButton.UseVisualStyleBackColor = true;
this.closeConnectionButton.Click += new System.EventHandler(this.closeConnectionButton_Click);
//
// openConnectionButton
//
this.openConnectionButton.Location = new System.Drawing.Point(12, 210);
this.openConnectionButton.Name = "openConnectionButton";
this.openConnectionButton.Size = new System.Drawing.Size(128, 24);
this.openConnectionButton.TabIndex = 5;
this.openConnectionButton.Text = "Open connection";
this.openConnectionButton.UseVisualStyleBackColor = true;
this.openConnectionButton.Click += new System.EventHandler(this.openConnectionButton_Click);
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.logsTextBox);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.dataTabControl);
this.splitContainer2.Size = new System.Drawing.Size(672, 583);
this.splitContainer2.SplitterDistance = 222;
this.splitContainer2.TabIndex = 0;
//
// logsTextBox
//
this.logsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.logsTextBox.Location = new System.Drawing.Point(0, 0);
this.logsTextBox.Multiline = true;
this.logsTextBox.Name = "logsTextBox";
this.logsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.logsTextBox.Size = new System.Drawing.Size(672, 222);
this.logsTextBox.TabIndex = 0;
//
// dataTabControl
//
this.dataTabControl.Controls.Add(this.tabPage1);
this.dataTabControl.Controls.Add(this.tabPage2);
this.dataTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataTabControl.Location = new System.Drawing.Point(0, 0);
this.dataTabControl.Name = "dataTabControl";
this.dataTabControl.SelectedIndex = 0;
this.dataTabControl.Size = new System.Drawing.Size(672, 357);
this.dataTabControl.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.framesListView);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(664, 331);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Transferred frames";
this.tabPage1.UseVisualStyleBackColor = true;
//
// framesListView
//
this.framesListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.framesListView.GridLines = true;
this.framesListView.Location = new System.Drawing.Point(3, 3);
this.framesListView.Name = "framesListView";
this.framesListView.Size = new System.Drawing.Size(658, 325);
this.framesListView.TabIndex = 0;
this.framesListView.UseCompatibleStateImageBehavior = false;
this.framesListView.View = System.Windows.Forms.View.Details;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(664, 331);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Graph";
this.tabPage2.UseVisualStyleBackColor = true;
//
// DemoMainWnd
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(826, 583);
this.Controls.Add(this.splitContainer1);
this.Name = "DemoMainWnd";
this.Text = "Datastream interface test";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DemoMainWnd_FormClosing);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.dataTabControl.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button openConnectionButton;
private System.Windows.Forms.Button closeConnectionButton;
private System.Windows.Forms.Button stopMeasurementButton;
private System.Windows.Forms.Button startMeasurementButton;
private System.Windows.Forms.Button setStateButton;
private System.Windows.Forms.Button getStateButton;
private System.Windows.Forms.Button getQuantityUnitsButton;
private System.Windows.Forms.Button getQuantityCaptionButton;
private System.Windows.Forms.Button getQuantitiesCountButton;
private System.Windows.Forms.Button getVolumeUnitsButton;
private System.Windows.Forms.Button getTimeUnitsButton;
private System.Windows.Forms.Label measurementLabel;
private System.Windows.Forms.Label stateLabel;
private System.Windows.Forms.Label capabilitiesLabel;
private System.Windows.Forms.Button getIDButton;
private System.Windows.Forms.Button getFramesButton;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.TextBox logsTextBox;
private System.Windows.Forms.TabControl dataTabControl;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.ListView framesListView;
private System.Windows.Forms.TabPage tabPage2;
}
}
+292
View File
@@ -0,0 +1,292 @@
using System;
using System.Text;
using System.Windows.Forms;
using DataStreamInterface;
namespace DataStreamInterfaceTest
{
public partial class DemoMainWnd : Form
{
IDataStreamMeter dataStreamMeter;
ActivityLog activityLog;
Unit timeUnits;
Unit volumeUnits;
int quantitiesCount;
string[] quantityCaption;
Unit[] quantityUnit;
Int64 storedFramesCount;
DataFrame[] transferredFrames;
public DemoMainWnd() : this(null) { }
public DemoMainWnd(IDataStreamMeter dataStreamMeter)
{
InitializeComponent();
this.dataStreamMeter = dataStreamMeter;
activityLog = new ActivityLog(logsTextBox);
framesListView.Columns.Add("ID", 100);
framesListView.Columns.Add("Time", 100);
framesListView.Columns.Add("Volume", 100);
framesListView.Columns.Add("Additional quantities", 300);
framesListView.ListViewItemSorter = new LviIDComparer();
}
void ShowNoMeterInterfaceMessage()
{
MessageBox.Show("No datastream meter interface");
}
private void getTimeUnitsButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
timeUnits = dataStreamMeter.GetTimeUnits();
activityLog.Print(string.Format("Time units are {0}", timeUnits));
}
}
private void getVolumeUnitsButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
volumeUnits = dataStreamMeter.GetVolumeUnits();
activityLog.Print(string.Format("Volume units are {0}", volumeUnits));
}
}
private void getQuantitiesCountButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
int quantitesCountOri = quantitiesCount;
quantitiesCount = dataStreamMeter.GetQuantitiesCount();
activityLog.Print(string.Format("There are {0} additional quantites", quantitiesCount));
if (quantitesCountOri == 0)
{
quantityUnit = new Unit[quantitiesCount];
quantityCaption = new string[quantitiesCount];
for (int i = 0; i < quantitiesCount; i++) quantityCaption[i] = string.Empty;
}
else if (quantitiesCount != quantitesCountOri)
{
quantityUnit = new Unit[quantitiesCount];
quantityCaption = new string[quantitiesCount];
for (int i = 0; i < quantitiesCount; i++) quantityCaption[i] = string.Empty;
activityLog.Print(string.Format("Quantities count changed during operation"));
MessageBox.Show("Quantities count changed during operation", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
private void getQuantityCaptionButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
GetIntegerNumberDlg dlg = new GetIntegerNumberDlg(string.Format("Enter index {0} .. {1}", 0, quantitiesCount - 1), 0, quantitiesCount - 1);
if (dlg.ShowDialog() == DialogResult.OK)
{
quantityCaption[dlg.Number] = dataStreamMeter.GetQuantityCaption(dlg.Number);
activityLog.Print(string.Format("Caption of quantity #{0} is {1}", dlg.Number, quantityCaption[dlg.Number]));
}
}
}
private void getQuantityUnitsButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
GetIntegerNumberDlg dlg = new GetIntegerNumberDlg(string.Format("Enter index {0} .. {1}", 0, quantitiesCount - 1), 0, quantitiesCount - 1);
if (dlg.ShowDialog() == DialogResult.OK)
{
quantityUnit[dlg.Number] = dataStreamMeter.GetQuantityUnits(dlg.Number);
activityLog.Print(string.Format("Units of quantity #{0} are {1}", dlg.Number, quantityUnit[dlg.Number]));
}
}
}
private void openConnectionButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
string meterId;
if (dataStreamMeter.OpenConnection(0, "no connection parameters", out meterId))
{
activityLog.Print(string.Format("Connection established, meter ID is {0}", meterId));
}
else
{
activityLog.Print("Failed to establish a connection");
}
}
}
private void closeConnectionButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
if (dataStreamMeter.CloseConnection(0))
{
framesListView.Items.Clear();
activityLog.Print("Connection closed");
}
else
{
activityLog.Print("Failed to close the connection");
}
}
}
private void DemoMainWnd_FormClosing(object sender, FormClosingEventArgs e)
{
if (dataStreamMeter == null)
{
dataStreamMeter.Shutdown();
}
}
private void getStateButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
int state;
string parameter;
if (dataStreamMeter.GetState(0, out state, out parameter))
{
activityLog.Print(string.Format("Water meter state is {0} / {1}", state, parameter));
}
else
{
activityLog.Print("Failed to obtain the water meter state");
}
}
}
private void setStateButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
GetStateDlg dlg = new GetStateDlg();
if (dlg.ShowDialog() == DialogResult.OK)
{
if (dataStreamMeter.SetState(0, dlg.State, dlg.Parameter))
{
activityLog.Print(string.Format("Water meter state set to {0} / {1}", dlg.State, dlg.Parameter));
}
else
{
activityLog.Print(string.Format("Failed to set the water meter state to {0} / {1}", dlg.State, dlg.Parameter));
}
}
}
}
private void startMeasurementButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
if (dataStreamMeter.StartMeasurement(0))
{
framesListView.Items.Clear();
activityLog.Print(string.Format("Measurement started"));
}
else
{
activityLog.Print("Failed to start a measurement");
}
}
}
private void stopMeasurementButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
if (dataStreamMeter.StopMeasurement(0, out storedFramesCount))
{
framesListView.Items.Clear();
activityLog.Print(string.Format("Measurement sopped, {0} frames acquired", storedFramesCount));
}
else
{
activityLog.Print("Failed to stop the measurement");
}
}
}
private void getFramesButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
GetFrameBoundariesDlg dlg = new GetFrameBoundariesDlg("Enter frames range boundaries", 0, storedFramesCount - 1);
if (dlg.ShowDialog() != DialogResult.OK) return;
DataFrame[] frames = dataStreamMeter.GetFrames(0, dlg.From, Convert.ToInt32(dlg.To - dlg.From + 1));
{
foreach (var frame in frames)
{
if (frame != null) framesListView.Items.Add(GetListViewItem(frame));
}
}
}
}
private void getIDButton_Click(object sender, EventArgs e)
{
if (dataStreamMeter == null)
ShowNoMeterInterfaceMessage();
else
{
GetDblValueDlg dlg = new GetDblValueDlg("Enter time in seconds");
if (dlg.ShowDialog() == DialogResult.OK)
{
Int64 id = dataStreamMeter.GetID(0, dlg.DblValue);
activityLog.Print(string.Format("GetID({0}) returned {1}", dlg.DblValue, id));
}
}
}
ListViewItem GetListViewItem(DataFrame frame)
{
ListViewItem lvi = new ListViewItem(frame.ID.ToString());
lvi.SubItems.Add(frame.Time.ToString());
lvi.SubItems.Add(frame.Volume.ToString());
StringBuilder sb = new StringBuilder();
foreach (var quantity in frame.Quantity)
{
sb.Append(quantity.ToString());
sb.Append(" ");
}
lvi.SubItems.Add(sb.ToString());
lvi.Tag = frame;
return lvi;
}
}
}
+88
View File
@@ -0,0 +1,88 @@
namespace DataStreamInterfaceTest
{
partial class GetDblValueDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.valueTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// valueTextBox
//
this.valueTextBox.Location = new System.Drawing.Point(35, 20);
this.valueTextBox.Name = "valueTextBox";
this.valueTextBox.Size = new System.Drawing.Size(94, 20);
this.valueTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(216, 16);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 29);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(306, 16);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 29);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// GetFlowDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(396, 58);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.valueTextBox);
this.Name = "GetFlowDlg";
this.Text = "Enter flow";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox valueTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Globalization;
using System.Windows.Forms;
namespace DataStreamInterfaceTest
{
public partial class GetDblValueDlg : Form
{
public double DblValue;
double lowerLimit;
double upperLimit;
public GetDblValueDlg()
: this("Enter flow in [m3/h] please")
{
}
public GetDblValueDlg(string title)
: this(title, 0, 100.0)
{
}
public GetDblValueDlg(string title, double lowerLimit, double upperLimit)
{
InitializeComponent();
this.Text = title;
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
}
private void okButton_Click(object sender, EventArgs e)
{
double val;
if (TryParseUDouble(valueTextBox.Text, out val))
{
DblValue = val;
DialogResult = DialogResult.OK;
Close();
}
else
{
MessageBox.Show("Invalid value");
DialogResult = DialogResult.None;
}
}
/// <summary>
/// Parse an unsigned double number
/// </summary>
bool TryParseUDouble(string text, out double result)
{
return double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out result) ||
double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result);
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+126
View File
@@ -0,0 +1,126 @@
namespace DataStreamInterfaceTest
{
partial class GetFrameBoundariesDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.fromTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.toTextBox = new System.Windows.Forms.TextBox();
this.fromLabel = new System.Windows.Forms.Label();
this.toLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// fromTextBox
//
this.fromTextBox.Location = new System.Drawing.Point(89, 16);
this.fromTextBox.Name = "fromTextBox";
this.fromTextBox.Size = new System.Drawing.Size(100, 20);
this.fromTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(225, 24);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 36);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(316, 24);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 36);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// toTextBox
//
this.toTextBox.Location = new System.Drawing.Point(89, 46);
this.toTextBox.Name = "toTextBox";
this.toTextBox.Size = new System.Drawing.Size(100, 20);
this.toTextBox.TabIndex = 3;
//
// fromLabel
//
this.fromLabel.AutoSize = true;
this.fromLabel.Location = new System.Drawing.Point(12, 19);
this.fromLabel.Name = "fromLabel";
this.fromLabel.Size = new System.Drawing.Size(30, 13);
this.fromLabel.TabIndex = 4;
this.fromLabel.Text = "From";
//
// toLabel
//
this.toLabel.AutoSize = true;
this.toLabel.Location = new System.Drawing.Point(12, 49);
this.toLabel.Name = "toLabel";
this.toLabel.Size = new System.Drawing.Size(20, 13);
this.toLabel.TabIndex = 5;
this.toLabel.Text = "To";
//
// GetFrameBoundariesDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(419, 79);
this.ControlBox = false;
this.Controls.Add(this.toLabel);
this.Controls.Add(this.fromLabel);
this.Controls.Add(this.toTextBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.fromTextBox);
this.Name = "GetFrameBoundariesDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Enter frames range boundaries";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox fromTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox toTextBox;
private System.Windows.Forms.Label fromLabel;
private System.Windows.Forms.Label toLabel;
}
}
@@ -0,0 +1,88 @@
using System;
using System.Windows.Forms;
namespace DataStreamInterfaceTest
{
public partial class GetFrameBoundariesDlg : Form
{
/// <summary>
/// Integer number entered in this form
/// </summary>
public Int64 From;
public Int64 To;
Int64 lowerLimit;
Int64 upperLimit;
/// <summary>
/// Default constructor
/// </summary>
public GetFrameBoundariesDlg()
: this("Enter state please")
{
}
/// <summary>
/// Constructor with a custom window title.
/// </summary>
/// <param name="title">Window title</param>
public GetFrameBoundariesDlg(string title)
: this(title, Int64.MinValue, Int64.MaxValue)
{
}
/// <summary>
/// Constructor with a custom window title, limits and non-empty initial value.
/// </summary>
/// <param name="title">Window title</param>
/// <param name="lowerLimit">Lower limit</param>
/// <param name="upperLimit">Upper limit</param>
/// <param name="initialValue">Initial value</param>
public GetFrameBoundariesDlg(string title, Int64 lowerLimit, Int64 upperLimit, int initialValue)
: this(title, lowerLimit, upperLimit)
{
fromTextBox.Text = initialValue.ToString();
}
/// <summary>
/// Constructor with a custom window title and lower/upper limits.
/// </summary>
/// <param name="title">Window title</param>
/// <param name="lowerLimit">Lower limit</param>
/// <param name="upperLimit">Upper limit</param>
public GetFrameBoundariesDlg(string title, Int64 lowerLimit, Int64 upperLimit)
{
InitializeComponent();
this.Text = title;
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
}
/// <summary>
/// OK button handler that verifies validity of the entered value.
/// </summary>
private void okButton_Click(object sender, EventArgs e)
{
Int64 from;
Int64 to;
if (Int64.TryParse(fromTextBox.Text, out from) && from >= lowerLimit && from <= upperLimit &&
Int64.TryParse(toTextBox.Text, out to) && to >= lowerLimit && to <= upperLimit &&
to >= from && to < from + Int32.MaxValue)
{
From = from;
To = to;
DialogResult = DialogResult.OK;
}
else
{
string message = (lowerLimit != 0 || upperLimit != Int32.MaxValue)
? string.Format("Invalid boundaries ({0}..{1})", lowerLimit, upperLimit)
: "Invalid boundaries";
MessageBox.Show(message);
DialogResult = DialogResult.None; /// Prevent closing this window
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+90
View File
@@ -0,0 +1,90 @@
namespace DataStreamInterfaceTest
{
partial class GetIntegerNumberDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.numberTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// numberTextBox
//
this.numberTextBox.Location = new System.Drawing.Point(36, 16);
this.numberTextBox.Name = "numberTextBox";
this.numberTextBox.Size = new System.Drawing.Size(100, 20);
this.numberTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(174, 7);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 36);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(265, 7);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 36);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// GetIntegerNumberDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(363, 50);
this.ControlBox = false;
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.numberTextBox);
this.Name = "GetIntegerNumberDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Enter integer number please";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox numberTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -0,0 +1,83 @@
using System;
using System.Windows.Forms;
namespace DataStreamInterfaceTest
{
public partial class GetIntegerNumberDlg : Form
{
/// <summary>
/// Integer number entered in this form
/// </summary>
public int Number;
int lowerLimit;
int upperLimit;
/// <summary>
/// Default constructor
/// </summary>
public GetIntegerNumberDlg()
: this("Enter integer number please")
{
}
/// <summary>
/// Constructor with a custom window title.
/// </summary>
/// <param name="title">Window title</param>
public GetIntegerNumberDlg(string title)
: this(title, Int32.MinValue, Int32.MaxValue)
{
}
/// <summary>
/// Constructor with a custom window title, limits and non-empty initial value.
/// </summary>
/// <param name="title">Window title</param>
/// <param name="lowerLimit">Lower limit</param>
/// <param name="upperLimit">Upper limit</param>
/// <param name="initialValue">Initial value</param>
public GetIntegerNumberDlg(string title, int lowerLimit, int upperLimit, int initialValue)
: this(title, lowerLimit, upperLimit)
{
numberTextBox.Text = initialValue.ToString();
}
/// <summary>
/// Constructor with a custom window title and lower/upper limits.
/// </summary>
/// <param name="title">Window title</param>
/// <param name="lowerLimit">Lower limit</param>
/// <param name="upperLimit">Upper limit</param>
public GetIntegerNumberDlg(string title, int lowerLimit, int upperLimit)
{
InitializeComponent();
this.Text = title;
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
}
/// <summary>
/// OK button handler that verifies validity of the entered value.
/// </summary>
private void okButton_Click(object sender, EventArgs e)
{
int number;
if (int.TryParse(numberTextBox.Text, out number) && number >= lowerLimit && number <= upperLimit)
{
Number = number;
DialogResult = DialogResult.OK;
}
else
{
string message = (lowerLimit != Int32.MinValue || upperLimit != Int32.MaxValue)
? string.Format("Invalid integer number ({0}..{1})", lowerLimit, upperLimit)
: "Invalid integer number";
MessageBox.Show(message);
DialogResult = DialogResult.None; /// Prevent closing this window
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+126
View File
@@ -0,0 +1,126 @@
namespace DataStreamInterfaceTest
{
partial class GetStateDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.stateTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.parameterTextBox = new System.Windows.Forms.TextBox();
this.stateLabel = new System.Windows.Forms.Label();
this.parameterLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// stateTextBox
//
this.stateTextBox.Location = new System.Drawing.Point(89, 16);
this.stateTextBox.Name = "stateTextBox";
this.stateTextBox.Size = new System.Drawing.Size(100, 20);
this.stateTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(225, 24);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 36);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(316, 24);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 36);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// parameterTextBox
//
this.parameterTextBox.Location = new System.Drawing.Point(89, 46);
this.parameterTextBox.Name = "parameterTextBox";
this.parameterTextBox.Size = new System.Drawing.Size(100, 20);
this.parameterTextBox.TabIndex = 3;
//
// stateLabel
//
this.stateLabel.AutoSize = true;
this.stateLabel.Location = new System.Drawing.Point(12, 19);
this.stateLabel.Name = "stateLabel";
this.stateLabel.Size = new System.Drawing.Size(32, 13);
this.stateLabel.TabIndex = 4;
this.stateLabel.Text = "State";
//
// parameterLabel
//
this.parameterLabel.AutoSize = true;
this.parameterLabel.Location = new System.Drawing.Point(12, 49);
this.parameterLabel.Name = "parameterLabel";
this.parameterLabel.Size = new System.Drawing.Size(55, 13);
this.parameterLabel.TabIndex = 5;
this.parameterLabel.Text = "Parameter";
//
// GetStateDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(419, 79);
this.ControlBox = false;
this.Controls.Add(this.parameterLabel);
this.Controls.Add(this.stateLabel);
this.Controls.Add(this.parameterTextBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.stateTextBox);
this.Name = "GetStateDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Enter state please";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox stateTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox parameterTextBox;
private System.Windows.Forms.Label stateLabel;
private System.Windows.Forms.Label parameterLabel;
}
}
+85
View File
@@ -0,0 +1,85 @@
using System;
using System.Windows.Forms;
namespace DataStreamInterfaceTest
{
public partial class GetStateDlg : Form
{
/// <summary>
/// Integer number entered in this form
/// </summary>
public int State;
public string Parameter;
int lowerLimit;
int upperLimit;
/// <summary>
/// Default constructor
/// </summary>
public GetStateDlg()
: this("Enter state please")
{
}
/// <summary>
/// Constructor with a custom window title.
/// </summary>
/// <param name="title">Window title</param>
public GetStateDlg(string title)
: this(title, Int32.MinValue, Int32.MaxValue)
{
}
/// <summary>
/// Constructor with a custom window title, limits and non-empty initial value.
/// </summary>
/// <param name="title">Window title</param>
/// <param name="lowerLimit">Lower limit</param>
/// <param name="upperLimit">Upper limit</param>
/// <param name="initialValue">Initial value</param>
public GetStateDlg(string title, int lowerLimit, int upperLimit, int initialValue)
: this(title, lowerLimit, upperLimit)
{
stateTextBox.Text = initialValue.ToString();
}
/// <summary>
/// Constructor with a custom window title and lower/upper limits.
/// </summary>
/// <param name="title">Window title</param>
/// <param name="lowerLimit">Lower limit</param>
/// <param name="upperLimit">Upper limit</param>
public GetStateDlg(string title, int lowerLimit, int upperLimit)
{
InitializeComponent();
this.Text = title;
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
}
/// <summary>
/// OK button handler that verifies validity of the entered value.
/// </summary>
private void okButton_Click(object sender, EventArgs e)
{
int number;
if (int.TryParse(stateTextBox.Text, out number) && number >= lowerLimit && number <= upperLimit)
{
State = number;
Parameter = parameterTextBox.Text;
DialogResult = DialogResult.OK;
}
else
{
string message = (lowerLimit != Int32.MinValue || upperLimit != Int32.MaxValue)
? string.Format("Invalid state ({0}..{1})", lowerLimit, upperLimit)
: "Invalid state";
MessageBox.Show(message);
DialogResult = DialogResult.None; /// Prevent closing this window
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections;
using System.Windows.Forms;
namespace DataStreamInterfaceTest
{
public class LviIDComparer : IComparer
{
int column;
SortOrder order;
public LviIDComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviIDComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
Int64 valX = Int64.Parse(((ListViewItem)x).SubItems[column].Text);
Int64 valY = Int64.Parse(((ListViewItem)y).SubItems[column].Text);
if (order == SortOrder.Ascending)
{
return valX > valY ? 1 : valX == valY ? 0 : -1;
}
else
{
return valX < valY ? 1 : valX == valY ? 0 : -1;
}
}
}
}
+55
View File
@@ -0,0 +1,55 @@
using System;
using System.IO;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Windows.Forms;
using DataStreamInterface;
namespace DataStreamInterfaceTest
{
class Program
{
#if DEBUG
const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Debug";
#else
const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Release";
#endif
[Import(typeof(IDataStreamMeter))]
IDataStreamMeter dataStreamMeter;
private Program()
{
Console.WriteLine("Components found:");
foreach (var file in Directory.EnumerateFiles(CatalogDir))
{
Console.WriteLine(file);
}
try
{
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(typeof(DataStreamInterface.IDataStreamMeter).Assembly));
catalog.Catalogs.Add(new DirectoryCatalog(CatalogDir));
(new CompositionContainer(catalog)).ComposeParts(this);
}
catch (CompositionException compositionException)
{
Console.WriteLine(compositionException.ToString());
}
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Program p = new Program();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new DemoMainWnd(p.dataStreamMeter));
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DataStreamInterfaceTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DataStreamInterfaceTest")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("429fdea9-ec3a-47d8-88b3-5df11de8b4c8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+71
View File
@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataStreamInterfaceTest.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataStreamMainDemo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+30
View File
@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataStreamInterfaceTest.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+85
View File
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E6925701-57A6-4167-B5C4-BF670F1DE310}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataStreamMeter</RootNamespace>
<AssemblyName>DataStreamMeter</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GetDblValueDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GetDblValueDlg.Designer.cs">
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
</Compile>
<Compile Include="MeterDataEventArgs.cs" />
<Compile Include="MeterSimulationDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MeterSimulationDlg.Designer.cs">
<DependentUpon>MeterSimulationDlg.cs</DependentUpon>
</Compile>
<Compile Include="MeterSimulation.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sample.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DataStreamInterface\DataStreamInterface.csproj">
<Project>{7ebeea14-91c4-48d7-af0a-7a4bc3ff9a28}</Project>
<Name>DataStreamInterface</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="GetDblValueDlg.resx">
<DependentUpon>GetDblValueDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MeterSimulationDlg.resx">
<DependentUpon>MeterSimulationDlg.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+88
View File
@@ -0,0 +1,88 @@
namespace DataStreamMeter
{
partial class GetDblValueDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.valueTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// valueTextBox
//
this.valueTextBox.Location = new System.Drawing.Point(35, 20);
this.valueTextBox.Name = "valueTextBox";
this.valueTextBox.Size = new System.Drawing.Size(94, 20);
this.valueTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(216, 16);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 29);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(306, 16);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 29);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// GetFlowDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(396, 58);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.valueTextBox);
this.Name = "GetFlowDlg";
this.Text = "Enter flow";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox valueTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Globalization;
using System.Windows.Forms;
namespace DataStreamMeter
{
public partial class GetDblValueDlg : Form
{
public double DblValue;
double lowerLimit;
double upperLimit;
public GetDblValueDlg()
: this("Enter flow in [m3/h] please")
{
}
public GetDblValueDlg(string title)
: this(title, 0, 100.0)
{
}
public GetDblValueDlg(string title, double lowerLimit, double upperLimit)
{
InitializeComponent();
this.Text = title;
this.lowerLimit = lowerLimit;
this.upperLimit = upperLimit;
}
private void okButton_Click(object sender, EventArgs e)
{
double val;
if (TryParseUDouble(valueTextBox.Text, out val))
{
DblValue = val;
DialogResult = DialogResult.OK;
Close();
}
else
{
MessageBox.Show("Invalid value");
DialogResult = DialogResult.None;
}
}
/// <summary>
/// Parse an unsigned double number
/// </summary>
bool TryParseUDouble(string text, out double result)
{
return double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out result) ||
double.TryParse(text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result);
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+20
View File
@@ -0,0 +1,20 @@
using System;
namespace DataStreamMeter
{
public class MeterDataEventArgs : EventArgs
{
public State State;
public double Time;
public double Volume;
public double Flow;
public MeterDataEventArgs(State state, double time, double volume, double flow)
{
State = state;
Time = time;
Volume = volume;
Flow = flow;
}
}
}
+351
View File
@@ -0,0 +1,351 @@
using System;
using System.ComponentModel.Composition;
using DataStreamInterface;
namespace DataStreamMeter
{
[Export(typeof(IDataStreamMeter))]
public class MeterSimulation : IDataStreamMeter
{
MeterSimulationDlg modelessDlg;
/// Water meter specification
public readonly string MeterID = "3141592653";
public const Unit TimeUnits = Unit.s; /// Unit.s, Unit.ms, ...
public const Unit VolumeUnits = Unit.l; /// Unit.l, Unit.USgal, ...
public const Unit FlowUnits = Unit.m3ph; /// Unit.m3ph, Unit.USgalps, Unit.cfs, ...
public const double SamplingPeriodSec = 0.125; /// Sampling period in seconds (here 125 ms, 8 Hz)
public readonly double SamplingPeriod;
public const Int64 MaxSamplesCount = 40000; /// Maximal test time is SamplingPeriod * MaxSamplesCount
Sample[] samples = new Sample[MaxSamplesCount];
Int64 storedSamplesCount;
readonly object stateChangeAndTimerTickLock = new object();
public State State;
string connectionParameters;
/// initialTime is time when simulation started
/// (lastSampleTime - initialTime).TotalSeconds is multiple of Sampling Period
DateTime initialTime;
/// Last user interface tick info
bool lastTickValid;
State lastTickState;
/// Values incrementally updated on each timer tick
double currentTime;
double currentVolume;
double currentFlow;
double currentFlow_m3ph;
DateTime startTimeStamp; /// Measurement start DateTime
double startTime; /// Measurement start time in seconds
DateTime stopTimeStamp; /// Measurement end DateTime
double stopTime; /// Measurement end time in seconds
public MeterSimulation()
{
modelessDlg = null;
State = State.Disconnected;
SamplingPeriod = DataStreamInterface.Units.ConvertTo(TimeUnits, SamplingPeriodSec);
lastTickValid = false;
initialTime = DateTime.Now.Date; /// An arbitrary initial time (in this case the last midnight)
}
public Unit GetTimeUnits()
{
return TimeUnits;
}
public Unit GetVolumeUnits()
{
return VolumeUnits;
}
public int GetQuantitiesCount()
{
return 1;
}
public string GetQuantityCaption(int quantityNr)
{
if (quantityNr == 0) return "Flow";
return string.Empty;
}
public Unit GetQuantityUnits(int quantityNr)
{
if (quantityNr == 0) return FlowUnits;
return Unit.None;
}
public int GetMetersCount()
{
return 1;
}
public bool OpenConnection(int meterIx, string connectionParameters, out string meterID)
{
lock (stateChangeAndTimerTickLock)
{
if (State != State.Disconnected)
{
/// Meter is already connected
meterID = MeterID;
return true;
}
/// Connect the meter
meterID = MeterID;
this.connectionParameters = connectionParameters;
lastTickValid = false;
State = State.Connected;
}
/// Open modeless form
modelessDlg = new MeterSimulationDlg(this, MeterID);
modelessDlg.Show();
return true;
}
public bool CloseConnection(int meterIx)
{
bool closeModelessDlg = false;
lock (stateChangeAndTimerTickLock)
{
if (State != State.Disconnected)
{
State = State.Disconnected;
storedSamplesCount = 0;
closeModelessDlg = true;
}
}
if (closeModelessDlg)
{
if (modelessDlg != null) modelessDlg.Close();
modelessDlg = null;
}
return true;
}
public bool CloseConnectionAll()
{
return CloseConnection(0);
}
public bool Shutdown()
{
return true;
}
public bool GetState(int meterIx, out int state, out string parameter)
{
state = (int)this.State;
parameter = this.connectionParameters;
return true;
}
public bool SetState(int meterIx, int state, string parameter)
{
/// It's not allowed to change the satate in this demo
return false;
}
public bool SetStateAll(int state, string parameter)
{
return SetState(0, state, parameter);
}
public bool StartMeasurement(int meterIx = 0)
{
lock (stateChangeAndTimerTickLock)
{
if (State == State.Connected)
{
startTimeStamp = DateTime.Now;
startTime = TimeInSecondsFromDateTime(startTimeStamp, initialTime, SamplingPeriodSec);
storedSamplesCount = 0;
State = State.MeasurementInProgress;
return true;
}
else
{
return false;
}
}
}
public bool StartMeasurementAll()
{
return StartMeasurement(0);
}
public bool StopMeasurement(int meterIx, out Int64 storedFramesCount)
{
lock (stateChangeAndTimerTickLock)
{
if (State == State.MeasurementInProgress)
{
stopTimeStamp = DateTime.Now;
stopTime = TimeInSecondsFromDateTime(stopTimeStamp, initialTime, SamplingPeriodSec);
int newSamplesCount = Convert.ToInt32(Math.Round((stopTime - currentTime) / SamplingPeriodSec));
double time = Units.ConvertTo(TimeUnits, currentTime);
double volume = currentVolume;
double volumeIncrement = Units.ConvertTo(VolumeUnits, currentFlow_m3ph * (SamplingPeriodSec / 3.6));
for (int i = 0; i < newSamplesCount; i++)
{
time += SamplingPeriod;
volume += volumeIncrement;
if (storedSamplesCount < MaxSamplesCount)
{
samples[storedSamplesCount++] = new Sample(time, volume, currentFlow);
}
}
State = State.Connected;
storedFramesCount = storedSamplesCount;
return true;
}
else
{
storedFramesCount = 0;
return false;
}
}
}
public bool StopMeasurementAll(out Int64[] storedFramesCount)
{
storedFramesCount = new Int64[1];
return StopMeasurement(0, out storedFramesCount[0]);
}
public void TimerTick(double flow_m3ph)
{
lock (stateChangeAndTimerTickLock)
{
double lastSampleTime = TimeInSecondsFromDateTime(DateTime.Now, initialTime, SamplingPeriodSec);
currentFlow_m3ph = flow_m3ph;
currentFlow = Units.ConvertTo(FlowUnits, flow_m3ph);
if (!lastTickValid)
{
currentTime = lastSampleTime;
currentVolume = 0;
lastTickValid = true;
lastTickState = State;
return;
}
else
{
int newSamplesCount = Convert.ToInt32(Math.Round((lastSampleTime - currentTime) / SamplingPeriodSec));
double volumeIncrement = Units.ConvertTo(VolumeUnits, currentFlow_m3ph * (SamplingPeriodSec / 3.6));
for (int i = 0; i < newSamplesCount; i++)
{
currentTime += SamplingPeriodSec;
currentVolume += volumeIncrement;
if (State == State.MeasurementInProgress && currentTime > startTime && storedSamplesCount < MaxSamplesCount)
{
samples[storedSamplesCount++] = new Sample(Units.ConvertTo(TimeUnits, currentTime), currentVolume, currentFlow);
}
}
currentTime = lastSampleTime; /// Rectify, prevent error propagation
lastTickState = State;
}
}
modelessDlg.OnMeterdata(new MeterDataEventArgs(State, currentTime, currentVolume, currentFlow));
}
/// <summary>
/// Obtain the last time instance before 'DateTime time' which is multiple of samplingPeriod-s after 'DateTime initialTime'.
/// </summary>
/// <param name="time">Time to be converted to seconds and rounded to samplingPeriod-s</param>
/// <param name="startTime">Initial time</param>
/// <param name="samplePeriod">Sampling period in seconds</param>
/// <returns></returns>
double TimeInSecondsFromDateTime(DateTime time, DateTime initialTime, double samplingPeriod)
{
TimeSpan span = time - initialTime;
return samplingPeriod * Math.Floor(span.TotalSeconds / samplingPeriod);
}
///---------------------------
/// Datastream data exchange
///---------------------------
/// <summary>
/// Retuns 'count' data frames starting with data frame with ID = 'id'
/// </summary>
/// <param name="id">First frame ID</param>
/// <param name="count">Frames count</param>
/// <returns>Selected data frames</returns>
public DataFrame[] GetFrames(int meterIx, Int64 startID, int count)
{
DataFrame[] frames = new DataFrame[count];
if (State != State.MeasurementInProgress)
{
for (int j = 0; j < count; j++)
{
Int64 id = startID + j;
if (id < storedSamplesCount)
{
frames[j] = new DataFrame(id, samples[id].Time, samples[id].Volume, new double[1] { samples[id].Flow });
}
}
}
return frames;
}
/// <summary>
/// Returns ID of the data frame where time equals or exceeds the specified time.
/// When time of the first frame (ID=0) is larger then specified time, function returns 0.
/// </summary>
/// <param name="time">Time</param>
/// <returns>ID of the data frame at or after the pecified time</returns>
public Int64 GetID(int meterIx, double time)
{
if (storedSamplesCount == 0) return -1;
Int64 lo = 0;
Int64 hi = storedSamplesCount - 1;
if (samples[hi].Time < time) return -1;
while (lo < hi)
{
Int64 mid = (lo + hi) / 2;
if (samples[mid].Time < time)
{
lo = mid + 1;
}
else
{
hi = mid;
}
}
return lo;
}
}
public enum State
{
Disconnected = 0,
Connected = 1,
MeasurementInProgress = 2,
}
}
+323
View File
@@ -0,0 +1,323 @@
namespace DataStreamMeter
{
partial class MeterSimulationDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.meterIDGroupBox = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.volumeUnitsTextBox = new System.Windows.Forms.TextBox();
this.timeUnitsTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.meterIDTextBox = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.setFlowButton = new System.Windows.Forms.Button();
this.flowm3phTextBox = new System.Windows.Forms.TextBox();
this.flowTrackBar = new System.Windows.Forms.TrackBar();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.flowTextBox = new System.Windows.Forms.TextBox();
this.volumeTextBox = new System.Windows.Forms.TextBox();
this.timeTextBox = new System.Windows.Forms.TextBox();
this.stateTextBox = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.lastUITickTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.meterIDGroupBox.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.flowTrackBar)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// meterIDGroupBox
//
this.meterIDGroupBox.Controls.Add(this.label3);
this.meterIDGroupBox.Controls.Add(this.label2);
this.meterIDGroupBox.Controls.Add(this.volumeUnitsTextBox);
this.meterIDGroupBox.Controls.Add(this.timeUnitsTextBox);
this.meterIDGroupBox.Controls.Add(this.label1);
this.meterIDGroupBox.Controls.Add(this.meterIDTextBox);
this.meterIDGroupBox.Location = new System.Drawing.Point(12, 12);
this.meterIDGroupBox.Name = "meterIDGroupBox";
this.meterIDGroupBox.Size = new System.Drawing.Size(453, 105);
this.meterIDGroupBox.TabIndex = 0;
this.meterIDGroupBox.TabStop = false;
this.meterIDGroupBox.Text = "Water meter info";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(18, 76);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(67, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Volume units";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 50);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Time units";
//
// volumeUnitsTextBox
//
this.volumeUnitsTextBox.Enabled = false;
this.volumeUnitsTextBox.Location = new System.Drawing.Point(122, 73);
this.volumeUnitsTextBox.Name = "volumeUnitsTextBox";
this.volumeUnitsTextBox.Size = new System.Drawing.Size(52, 20);
this.volumeUnitsTextBox.TabIndex = 3;
//
// timeUnitsTextBox
//
this.timeUnitsTextBox.Enabled = false;
this.timeUnitsTextBox.Location = new System.Drawing.Point(122, 47);
this.timeUnitsTextBox.Name = "timeUnitsTextBox";
this.timeUnitsTextBox.Size = new System.Drawing.Size(52, 20);
this.timeUnitsTextBox.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(18, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(73, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Meter ID (s/n)";
//
// meterIDTextBox
//
this.meterIDTextBox.Enabled = false;
this.meterIDTextBox.Location = new System.Drawing.Point(122, 21);
this.meterIDTextBox.Name = "meterIDTextBox";
this.meterIDTextBox.Size = new System.Drawing.Size(145, 20);
this.meterIDTextBox.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.setFlowButton);
this.groupBox1.Controls.Add(this.flowm3phTextBox);
this.groupBox1.Controls.Add(this.flowTrackBar);
this.groupBox1.Location = new System.Drawing.Point(12, 123);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(453, 96);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Flow";
//
// setFlowButton
//
this.setFlowButton.Location = new System.Drawing.Point(289, 17);
this.setFlowButton.Name = "setFlowButton";
this.setFlowButton.Size = new System.Drawing.Size(75, 23);
this.setFlowButton.TabIndex = 4;
this.setFlowButton.Text = "Set value";
this.setFlowButton.UseVisualStyleBackColor = true;
this.setFlowButton.Click += new System.EventHandler(this.setFlowButton_Click);
//
// flowm3phTextBox
//
this.flowm3phTextBox.Enabled = false;
this.flowm3phTextBox.Location = new System.Drawing.Point(122, 19);
this.flowm3phTextBox.Name = "flowm3phTextBox";
this.flowm3phTextBox.Size = new System.Drawing.Size(145, 20);
this.flowm3phTextBox.TabIndex = 3;
//
// flowTrackBar
//
this.flowTrackBar.LargeChange = 1;
this.flowTrackBar.Location = new System.Drawing.Point(0, 43);
this.flowTrackBar.Maximum = 25;
this.flowTrackBar.Name = "flowTrackBar";
this.flowTrackBar.Size = new System.Drawing.Size(447, 45);
this.flowTrackBar.TabIndex = 2;
this.flowTrackBar.Scroll += new System.EventHandler(this.flowTrackBar_Scroll);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.flowTextBox);
this.groupBox2.Controls.Add(this.volumeTextBox);
this.groupBox2.Controls.Add(this.timeTextBox);
this.groupBox2.Controls.Add(this.stateTextBox);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.lastUITickTextBox);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Location = new System.Drawing.Point(12, 225);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(453, 150);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "State";
//
// flowTextBox
//
this.flowTextBox.Enabled = false;
this.flowTextBox.Location = new System.Drawing.Point(122, 121);
this.flowTextBox.Name = "flowTextBox";
this.flowTextBox.Size = new System.Drawing.Size(99, 20);
this.flowTextBox.TabIndex = 9;
//
// volumeTextBox
//
this.volumeTextBox.Enabled = false;
this.volumeTextBox.Location = new System.Drawing.Point(122, 95);
this.volumeTextBox.Name = "volumeTextBox";
this.volumeTextBox.Size = new System.Drawing.Size(99, 20);
this.volumeTextBox.TabIndex = 8;
//
// timeTextBox
//
this.timeTextBox.Enabled = false;
this.timeTextBox.Location = new System.Drawing.Point(122, 68);
this.timeTextBox.Name = "timeTextBox";
this.timeTextBox.Size = new System.Drawing.Size(99, 20);
this.timeTextBox.TabIndex = 7;
//
// stateTextBox
//
this.stateTextBox.Enabled = false;
this.stateTextBox.Location = new System.Drawing.Point(122, 42);
this.stateTextBox.Name = "stateTextBox";
this.stateTextBox.Size = new System.Drawing.Size(99, 20);
this.stateTextBox.TabIndex = 6;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(18, 124);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(29, 13);
this.label8.TabIndex = 5;
this.label8.Text = "Flow";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(18, 98);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(42, 13);
this.label7.TabIndex = 4;
this.label7.Text = "Volume";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(18, 71);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(30, 13);
this.label6.TabIndex = 3;
this.label6.Text = "Time";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(18, 45);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 13);
this.label5.TabIndex = 2;
this.label5.Text = "State";
//
// lastUITickTextBox
//
this.lastUITickTextBox.Enabled = false;
this.lastUITickTextBox.Location = new System.Drawing.Point(122, 13);
this.lastUITickTextBox.Name = "lastUITickTextBox";
this.lastUITickTextBox.Size = new System.Drawing.Size(145, 20);
this.lastUITickTextBox.TabIndex = 1;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(18, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(61, 13);
this.label4.TabIndex = 0;
this.label4.Text = "Last UI tick";
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// MeterSimulationDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(477, 387);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.meterIDGroupBox);
this.Name = "MeterSimulationDlg";
this.Text = "MeterDialog";
this.meterIDGroupBox.ResumeLayout(false);
this.meterIDGroupBox.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.flowTrackBar)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox meterIDGroupBox;
private System.Windows.Forms.TextBox meterIDTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox volumeUnitsTextBox;
private System.Windows.Forms.TextBox timeUnitsTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox flowm3phTextBox;
private System.Windows.Forms.TrackBar flowTrackBar;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button setFlowButton;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.TextBox lastUITickTextBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox flowTextBox;
private System.Windows.Forms.TextBox volumeTextBox;
private System.Windows.Forms.TextBox timeTextBox;
private System.Windows.Forms.TextBox stateTextBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
}
}
+91
View File
@@ -0,0 +1,91 @@
using System;
using System.Windows.Forms;
namespace DataStreamMeter
{
public partial class MeterSimulationDlg : Form
{
MeterSimulation meterSimulation;
double currentFlow;
public string MeterID;
public void OnMeterdata(MeterDataEventArgs args)
{
if (MeterDataHandler == null) return;
MeterDataHandler(null, args);
}
public event EventHandler<MeterDataEventArgs> MeterDataHandler;
/// <summary>
/// Default constructor with no meter
/// </summary>
public MeterSimulationDlg()
: this(null, string.Empty)
{
}
public MeterSimulationDlg(MeterSimulation meterSimulation, string meterID)
{
InitializeComponent();
this.meterSimulation = meterSimulation;
meterIDTextBox.Text = meterID;
currentFlow = 0;
flowm3phTextBox.Text = currentFlow.ToString();
flowTrackBar.Value = Convert.ToInt32(currentFlow);
MeterDataHandler += delegate(object sender, MeterDataEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<MeterDataEventArgs>(DisplayMeterData), sender, args);
}
else
{
DisplayMeterData(sender, args);
}
};
if (meterSimulation != null)
{
timer1.Enabled = true;
timer1.Start();
}
}
private void flowTrackBar_Scroll(object sender, EventArgs e)
{
currentFlow = flowTrackBar.Value;
flowm3phTextBox.Text = currentFlow.ToString("F2");
}
private void setFlowButton_Click(object sender, EventArgs e)
{
GetDblValueDlg dlg = new GetDblValueDlg("Enter flow in [m3/h] please", 0, 25.0);
if (dlg.ShowDialog() == DialogResult.OK)
{
currentFlow = dlg.DblValue;
flowm3phTextBox.Text = currentFlow.ToString();
flowTrackBar.Value = Convert.ToInt32(currentFlow);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
lastUITickTextBox.Text = DateTime.Now.ToString("HH:mm:ss fff");
meterSimulation.TimerTick(currentFlow);
}
void DisplayMeterData(object sender, MeterDataEventArgs args)
{
stateTextBox.Text = args.State.ToString();
timeTextBox.Text = args.Time.ToString();
volumeTextBox.Text = args.Volume.ToString();
flowTextBox.Text = args.Flow.ToString();
}
}
}
+123
View File
@@ -0,0 +1,123 @@
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DataStreamMeter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DataStreamMeter")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8acd46eb-c84d-4199-9f40-7420b7ebabc2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+23
View File
@@ -0,0 +1,23 @@
using System;
namespace DataStreamMeter
{
public class Sample
{
public readonly double Time; /// In water meter time units
public readonly double Volume; /// In water meter colume units
public readonly double Flow; /// In water meter flow units
public Sample(double time, double volume, double flow)
{
Time = time;
Volume = volume;
Flow = flow;
}
public override string ToString()
{
return string.Format("time={0} volume={1} flow={2}", Time, Volume, Flow);
}
}
}
+4 -2
View File
@@ -645,7 +645,8 @@ namespace DeviceTest
MessageBoxIcon.Exclamation);
foreach (var dev in tbfDevices) dev.StopDevice();
tbfDevices.Clear();
foreach (var dev in tbfDevices) dev.StopDevice2();
tbfDevices.Clear();
startButton.Enabled = true;
stopButton.Enabled = false;
@@ -856,7 +857,8 @@ namespace DeviceTest
}
foreach (var d in tbfDevices) d.StopDevice();
}
foreach (var d in tbfDevices) d.StopDevice2();
}
private void stopButton_Click(object sender, EventArgs e)
{
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
+46
View File
@@ -0,0 +1,46 @@
using System;
using System.IO;
using TBF;
namespace ResetBatchNr
{
class Program
{
static LocalSettings ls;
static void Main(string[] args)
{
if (!Directory.Exists(TBF.Program.ConfigDir)) return;
Environment.CurrentDirectory = TBF.Program.ConfigDir;
ls = LocalSettings.Load(TBF.Program.LocalSettingsFileName);
if (ls == null || ls.TestBenches == null)
{
/// Loading local seetings from regular config file failed. Use the backup
ls = LocalSettings.Load(TBF.Program.LocalSettingsBackupName);
if (ls == null || ls.TestBenches == null)
{
/// Neither config.xml, nor config.backup.xml could be loaded
Console.WriteLine(string.Format("Could not load file {0}, nor {1}.", TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName));
Console.ReadLine();
return;
}
}
else
{
/// Loading local seetings from the regular config file was successful. Update the backup
File.Copy(TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName, true);
}
///
/// Process local settings so that windows are shifted to the 1st monitor
///
ls.BatchNr = 1;
ls.Save();
Console.WriteLine("BatchNr was reset to 1");
Console.ReadLine();
return;
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ResetBatchNr")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ResetBatchNr")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("de8130eb-2f43-46a6-9f5b-bf96432a0c7c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D7F5A111-B2DF-4761-9574-AB730DF573A6}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResetBatchNr</RootNamespace>
<AssemblyName>ResetBatchNr</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project>
<Name>TBF</Name>
</ProjectReference>
<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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+5 -4
View File
@@ -66,13 +66,13 @@ namespace Results
switch (dbType)
{
default:
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Users.Entities.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
case Users.Entities.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
}
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>());
@@ -311,6 +311,7 @@ namespace Results
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();
Binary file not shown.
Binary file not shown.
@@ -1,19 +1,24 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2020 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
namespace Results.Output.Printers.Enhanced
{
public class EnhancedPrintDocument : PrintDocument
{
/// Size of the printed area without margins, after taking into account 'pageOrientation'
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight;
readonly int printWidth;
@@ -23,12 +28,14 @@ namespace Results.Output.Printers.Enhanced
readonly int TitleX;
readonly int TitleY; /// Depends on the size of the header
readonly int SpacingOne;
readonly int SpacingOneAndHalf;
readonly int SpacingOne4Header;
readonly int SpacingOneAndHalf4Header;
readonly int spacingOne;
readonly int spacingOneAndHalf;
readonly int spacingOne4Header;
readonly int spacingOneAndHalf4Header;
readonly int spacingOne4Footer;
readonly int SpacingOne4Footer;
int spacingAboveTable;
int spacingBelowTable;
int CommonTop; /// = TitleY + 60
int BodyTop; /// = HdrTop + 160
@@ -124,11 +131,11 @@ namespace Results.Output.Printers.Enhanced
}
/// Document outline preliminary calculations
SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
SpacingOneAndHalf = (3 * SpacingOne) / 2;
SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
SpacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
spacingOneAndHalf = (3 * spacingOne) / 2;
spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
spacingOneAndHalf4Header = (3 * spacingOne4Header) / 2;
spacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
TitleX = cfg.LeftMargin;
TitleY = cfg.TopMargin;
@@ -178,17 +185,27 @@ namespace Results.Output.Printers.Enhanced
/// Prepare document outline
///----------
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
CommonTop = TitleY + titleHeight + SpacingOne4Header;
CommonTop = TitleY + titleHeight + spacingOne4Header;
commonHeight = commonItems.Count * SpacingOne;
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
commonHeight = commonItems.Count * spacingOne;
BodyTop = CommonTop + commonHeight + spacingOne4Header;
Table table0 = Table.Create_TestsAreRows(batch.WaterMeters[0], testItems, style);
SizeF tableSize = table0.Measure(e);
int wmSectionHeight = (int)tableSize.Height + SpacingOne4Header * ((tableSize.Height > 0) ? 3 : 2);
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
if (cfg.BarcodeType == BarcodeType.None)
{
spacingAboveTable = spacingOneAndHalf4Header;
}
else
{
spacingAboveTable = Math.Max(spacingOneAndHalf4Header, cfg.BarcodeHeight + spacingOne4Header / 2);
}
spacingBelowTable = (tableSize.Height > 0) ? spacingOneAndHalf4Header : (spacingOne4Header / 2);
int wmSectionHeight = (int)tableSize.Height + spacingAboveTable + spacingBelowTable;
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * spacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * spacingOne) / wmSectionHeight;
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
@@ -221,8 +238,8 @@ namespace Results.Output.Printers.Enhanced
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
PrintAt(e, leftMargin, CommonTop + SpacingOne * i, leftColumn[i]);
PrintAt(e, 300, CommonTop + SpacingOne * i, rightColumn[i]);
PrintAt(e, leftMargin, CommonTop + spacingOne * i, leftColumn[i]);
PrintAt(e, 300, CommonTop + spacingOne * i, rightColumn[i]);
}
}
@@ -241,7 +258,7 @@ namespace Results.Output.Printers.Enhanced
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
if (!cfg.GoodOnly || batch.WaterMeters[wmNr].Passed)
{
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + spacingBelowTable;
}
}
@@ -252,11 +269,11 @@ namespace Results.Output.Printers.Enhanced
/// Footer
///----------
int footerWidth = (int)e.Graphics.MeasureString(footer, footerFont).Width;
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * spacingOne, footer);
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
int pageNrWidth = (int)e.Graphics.MeasureString(pageNrText, font).Width;
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - SpacingOne, pageNrText);
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, pageNrText);
}
@@ -270,25 +287,48 @@ namespace Results.Output.Printers.Enhanced
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
Results.Entities.WaterMeter wm, int printedWMNr, int top)
{
int tableTop = top + spacingAboveTable;
/// Print the water meter number and the serial number
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
PrintHeaderAt(e, leftMargin, top, wmText);
if (!string.IsNullOrEmpty(wm.SerialNr))
if (string.IsNullOrEmpty(wm.SerialNr))
{
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
}
else
{
string wmText = string.Format("{0} {1} {2} = {3}", Strings.Water_Meter, printedWMNr, Strings.sn, wm.SerialNr);
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
switch (cfg.BarcodeType)
{
case BarcodeType.Code_128_Horizontally:
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
case BarcodeType.Code_128_Vertically:
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
case BarcodeType.QR_Code:
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
}
}
Table table = Table.Create_TestsAreRows(wm, testItems, style);
if (table.IsEmpty())
{
return top;
}
else
{
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
}
return table.IsEmpty() ? tableTop : table.Draw(e, leftMargin, tableTop);
}
@@ -298,7 +338,7 @@ namespace Results.Output.Printers.Enhanced
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne);
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
}
@@ -309,7 +349,7 @@ namespace Results.Output.Printers.Enhanced
}
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Header);
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
}
@@ -320,8 +360,33 @@ namespace Results.Output.Printers.Enhanced
}
void PrintFooterAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Footer);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Footer);
e.Graphics.DrawString(text, this.footerFont, Brushes.Black, printArea);
}
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.Enhanced
@@ -30,5 +30,8 @@ namespace Results.Output.Printers.Enhanced
public string[] CommonItems;
public string[] TestItems;
public string Footer;
}
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeWidth;
public int BarcodeHeight;
}
}
@@ -1,12 +1,15 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
namespace Results.Output.Printers.OnePerMeter
@@ -16,7 +19,9 @@ namespace Results.Output.Printers.OnePerMeter
const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10;
/// Size of the printed area without margins, after taking into account 'pageOrientation'
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight;
readonly int printWidth;
@@ -158,6 +163,30 @@ namespace Results.Output.Printers.OnePerMeter
WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos);
}
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count && !string.IsNullOrEmpty(wm.SerialNr))
{
try
{
if (cfg.BarcodeType == BarcodeType.QR_Code)
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
e.Graphics.DrawImage(img, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
}
catch (Exception)
{
}
}
float tableTop = cfg.TopMargin;
if (pageNr == 1)
@@ -351,5 +380,30 @@ namespace Results.Output.Printers.OnePerMeter
pageNr++;
}
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.OnePerMeter
@@ -54,5 +54,10 @@ namespace Results.Output.Printers.OnePerMeter
public int ImgWid;
public int ImgHgh;
public string ImgFullPathName;
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
}
}
+11
View File
@@ -23,6 +23,7 @@ namespace Results.Output
Suez_EMP_DN32, /// EMP: 12 flow rates
Suez_EMP_DN40, /// EMP: 12 flow rates
Greece, /// Q3, Q2adj, Q2, Q1
S620, /// Q3, Q100, Q2, Q1
Count,
None,
}
@@ -414,6 +415,16 @@ namespace Results.Output
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
case LogType.S620:
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q3", 5, "Q3", 5, "04", 5, "Q3", Range.R90_100),
new SensusTestInfo("Q100", 4, "Q100l", 4, "03", 4,"Q100l", Range.R100_110),
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
}
}
+442 -28
View File
@@ -130,7 +130,7 @@
<value>Ergebnisse</value>
</data>
<data name="Batch_nr" xml:space="preserve">
<value>Stapel Nr.</value>
<value>Los Nr.</value>
</data>
<data name="Bench" xml:space="preserve">
<value>Prüfstand</value>
@@ -154,13 +154,13 @@
<value>Endzeit</value>
</data>
<data name="EndState_aux" xml:space="preserve">
<value>Eindstand Nebenz.</value>
<value>Endstand Nebenzähler</value>
</data>
<data name="EndState_main" xml:space="preserve">
<value>Eindstand Hauptz.</value>
<value>Endstand Hauptzähler</value>
</data>
<data name="End_state" xml:space="preserve">
<value>Eindstand</value>
<value>Endstand</value>
</data>
<data name="ErrLimHi" xml:space="preserve">
<value>Fehlergrenze hoch</value>
@@ -175,10 +175,10 @@
<value>Referenzfehler</value>
</data>
<data name="Err_aux" xml:space="preserve">
<value>Fehler Nebenz.</value>
<value>Fehler Nebenzähler</value>
</data>
<data name="Err_main" xml:space="preserve">
<value>Fehler Hauptz.</value>
<value>Fehler Hauptzähler</value>
</data>
<data name="Flow" xml:space="preserve">
<value>Durchfluss</value>
@@ -187,13 +187,13 @@
<value>Format</value>
</data>
<data name="H_amb" xml:space="preserve">
<value>H umgebung</value>
<value>Luftfeuchte Umgebung</value>
</data>
<data name="Item" xml:space="preserve">
<value>Posten</value>
<value>Objekt</value>
</data>
<data name="MClass" xml:space="preserve">
<value>Metr. Klasse</value>
<value>Metrologische Klasse</value>
</data>
<data name="OkBtnText" xml:space="preserve">
<value>OK</value>
@@ -220,34 +220,34 @@
<value>Impulse/l</value>
</data>
<data name="P_amb" xml:space="preserve">
<value>Dr umgebung</value>
<value>Druck amb. (Umgebungsdruck)</value>
</data>
<data name="P_dn_end" xml:space="preserve">
<value>Dr aus ende</value>
<value>Druck Eingang Prüfungsende</value>
</data>
<data name="P_dn" xml:space="preserve">
<value>Dr aus</value>
<value>Druck Eingang</value>
</data>
<data name="P_dn_start" xml:space="preserve">
<value>Dr aus start</value>
<value>Druck Eingang Prüfungsbeginn</value>
</data>
<data name="P_up_end" xml:space="preserve">
<value>Dr ein ende</value>
<value>Druck Ausgang Prüfungsende</value>
</data>
<data name="P_up" xml:space="preserve">
<value>Dr ein</value>
<value>Druck Ausgang</value>
</data>
<data name="P_up_start" xml:space="preserve">
<value>Dr ein start</value>
<value>Druck Ausgang Prüfungsanfang</value>
</data>
<data name="Q_fall" xml:space="preserve">
<value>Q fall</value>
<value>Q Fall </value>
</data>
<data name="Q_from" xml:space="preserve">
<value>Q von</value>
</data>
<data name="Q_rise" xml:space="preserve">
<value>Q steig</value>
<value>Q Steig</value>
</data>
<data name="Q_to" xml:space="preserve">
<value>Q bis</value>
@@ -292,13 +292,13 @@
<value>Prüfvolumen</value>
</data>
<data name="T_amb" xml:space="preserve">
<value>T umgebung</value>
<value>T Umgebung</value>
</data>
<data name="T_div" xml:space="preserve">
<value>T div</value>
<value>T Umschaltung</value>
</data>
<data name="T_end" xml:space="preserve">
<value>Endzeit</value>
<value>T Ende</value>
</data>
<data name="T_in" xml:space="preserve">
<value>T ein</value>
@@ -364,13 +364,13 @@
<value>Hersteller</value>
</data>
<data name="Meter_type" xml:space="preserve">
<value>Typ</value>
<value>WZ-Typ</value>
</data>
<data name="Compound" xml:space="preserve">
<value>Verbund</value>
<value>Verbundzähler</value>
</data>
<data name="Heat_meter" xml:space="preserve">
<value />
<value>Wärmezähler</value>
</data>
<data name="Single" xml:space="preserve">
<value>Einzel</value>
@@ -382,16 +382,16 @@
<value>Größe</value>
</data>
<data name="Page" xml:space="preserve">
<value>Blz.</value>
<value>Seite</value>
</data>
<data name="Water_Meter" xml:space="preserve">
<value>Wasserzähler</value>
</data>
<data name="aux" xml:space="preserve">
<value>Nebenz.</value>
<value>Nebenzähler</value>
</data>
<data name="main" xml:space="preserve">
<value>Hauptz.</value>
<value>Hauptzähler</value>
</data>
<data name="fall" xml:space="preserve">
<value>fall</value>
@@ -409,6 +409,420 @@
<value>Masse</value>
</data>
<data name="Density_correction" xml:space="preserve">
<value>Dichtekorektur</value>
<value>Dichtekorrektur</value>
</data>
<data name="Energy" xml:space="preserve">
<value>Energie</value>
</data>
<data name="Energy_ref" xml:space="preserve">
<value>Energie ref.</value>
</data>
<data name="P_delta" xml:space="preserve">
<value>Druckdifferenz </value>
</data>
<data name="P_delta_end" xml:space="preserve">
<value>Druckdifferenz Ende Prüfung</value>
</data>
<data name="P_delta_mean" xml:space="preserve">
<value>Druckdifferenz Delta Prüfung </value>
</data>
<data name="P_delta_start" xml:space="preserve">
<value>Druckdifferenz Beginn Prüfung</value>
</data>
<data name="End_volume" xml:space="preserve">
<value>Ende Volumen</value>
</data>
<data name="Start_volume" xml:space="preserve">
<value>Start Volumen</value>
</data>
<data name="End_volume_aux" xml:space="preserve">
<value>Ende Volumen Nebenzähler</value>
</data>
<data name="End_volume_main" xml:space="preserve">
<value>Ende Volumen Hauptzähler</value>
</data>
<data name="Start_volume_aux" xml:space="preserve">
<value>Start Volumen Nebenzähler</value>
</data>
<data name="Start_volume_main" xml:space="preserve">
<value>Start Volumen Hauptzähler</value>
</data>
<data name="Volume_aux" xml:space="preserve">
<value>Volumen Nebenzähler</value>
</data>
<data name="Volume_main" xml:space="preserve">
<value>Volumen Hauptzähler</value>
</data>
<data name="End_mass" xml:space="preserve">
<value>End Prüfung</value>
</data>
<data name="Start_mass" xml:space="preserve">
<value>Start Prüfung</value>
</data>
<data name="VName_Flow" xml:space="preserve">
<value>Q</value>
</data>
<data name="VName_Press" xml:space="preserve">
<value>Druck</value>
</data>
<data name="VName_Temp" xml:space="preserve">
<value>Temperatur</value>
</data>
<data name="VName_Dens" xml:space="preserve">
<value>Ro</value>
</data>
<data name="VName_Humi" xml:space="preserve">
<value>Hu</value>
</data>
<data name="VName_TstTime" xml:space="preserve">
<value>Tau</value>
</data>
<data name="VName_Vol" xml:space="preserve">
<value>Vol.</value>
</data>
<data name="Tooltip_P_de_ac" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber aktuell</value>
</data>
<data name="Tooltip_P_de_avg" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber Mittelwert</value>
</data>
<data name="Tooltip_P_de_en" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber am Prüfungsende</value>
</data>
<data name="Tooltip_P_de_me" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber-Durchschnitt </value>
</data>
<data name="Tooltip_P_de_st" xml:space="preserve">
<value>Druckdifferenz gemessen von Druckgeber am Prüfungsbeginn</value>
</data>
<data name="Tooltip_P_dw_ac" xml:space="preserve">
<value>Druck am Prüfstreckenausgang aktuell</value>
</data>
<data name="Tooltip_P_dw_avg" xml:space="preserve">
<value>Druck Mittelwert am Prüfstreckenausgang</value>
</data>
<data name="Tooltip_P_dw_en" xml:space="preserve">
<value>Druck am Prüfstreckenausgang am Ende der Prüfung</value>
</data>
<data name="Tooltip_P_dw_me" xml:space="preserve">
<value>Druck Durchnschnitt am Prüfstreckenausgang</value>
</data>
<data name="Tooltip_P_dw_st" xml:space="preserve">
<value>Hauptdruck am Ausgang bei Prüfbeginn</value>
</data>
<data name="Tooltip_P_up_ac" xml:space="preserve">
<value>Hauptdruck am Eingang aktuell</value>
</data>
<data name="Tooltip_P_up_avg" xml:space="preserve">
<value>Druck Mittelwert am Prüfstreckeneingang</value>
</data>
<data name="Tooltip_P_up_en" xml:space="preserve">
<value>Druck am Prüfstreckeneingang am Ende der Prüfung</value>
</data>
<data name="Tooltip_P_up_me" xml:space="preserve">
<value>Druck Durchnschnitt am Prüfstreckeneingang</value>
</data>
<data name="Tooltip_P_up_st" xml:space="preserve">
<value>Druck am Prüfstreckeneingang bei Prüfbeginn</value>
</data>
<data name="Tooltip_Q_m_r" xml:space="preserve">
<value>Durchfluss berechnet von Masse der Waage und Zeit </value>
</data>
<data name="Tooltip_Q_riac" xml:space="preserve">
<value>Durchfluss angezeigt von NHO/ aktuell</value>
</data>
<data name="Tooltip_Q_rim" xml:space="preserve">
<value>Durchfluss von aktuellem NHO/ Durchnschnitt</value>
</data>
<data name="Tooltip_Q_v_r" xml:space="preserve">
<value>Durchfluss von aktuellem Refferenzzähler</value>
</data>
<data name="Tooltip_T_di_ac" xml:space="preserve">
<value>Temperatur aktuell an der Umschaltung</value>
</data>
<data name="Tooltip_T_di_avg" xml:space="preserve">
<value>Temperatur-Mittelwert an der Umschaltung</value>
</data>
<data name="Tooltip_T_di_en" xml:space="preserve">
<value>Temperatur Umschaltung am Prüfungsende (4 letzten Messungen)</value>
</data>
<data name="Tooltip_T_di_me" xml:space="preserve">
<value>Temperatur-Durchschnitt an der Umschaltung</value>
</data>
<data name="Tooltip_T_di_st" xml:space="preserve">
<value>Temperatur Umschaltung am Prüfungsanfang (4 ersten Messungen)</value>
</data>
<data name="Tooltip_T_dw_ac" xml:space="preserve">
<value>Temperatur aktuell am Prüfstreckenausgang</value>
</data>
<data name="Tooltip_T_dw_avg" xml:space="preserve">
<value>Temperatur-Mittelwert am Prüstreckenausgang</value>
</data>
<data name="Tooltip_T_dw_en" xml:space="preserve">
<value>Temperatur Prüfstreckenausgang am Prüfungsende ( 4 letzten Messungen)</value>
</data>
<data name="Tooltip_T_dw_me" xml:space="preserve">
<value>Temperatur-Durchschnitt am Prüstreckenausgang</value>
</data>
<data name="Tooltip_T_dw_st" xml:space="preserve">
<value>Temperatur Prüfstreckenausgang am Prüfungsanfang( 4 ersten Messungen)</value>
</data>
<data name="Tooltip_T_up_ac" xml:space="preserve">
<value>Temperatur aktuell am Prüfstreckeneingang</value>
</data>
<data name="Tooltip_T_up_avg" xml:space="preserve">
<value>Temperatur-Mittelwert am Prüstreckeneingang während der Prüfung</value>
</data>
<data name="Tooltip_T_up_en" xml:space="preserve">
<value>Temperatur Prüfstreckeneingang und -Ausgang am Prüfungsanfang( 4 Messungen bevor Ende)</value>
</data>
<data name="Tooltip_T_up_me" xml:space="preserve">
<value>Temperatur-Durchschnitt am Prüfstreckeneingang wärend der Prüfung</value>
</data>
<data name="Tooltip_T_up_st" xml:space="preserve">
<value>Temperatur Prüstreckeneingang am Prüfungsbeginn (4 Messungen nach Beginn)</value>
</data>
<data name="Tooltip_E_rel" xml:space="preserve">
<value>Relative Messabweichung eines WZ</value>
</data>
<data name="Tooltip_E_rel_ref" xml:space="preserve">
<value>Relative Messabweichung des NHO</value>
</data>
<data name="Tooltip_sn" xml:space="preserve">
<value>Serie Nr. des WZ</value>
</data>
<data name="Tooltip_sn_aux" xml:space="preserve">
<value>Serie Nr. des Nebenzählers (Verbundzähler)</value>
</data>
<data name="Tooltip_sn_main" xml:space="preserve">
<value>Serie Nr. des Hauptzählers (Verbundzähler)</value>
</data>
<data name="Tooltip_Vol_Mt" xml:space="preserve">
<value>Volumen gemessen vom geprüften WZ</value>
</data>
<data name="Tooltip_Vol_rm" xml:space="preserve">
<value>Refferenz-Volumen vom geprüften WZ</value>
</data>
<data name="VName_Error" xml:space="preserve">
<value>E</value>
</data>
<data name="Tooltip_Hu_Amb_M" xml:space="preserve">
<value>Umgebungs-Luftfeuchtigkeit während der Prüfung</value>
</data>
<data name="Tooltip_P_Amb_M" xml:space="preserve">
<value>Umgebungs-Druck während der Prüfung</value>
</data>
<data name="Tooltip_T_Amb_M" xml:space="preserve">
<value>Umgebungs-Temperatur während der Prüfung</value>
</data>
<data name="Test_done" xml:space="preserve">
<value>Prüfung erledigt</value>
</data>
<data name="Test_passed" xml:space="preserve">
<value>Prüfung beendet</value>
</data>
<data name="No" xml:space="preserve">
<value>Nein</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Ja</value>
</data>
<data name="Error_flags" xml:space="preserve">
<value>Fehlerflags</value>
</data>
<data name="Legalizator" xml:space="preserve">
<value>Prüfstellenleiter</value>
</data>
<data name="User_description" xml:space="preserve">
<value>Benutzerbeschreibung</value>
</data>
<data name="Failed_meters_count" xml:space="preserve">
<value>WZ-Prüfung nicht bestanden</value>
</data>
<data name="Passed_meters_count" xml:space="preserve">
<value>WZ-Prüfung bestanden</value>
</data>
<data name="sensitivity" xml:space="preserve">
<value>Empfindlichkeit</value>
</data>
<data name="Tooltip_Q_end" xml:space="preserve">
<value>Durchflusswert vom NHO-am Prüfungsende</value>
</data>
<data name="Tooltip_Q_max" xml:space="preserve">
<value>Durchflusswert vom NHO-max</value>
</data>
<data name="Tooltip_Q_min" xml:space="preserve">
<value>Durchflusswert vom NHO-min</value>
</data>
<data name="Tooltip_Q_start" xml:space="preserve">
<value>Durchflusswert vom NHO-am Prüfungsanfang</value>
</data>
<data name="Tooltip_P_dw_max" xml:space="preserve">
<value>Druck max. am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_P_dw_min" xml:space="preserve">
<value>Druck min. am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_P_up_max" xml:space="preserve">
<value>Druck max. am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_P_up_min" xml:space="preserve">
<value>Druck min. am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_T_di_max" xml:space="preserve">
<value>Temp. max. an der Umschaltung während der Prüfung</value>
</data>
<data name="Tooltip_T_di_min" xml:space="preserve">
<value>Temp. min. an der Umschaltung während der Prüfung</value>
</data>
<data name="Tooltip_T_dw_max" xml:space="preserve">
<value>Temp. max am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_T_dw_min" xml:space="preserve">
<value>Temp. min. am Prüfstandsausgang während der Prüfung</value>
</data>
<data name="Tooltip_T_up_max" xml:space="preserve">
<value>Temp. max am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_T_up_min" xml:space="preserve">
<value>Temp. min am Prüfstandseingang während der Prüfung</value>
</data>
<data name="Tooltip_P_de_max" xml:space="preserve">
<value>Druckdifferenz gemessen von Delta P /WZ max. während der Prüfung</value>
</data>
<data name="Tooltip_P_de_min" xml:space="preserve">
<value>Druckdifferenz gemessen von Delta P /WZ min. während der Prüfung</value>
</data>
<data name="Tooltip_Rho_Wa_calc" xml:space="preserve">
<value>Dichte vom Wasser aus Tabelle oder Formel</value>
</data>
<data name="Tooltip_T_rho_0" xml:space="preserve">
<value>Temperatur von der Wasserprobe bei der Dichtekalibrierung</value>
</data>
<data name="Tooltip_T_ln_ac" xml:space="preserve">
<value>Temperatur aktuell in der Prüfstrecke</value>
</data>
<data name="Tooltip_T_ln_avg" xml:space="preserve">
<value>Temperatur-Mittelwert in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_en" xml:space="preserve">
<value>Temperatur in der Prüfstrecke am Ende der Prüfung -4 letzten Messungen</value>
</data>
<data name="Tooltip_T_ln_max" xml:space="preserve">
<value>Temperatur max. in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_me" xml:space="preserve">
<value>Temperatur-Durchschnitt in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_min" xml:space="preserve">
<value>Temperatur min. in der Prüfstrecke während der Prüfung</value>
</data>
<data name="Tooltip_T_ln_st" xml:space="preserve">
<value>Temperatur in der Prüfstrecke am Anfang der Prüfung -4 ersten Messungen</value>
</data>
<data name="Unit" xml:space="preserve">
<value>Einheit</value>
</data>
<data name="Procedure_description" xml:space="preserve">
<value>Prüfprozess Beschreibung</value>
</data>
<data name="Bench_ID" xml:space="preserve">
<value>Prüfstand ID</value>
</data>
<data name="Bench_name" xml:space="preserve">
<value>Prüfstamdsname</value>
</data>
<data name="Address" xml:space="preserve">
<value>Adresse</value>
</data>
<data name="Tooltip_E_rel_last" xml:space="preserve">
<value>Relativer Fehler vom WZ in vorheriger Prüfung/ in Produktion</value>
</data>
<data name="Batch" xml:space="preserve">
<value>Zälerlos</value>
</data>
<data name="repetition" xml:space="preserve">
<value>Wiederholung</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Fehlerhafter Q2 Korrektur-Faktor</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>Vorgehender Schritt fehlt oder nicht OK</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>Prüfungswiederholung Anzahl überschritten!</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Falsche iPERL Durchflussrichtung</value>
</data>
<data name="Failed" xml:space="preserve">
<value>Nicht OK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>OK</value>
</data>
<data name="Test_in_progress" xml:space="preserve">
<value>Prüfung läuft</value>
</data>
<data name="Counter_0" xml:space="preserve">
<value>Zähler {0}</value>
</data>
<data name="Date_and_time" xml:space="preserve">
<value>Datum und Zeit</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Step" xml:space="preserve">
<value>Schritt</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Arbeitsplatz</value>
</data>
<data name="Workflow" xml:space="preserve">
<value>Arbeitsablauf</value>
</data>
<data name="Production_tracing_results" xml:space="preserve">
<value>Produktion Ergebnisse verfolgen</value>
</data>
<data name="Code" xml:space="preserve">
<value>Code</value>
</data>
<data name="Part" xml:space="preserve">
<value>Teil</value>
</data>
<data name="All_results" xml:space="preserve">
<value>Alle Ergebnisse</value>
</data>
<data name="Graphs" xml:space="preserve">
<value>Graphiken</value>
</data>
<data name="No_water_meter" xml:space="preserve">
<value>Kein WZ</value>
</data>
<data name="Serial_number_is_missing" xml:space="preserve">
<value>Serie Nr. fehlt.</value>
</data>
<data name="Lower_limit" xml:space="preserve">
<value>Untere Grenze</value>
</data>
<data name="Upper_limit" xml:space="preserve">
<value>Obere Grenze</value>
</data>
<data name="Water_meter_results" xml:space="preserve">
<value>WZ Ergebnisse</value>
</data>
<data name="Relative_error" xml:space="preserve">
<value>Relativer Fehler</value>
</data>
<data name="This_position_is_disabled" xml:space="preserve">
<value>Position nicht aktiviert.</value>
</data>
<data name="Available_items" xml:space="preserve">
<value>Verfügbare Positionen</value>
</data>
<data name="Selected_items" xml:space="preserve">
<value>Ausgewählte Objekte</value>
</data>
</root>
+2 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;ROMA_200;LANG_IT;TEST_PROFILES</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;ROMA_200;LANG_IT;TEST_PROFILES</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+17 -17
View File
@@ -210,22 +210,22 @@ namespace Results
///
/// Flow
///
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_from, string.Format("{0} {1}", Strings.VName_Flow, Strings.from), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qfrom())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_to, string.Format("{0} {1}", Strings.VName_Flow, Strings.to), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qto())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow, string.Format("{0} v r", Strings.VName_Flow), Strings.Tooltip_Q_v_r, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowVolume)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_mean, string.Format("{0} rim ()", Strings.VName_Flow), Strings.Tooltip_Q_rim, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMean)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_min, string.Format("{0} ref min ()", Strings.VName_Flow), Strings.Tooltip_Q_min, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMin)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_max, string.Format("{0} ref max ()", Strings.VName_Flow), Strings.Tooltip_Q_max, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMax)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_start, string.Format("{0} ref start ()",Strings.VName_Flow),Strings.Tooltip_Q_start, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_end, string.Format("{0} ref end ()", Strings.VName_Flow), Strings.Tooltip_Q_end, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Qc, string.Format("Qc"), "Calculated water meter flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V5", (w.GetMeterTestRslt(t).TestTime == 0 || w.GetTestRslt(t).PulsesMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV / w.GetMeterTestRslt(t).TestTime * 3.6 * w.GetMeterTestRslt(t).PulsesMaster / w.GetTestRslt(t).PulsesMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv, string.Format("{0} ctv ()", Strings.VName_Flow), "CTV of the flow (mean val.)", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V5", (w.GetMeterTestRslt(t).TestTime == 0 || w.GetTestRslt(t).PulsesMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV / w.GetMeterTestRslt(t).TestTime * 3.6 * w.GetMeterTestRslt(t).PulsesMaster / w.GetTestRslt(t).PulsesMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_min, string.Format("{0} ctv min ()", Strings.VName_Flow), "Min. CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowMin / w.GetTestRslt(t).VolumeMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_max, string.Format("{0} ctv max ()", Strings.VName_Flow), "Max. CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowMax / w.GetTestRslt(t).VolumeMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_start, string.Format("{0} ctv start ()", Strings.VName_Flow), "Start flow CTV", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowStart / w.GetTestRslt(t).VolumeMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_end, string.Format("{0} ctv end ()", Strings.VName_Flow), "End flow CTV", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).VolumeMaster == 0) ? 0 : w.GetTestRslt(t).VolumeCTV * w.GetTestRslt(t).FlowEnd / w.GetTestRslt(t).VolumeMaster)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_rise, string.Format("{0} {1}", Strings.VName_Flow, Strings.rise), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_fall, string.Format("{0} {1}", Strings.VName_Flow, Strings.fall), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QFall == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QFall)) : ""));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_from, string.Format("{0} {1}", Strings.VName_Flow, Strings.from), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qfrom())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_to, string.Format("{0} {1}", Strings.VName_Flow, Strings.to), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qto())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow, string.Format("{0} v r", Strings.VName_Flow), Strings.Tooltip_Q_v_r, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowVolume)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_mean, string.Format("{0} rim ()", Strings.VName_Flow), Strings.Tooltip_Q_rim, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMean)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_min, string.Format("{0} ref min ()", Strings.VName_Flow), Strings.Tooltip_Q_min, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMin)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_max, string.Format("{0} ref max ()", Strings.VName_Flow), Strings.Tooltip_Q_max, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMax)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_start, string.Format("{0} ref start ()",Strings.VName_Flow),Strings.Tooltip_Q_start, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_end, string.Format("{0} ref end ()", Strings.VName_Flow), Strings.Tooltip_Q_end, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Qc, string.Format("Qc"), "Calculated water meter flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V5", w.GetTestRslt(t).FlowVolume)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv, string.Format("{0} ctv ()", Strings.VName_Flow), "CTV of the flow (mean val.)", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V5", w.GetTestRslt(t).FlowVolume)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_min, string.Format("{0} ctv min ()", Strings.VName_Flow), "Min. CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).FlowMean == 0) ? w.GetTestRslt(t).FlowMin : w.GetTestRslt(t).FlowVolume * w.GetTestRslt(t).FlowMin / w.GetTestRslt(t).FlowMean)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_max, string.Format("{0} ctv max ()", Strings.VName_Flow), "Max. CTV of the flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).FlowMean == 0) ? w.GetTestRslt(t).FlowMax : w.GetTestRslt(t).FlowVolume * w.GetTestRslt(t).FlowMax / w.GetTestRslt(t).FlowMean)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_start, string.Format("{0} ctv start ()", Strings.VName_Flow), "Start flow CTV", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).FlowMean == 0) ? w.GetTestRslt(t).FlowStart : w.GetTestRslt(t).FlowVolume * w.GetTestRslt(t).FlowStart / w.GetTestRslt(t).FlowMean)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_ctv_end, string.Format("{0} ctv end ()", Strings.VName_Flow), "End flow CTV", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).FlowMean == 0) ? w.GetTestRslt(t).FlowEnd : w.GetTestRslt(t).FlowVolume * w.GetTestRslt(t).FlowEnd / w.GetTestRslt(t).FlowMean)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_rise, string.Format("{0} {1}", Strings.VName_Flow, Strings.rise), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_fall, string.Format("{0} {1}", Strings.VName_Flow, Strings.fall), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QFall == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QFall)) : ""));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_sensitivity, string.Format("{0} {1}", Strings.VName_Flow, Strings.sensitivity), Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (string.IsNullOrEmpty(t) || (w.GetTestRslt(t) != null)) ? ((w.QRise == 0) ? "-" : FormatDbl(u, f, p, "V3", w.QRise)) : ""));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ConstMaster, string.Format("k MID ()"), "Const. of the reference flow meter", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", ((w.GetTestRslt(t).ConstMaster < float.Epsilon) ? 0 : (1 / w.GetTestRslt(t).ConstMaster)))));
@@ -336,7 +336,7 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enum, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enumerated, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
+1
View File
@@ -14,6 +14,7 @@ namespace ResultsBrowser
ListOfSerialNumbers,
WZTypeIdAndTimePeriod,
ProducedWithinTimePeriod,
BenchAndBatchNr,
Count,
}
@@ -181,7 +181,7 @@
//
// parameterValueTextBox
//
this.parameterValueTextBox.Location = new System.Drawing.Point(325, 14);
this.parameterValueTextBox.Location = new System.Drawing.Point(612, 13);
this.parameterValueTextBox.Name = "parameterValueTextBox";
this.parameterValueTextBox.Size = new System.Drawing.Size(68, 20);
this.parameterValueTextBox.TabIndex = 1;
@@ -189,7 +189,7 @@
// parameterNameLabel
//
this.parameterNameLabel.AutoSize = true;
this.parameterNameLabel.Location = new System.Drawing.Point(128, 17);
this.parameterNameLabel.Location = new System.Drawing.Point(121, 17);
this.parameterNameLabel.Name = "parameterNameLabel";
this.parameterNameLabel.Size = new System.Drawing.Size(0, 13);
this.parameterNameLabel.TabIndex = 0;
@@ -39,6 +39,7 @@ namespace ResultsBrowser.Forms
//queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.ListOfSerialNumbers, "Všetky vodomery so sériovými číslami podľa zadaného zoznamu"));
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.WZTypeIdAndTimePeriod, "Všetky vodomery so zadaným WZTypeID vyrobené v zadanom časovom období"));
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.ProducedWithinTimePeriod, "Všetky vodomery vyrobené v zadanom časovom období"));
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.BenchAndBatchNr, "Stanica a číslo dávky"));
queryTypeComboBox.Text = "Všetky vodomery vyrobené v zadanom časovom období";
destinationFileTextBox.Text = string.Format("vysledky_hladania_{0:ddMMyyyy_HHmm}.csv", DateTime.Now);
@@ -68,7 +69,8 @@ namespace ResultsBrowser.Forms
/// Update UI elements visibility
inputListGroupBox.Enabled = (CQCriteria == CQCriteria.ListOfOrders) ||
(CQCriteria == CQCriteria.ListOfPcbNumbers) ||
(CQCriteria == CQCriteria.ListOfSerialNumbers);
(CQCriteria == CQCriteria.ListOfSerialNumbers) ||
(CQCriteria == CQCriteria.BenchAndBatchNr);
timePeriodGroupBox.Enabled = (CQCriteria == CQCriteria.WZTypeIdAndTimePeriod) ||
(CQCriteria == CQCriteria.ProducedWithinTimePeriod);
@@ -78,6 +80,11 @@ namespace ResultsBrowser.Forms
parameterGroupBox.Enabled = true;
parameterNameLabel.Text = "WZ Type ID";
}
else if (CQCriteria == CQCriteria.BenchAndBatchNr)
{
parameterGroupBox.Enabled = true;
parameterNameLabel.Text = "wr10=5, wr11=6, wr13=8, wr14=10, wr15=9, wr18=11, wr19=12, wr20=13, wr21=14";
}
else
{
parameterGroupBox.Enabled = false;
+7
View File
@@ -20,11 +20,18 @@ namespace ResultsBrowser
public DateTime End;
public int HydrPruefung;
public double AdjErr;
public double Q4Err;
public double Q3Err;
public double Q2AdjErr;
public double Q2Err;
public double Q1Err;
public double AdjErrA4;
public double Q3RlErr;
public double Q3LrErr;
public double Q2RlErr;
public double Q2LrErr;
public double Q2acRlErr;
public double Q2acLrErr;
public double Q1RlErr;
public double Q1LrErr;
public int CalibFactor;
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("ResultsBrowser")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2018 Sensus Slovensko a.s.")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2020 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -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.25.1440.0")]
[assembly: AssemblyFileVersion("2.25.1440.0")]
[assembly: AssemblyVersion("2.26.1498.0")]
[assembly: AssemblyFileVersion("2.26.1498.0")]
+75 -3
View File
@@ -163,7 +163,7 @@
<value>OK</value>
</data>
<data name="Print_query_results" xml:space="preserve">
<value>Ergebnise drucken</value>
<value>Ergebnisse Abfrage Drucken</value>
</data>
<data name="Procedure" xml:space="preserve">
<value>Prüfvorlage</value>
@@ -172,7 +172,7 @@
<value>Protokoll</value>
</data>
<data name="Query_results" xml:space="preserve">
<value>Ergebnisse</value>
<value>Abfrageergebnisse</value>
</data>
<data name="Results_Browser" xml:space="preserve">
<value>Analyse der Ergebnisse</value>
@@ -199,7 +199,7 @@
<value>Statistiken</value>
</data>
<data name="Test" xml:space="preserve">
<value>Prüfpunkt</value>
<value>Prüfung</value>
</data>
<data name="Test_bench" xml:space="preserve">
<value>Prüfstand</value>
@@ -231,4 +231,76 @@
<data name="Print" xml:space="preserve">
<value>Drucken</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="ConfigureDatabaseText" xml:space="preserve">
<value>Password für Prüfstand configurieren</value>
</data>
<data name="ExitBtnText" xml:space="preserve">
<value>Exit</value>
</data>
<data name="Component" xml:space="preserve">
<value>Komponenten</value>
</data>
<data name="Configure" xml:space="preserve">
<value>Konfigurieren</value>
</data>
<data name="Printer" xml:space="preserve">
<value>Drucker</value>
</data>
<data name="Question" xml:space="preserve">
<value>Fragen</value>
</data>
<data name="Add" xml:space="preserve">
<value>&amp;Hinzufügen</value>
</data>
<data name="Message" xml:space="preserve">
<value>Nachricht</value>
</data>
<data name="Data" xml:space="preserve">
<value>Daten</value>
</data>
<data name="All_files" xml:space="preserve">
<value>Alle Dateien</value>
</data>
<data name="Query_files" xml:space="preserve">
<value>Abfragedateien</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>Programmeinstellungen nicht gefunden</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Einstellungen Vorgaben benutzen.</value>
</data>
<data name="Selected_language_not_supported" xml:space="preserve">
<value>Ausgewählte Sprache wird nicht unterstützt.</value>
</data>
<data name="Using_English" xml:space="preserve">
<value>Englische Sprache benutzen!</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warnung</value>
</data>
<data name="Format" xml:space="preserve">
<value>Formatieren</value>
</data>
<data name="Configure_printer" xml:space="preserve">
<value>Drucker konfigurieren.</value>
</data>
<data name="No_printer_defined" xml:space="preserve">
<value>Kein Drucker ausgewählt.</value>
</data>
<data name="Printing_failed" xml:space="preserve">
<value>Druck fehlgeschlagen</value>
</data>
<data name="Printing_completed" xml:space="preserve">
<value>Druck vollständig</value>
</data>
<data name="Error_exporting_results" xml:space="preserve">
<value>Fehler beim exportieren der Ergebnisse!</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>Histogramm</value>
</data>
</root>
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;ROMA_200;LANG_IT</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -32,7 +32,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;ROMA_200;LANG_IT</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+274 -130
View File
@@ -28,8 +28,8 @@ namespace ResultsBrowser
IList<WaterMeter> waterMeters;
DateTime timePeriodStart;
DateTime timePeriodEnd;
DateTime timePeriodStart;
DateTime timePeriodEnd;
static IList<IComponent> tbfComponents;
static IList<IDevice> tbfDevices;
@@ -47,9 +47,9 @@ namespace ResultsBrowser
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
tbfDevices = new List<IDevice>();
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
}
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
}
private void ResultsBrowserWnd_Load(object sender, EventArgs e)
{
@@ -102,15 +102,15 @@ namespace ResultsBrowser
checkBox6.Visible = !string.IsNullOrEmpty(checkBox6.Text);
}
string BenchName()
{
return checkBox1.Checked ? Program.LocalSettings.Bench1
: checkBox2.Checked ? Program.LocalSettings.Bench2
: checkBox3.Checked ? Program.LocalSettings.Bench3
: checkBox4.Checked ? Program.LocalSettings.Bench4
string BenchName()
{
return checkBox1.Checked ? Program.LocalSettings.Bench1
: checkBox2.Checked ? Program.LocalSettings.Bench2
: checkBox3.Checked ? Program.LocalSettings.Bench3
: checkBox4.Checked ? Program.LocalSettings.Bench4
: checkBox5.Checked ? Program.LocalSettings.Bench5
: Program.LocalSettings.Bench6;
}
}
void Localize()
{
@@ -118,19 +118,19 @@ namespace ResultsBrowser
resultsGroupBox.Text = Strings.Query_results;
settingsBtn.Text = Strings.Settings;
testBenchesGroupBox.Text = Strings.Test_benches;
clearFiltersBtn.Text = Strings.Clear_filters;
clearFiltersBtn.Text = Strings.Clear_filters;
addFilterBtn.Text = Strings.Add_filter;
formatOfResultsBtn.Text = Strings.Format_of_results;
printerConfigBtn.Text = Strings.Configure_printer;
loadConfigBtn.Text = Strings.Load_filters;
formatOfResultsBtn.Text = Strings.Format_of_results;
printerConfigBtn.Text = Strings.Configure_printer;
loadConfigBtn.Text = Strings.Load_filters;
saveConfigBtn.Text = Strings.Save_filters;
executeQueryBtn.Text = Strings.Execute_query;
executeQueryBtn.Text = Strings.Execute_query;
exportQueryResultsBtn.Text = Strings.Export_query_results;
printQueryResultsBtn.Text = Strings.Print_query_results;
statisticsBtn.Text = Strings.Statistics;
statisticsBtn.Text = Strings.Statistics;
}
private void settingsBtn_Click(object sender, EventArgs e)
@@ -176,40 +176,40 @@ namespace ResultsBrowser
}
}
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.MetersKind = Config.Entities.MetersKind.Single;
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.MetersKind = Config.Entities.MetersKind.Single;
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
RedrawResults();
}
}
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
RedrawResults();
}
}
private void printerConfigBtn_Click(object sender, EventArgs e)
{
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
{
PrinterClass = filtersConfig.PrinterClass,
PrinterCfg = filtersConfig.PrinterCfg
};
private void printerConfigBtn_Click(object sender, EventArgs e)
{
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
{
PrinterClass = filtersConfig.PrinterClass,
PrinterCfg = filtersConfig.PrinterCfg
};
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.PrinterClass = dlg.PrinterClass;
filtersConfig.PrinterCfg = dlg.PrinterCfg;
}
}
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.PrinterClass = dlg.PrinterClass;
filtersConfig.PrinterCfg = dlg.PrinterCfg;
}
}
private void loadConfigBtn_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
if (dlg.ShowDialog() == DialogResult.OK)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
if (dlg.ShowDialog() == DialogResult.OK)
{
LoadConfigFromFile(dlg.FileName);
}
}
@@ -269,8 +269,8 @@ namespace ResultsBrowser
private void executeQueryBtn_Click(object sender, EventArgs e)
{
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
timePeriodStart = new DateTime(0);
timePeriodEnd = new DateTime(0);
try
{
@@ -291,11 +291,11 @@ namespace ResultsBrowser
foreach (var filter in filters)
{
if (filter is DateFilter)
{
timePeriodStart = (filter as DateFilter).From;
timePeriodEnd = (filter as DateFilter).To;
}
if (filter is DateFilter)
{
timePeriodStart = (filter as DateFilter).From;
timePeriodEnd = (filter as DateFilter).To;
}
waterMeters2 = filter.ExecuteQuery(sessions, waterMeters);
waterMeters = waterMeters2;
}
@@ -364,10 +364,10 @@ namespace ResultsBrowser
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
{
try
{
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
{
for (int i = 0; i < items.Count; i++)
{
writer.Write(items[i].Caption);
@@ -397,10 +397,10 @@ namespace ResultsBrowser
}
}
}
catch (Exception exc)
{
catch (Exception exc)
{
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}
@@ -448,11 +448,11 @@ namespace ResultsBrowser
IComponent component = printerFactory.GetComponent(printerCfg, tbfComponents);
IResultsPrinter printer = component as IResultsPrinter;
if (printer== null)
if (printer == null)
{
MessageBox.Show(Strings.No_printer_defined);
return;
}
}
tbfComponents.Clear();
tbfDevices.Clear();
@@ -493,7 +493,7 @@ namespace ResultsBrowser
{
if (waterMeters == null || waterMeters.Count == 0) return;
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
///
/// Statistics options
@@ -529,24 +529,24 @@ namespace ResultsBrowser
}
/// <summary>
/// Updates component factory
/// </summary>
/// <param name="className">Component class name</param>
/// <param name="factory">Reference to a factory</param>
/// <returns>true when factory changed</returns>
IComponentFactory GetFactory(string className)
{
if (!string.IsNullOrEmpty(className))
{
foreach (var fac in TbfComponents.Factories)
{
if (fac.ClassName == className) return fac;
}
}
/// <summary>
/// Updates component factory
/// </summary>
/// <param name="className">Component class name</param>
/// <param name="factory">Reference to a factory</param>
/// <returns>true when factory changed</returns>
IComponentFactory GetFactory(string className)
{
if (!string.IsNullOrEmpty(className))
{
foreach (var fac in TbfComponents.Factories)
{
if (fac.ClassName == className) return fac;
}
}
return null;
}
return null;
}
private void customQueryButton_Click(object sender, EventArgs e)
{
@@ -609,12 +609,22 @@ namespace ResultsBrowser
while (dr.Read())
{
int i = 0;
string queryResult = dr.GetString(i++);
string queryResult;
try { queryResult = dr.GetString(i++); }
catch { queryResult = string.Empty; }
int maxPruefIx = dr.GetInt32(i++);
int testBenchId = maxPruefIx / 100;
maxPruefIx = maxPruefIx % 100;
string prefix = dr.GetString(i++);
int sn = dr.GetInt32(i++);
string prefix;
try { prefix = dr.GetString(i++); }
catch { prefix = string.Empty; }
int sn;
try { sn = dr.GetInt32(i++); }
catch { sn = -1; }
if (sn == -1) continue;
@@ -639,7 +649,6 @@ namespace ResultsBrowser
return;
}
/// Add this test bench to the list of test benches if it was still missing
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
}
@@ -730,25 +739,35 @@ namespace ResultsBrowser
double flow = dr.GetDouble(i++); /// Q_WZ
double error = dr.GetDouble(i++); /// Q_FEHLER
bool testPassed = (dr.GetInt32(i++) != 0);
#if true
/// SUEZ specific
switch (testId)
{
case -2:
oraD.AdjErrA4 = error;
break;
case -1:
oraD.AdjErr = error;
break;
case 5:
oraD.Q3LrErr = error;
break;
case 10:
oraD.Q3RlErr = error;
break;
default:
break;
case -2: oraD.AdjErrA4 = error; break;
case -1: oraD.AdjErr = error; break;
case 1: oraD.Q1LrErr = error; break;
case 2: oraD.Q2acLrErr = error; break;
case 3: oraD.Q2LrErr = error; break;
case 5: oraD.Q3LrErr = error; break;
case 6: oraD.Q1RlErr = error; break;
case 7: oraD.Q2acRlErr = error; break;
case 8: oraD.Q2RlErr = error; break;
case 10: oraD.Q3RlErr = error; break;
default: break;
}
#else /// DEWA specific
switch (testId)
{
case -1: oraD.AdjErr = error; break;
case 1: oraD.Q1Err = error; break;
case 2: oraD.Q2Err = error; break;
case 3: oraD.Q2AdjErr = error; break;
case 4: oraD.Q3Err = error; break;
case 5: oraD.Q4Err = error; break;
default: break;
}
#endif
}
dr.Close();
} /// end of foreach (var oraD in OraDatas)
@@ -756,6 +775,90 @@ namespace ResultsBrowser
oracleConnection.Close();
}
else if (dlg.CQCriteria == CQCriteria.BenchAndBatchNr)
{
switch (dlg.IntParameter)
{
#if LOCAL
case 5: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr10-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 6: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr11-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 8: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr13-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 9: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr15-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 10: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr14-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 11: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr18-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 12: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr19-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr20-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
case 14: Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr21-r; UID=root; PASSWORD=kraken; CharSet=utf8;"; break;
#else
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 8: Results.DB.ConnectionString = "SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 11: Results.DB.ConnectionString = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 12: Results.DB.ConnectionString = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 14: Results.DB.ConnectionString = "SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
#endif
default: Results.DB.ConnectionString = string.Empty; break;
}
Results.DB.DbType = Users.Entities.DBType.MySql;
string[] fields = dlg.InputList.Split(new char[] { ',' });
int[] batchNrs = new int[fields.Length];
int batchNr;
for (int i = 0; i < batchNrs.Length; i++) if (int.TryParse(fields[i], out batchNr)) batchNrs[i] = batchNr;
IList<WaterMeter> waterMeters = new List<WaterMeter>();
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
{
ISession session = Results.DB.CreateSession();
for (int i = 0; i < batchNrs.Length; i++)
{
var batches = session.QueryOver<Batch>()
.Where(x => (x.BatchNr == batchNrs[i]))
.List();
if (batches.Count == 1)
{
var wms = session.QueryOver<WaterMeter>()
.Where(x => (x.Batch == batches[0]))
.List();
foreach (var wm in wms) waterMeters.Add(wm);
}
}
}
consoleTextBox.Text += "Collecting water meters\r\n";
foreach (var waterMeter in waterMeters)
{
oracleConnection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
oracleConnection.Open();
OracleCommand cmd = new OracleCommand("select AUFTRAGSNUMMER, MAX_PRUEFINDEX, PREFIX, ZAEHLERNUMMER from VT_ZAEHLER_PD where VT_FERNUM = :1 AND ANBID = 4 order by ZAEHLERNUMMER", oracleConnection);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = waterMeter.SerialNr });
OracleDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
int i = 0;
string queryResult = dr.GetString(i++);
int maxPruefIx = dr.GetInt32(i++);
int testBenchId = maxPruefIx / 100;
maxPruefIx = maxPruefIx % 100;
string prefix = dr.GetString(i++);
int sn = dr.GetInt32(i++);
if (sn == -1) continue;
/// Create 'OraData' object and add it to 'oraDatas' list
oraDatas.Add(new OraData() { PO = queryResult, PcbNr = waterMeter.SerialNr, TestBenchId = testBenchId, MaxPruefIx = maxPruefIx, Prefix = prefix, SN = sn });
/// Add this test bench to the list of test benches if it was still missing
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
}
}
}
else if (dlg.CQCriteria == CQCriteria.WZTypeIdAndTimePeriod)
{
}
@@ -769,14 +872,14 @@ namespace ResultsBrowser
counter = 0;
foreach (var testBenchId in testBenches)
{
if (testBenchId == 4)
if (testBenchId == 4 || (dlg.CQCriteria == CQCriteria.BenchAndBatchNr && testBenchId != dlg.IntParameter))
{
/// Skip WR9
/// Skip WR9 or other test benches
continue;
}
consoleTextBox.Text += string.Format("{0}\r\n", GetBenchName(testBenchId));
#if false
#if LOCAL
/// Local database copies
switch (testBenchId)
{
@@ -795,18 +898,19 @@ namespace ResultsBrowser
/// Test bench databases
switch (testBenchId)
{
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 8: Results.DB.ConnectionString = "SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 8: Results.DB.ConnectionString = "SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 11: Results.DB.ConnectionString = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 12: Results.DB.ConnectionString = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
case 14: Results.DB.ConnectionString = "SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
default: Results.DB.ConnectionString = string.Empty; break;
}
#endif
Results.DB.DbType = Users.Entities.DBType.MySql;
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
{
@@ -854,18 +958,19 @@ namespace ResultsBrowser
consoleTextBox.Text += Environment.NewLine;
if (session != null) session.Close();
}
}
}
consoleTextBox.Text += "End reading additional data from MySQL\r\n";
consoleTextBox.Text += "CSV data begin\r\n";
using (TextWriter writer = new StreamWriter(dlg.DestinationFile))
{
writer.WriteLine(string.Format("PO; prefix; S/N; PcbNr; Bench; Batch; Start; Start; End; End; Pos; AdjA0; AdjA4; Q3RL; Q3LR; CalF; CAlF_LNA; HP; Q2cRL; Q2cLR"));
#if true
writer.WriteLine(string.Format("PO; prefix; S/N; PcbNr; Bench; Batch; Start; Start; End; End; Pos; AdjA0; AdjA4; Q3RL; Q3LR; Q2RL; Q2LR; Q2acRL; Q2acLR; Q1RL; Q1LR; CalF; CAlF_LNA; HP; Q2cRL; Q2cLR"));
//Console.WriteLine(string.Format("s/n;PCB nr.;bench;batch;position;Err. at 640 l/h;Err. LNA at 640 l/h;Err. Q3 RL;Err. Q3 LR;Cal.f.;Cal.f.LNA;Q2 corr.f. RL;Q2 corr.f. LR"));
foreach (var oraD in oraDatas)
{
writer.WriteLine(string.Format("{0}; {1}; {2}; =(\"{3}\"); {4}; {5}; {7}; {8}; {9}; {10};{11};{12};{13};{14};{15};{16};{17};{18};{19};{20}",
writer.WriteLine(string.Format("{0}; {1}; {2}; =(\"{3}\"); {4}; {5}; {7}; {8}; {9}; {10};{11};{12};{13};{14};{15};{16};{17};{18};{19};{20};{21};{22};{23};{24};{25};{26};{27};{28}",
//Console.WriteLine(string.Format("{2};=(\"{3}\"); {4};{5};{11};{12};{13};{14};{15};{16};{17};{19};{20}",
/* 0 */ oraD.PO,
/* 1 */ oraD.Prefix,
@@ -879,18 +984,57 @@ namespace ResultsBrowser
/* 9 */ oraD.End.ToShortDateString(),
/* 10 */ oraD.End.ToShortTimeString(),
/* 11 */ oraD.WMPosition,
/* 12 */ oraD.AdjErr.ToString("F2"),
/* 13 */ oraD.AdjErrA4.ToString("F2"),
/* 14 */ oraD.Q3RlErr.ToString("F2"),
/* 15 */ oraD.Q3LrErr.ToString("F2"),
/* 16 */ oraD.CalibFactor,
/* 17 */ oraD.CalibFactorLNA,
/* 18 */ oraD.HydrPruefung,
/* 19 */ oraD.Q2CorrectionRl,
/* 20 */ oraD.Q2CorrectionLr,
/* 21 */ oraD.WMTypeId,
/* 22 */ oraD.WMTypeRev));
/* 12 */ oraD.AdjErr.ToString("F3"),
/* 13 */ oraD.AdjErrA4.ToString("F3"),
/* 14 */ oraD.Q3RlErr.ToString("F3"),
/* 15 */ oraD.Q3LrErr.ToString("F3"),
/* 16 */ oraD.Q2RlErr.ToString("F3"),
/* 17 */ oraD.Q2LrErr.ToString("F3"),
/* 18 */ oraD.Q2acRlErr.ToString("F3"),
/* 19 */ oraD.Q2acLrErr.ToString("F3"),
/* 20 */ oraD.Q1RlErr.ToString("F3"),
/* 21 */ oraD.Q1LrErr.ToString("F3"),
/* 22 */ oraD.CalibFactor,
/* 23 */ oraD.CalibFactorLNA,
/* 24 */ oraD.HydrPruefung,
/* 25 */ oraD.Q2CorrectionRl,
/* 26 */ oraD.Q2CorrectionLr,
/* 27 */ oraD.WMTypeId,
/* 28 */ oraD.WMTypeRev));
}
#else
writer.WriteLine(string.Format("PO; prefix; S/N; PcbNr; Bench; Batch; Start; Start; End; End; Pos; AdjA0; Q4; Q3; Q2Adj; Q2; Q1; CalF; HP; Q2cRL; Q2cLR"));
//Console.WriteLine(string.Format("s/n;PCB nr.;bench;batch;position;Err. at 640 l/h;Err. LNA at 640 l/h;Err. Q3 RL;Err. Q3 LR;Cal.f.;Cal.f.LNA;Q2 corr.f. RL;Q2 corr.f. LR"));
foreach (var oraD in oraDatas)
{
writer.WriteLine(string.Format("{0}; {1}; {2}; =(\"{3}\"); {4}; {5}; {7}; {8}; {9}; {10};{11};{12};{13};{14};{15};{16};{17};{18};{19};{20};{21}",
//Console.WriteLine(string.Format("{2};=(\"{3}\"); {4};{5};{11};{12};{13};{14};{15};{16};{17};{19};{20}",
/* 0 */ oraD.PO,
/* 1 */ oraD.Prefix,
/* 2 */ oraD.SN,
/* 3 */ oraD.PcbNr,
/* 4 */ GetBenchName(oraD.TestBenchId),
/* 5 */ oraD.BatchNr,
/* 6 */ oraD.ProgramVer,
/* 7 */ oraD.Start.ToShortDateString(),
/* 8 */ oraD.Start.ToShortTimeString(),
/* 9 */ oraD.End.ToShortDateString(),
/* 10 */ oraD.End.ToShortTimeString(),
/* 11 */ oraD.WMPosition,
/* 12 */ oraD.AdjErr.ToString("F3"),
/* 13 */ oraD.Q4Err.ToString("F3"),
/* 14 */ oraD.Q3Err.ToString("F3"),
/* 15 */ oraD.Q2AdjErr.ToString("F3"),
/* 16 */ oraD.Q2Err.ToString("F3"),
/* 17 */ oraD.Q1Err.ToString("F3"),
/* 18 */ oraD.CalibFactor,
/* 19 */ oraD.HydrPruefung,
/* 20 */ oraD.Q2CorrectionRl,
/* 21 */ oraD.Q2CorrectionLr,
/* 22 */ oraD.WMTypeId,
/* 23 */ oraD.WMTypeRev));
}
#endif
}
consoleTextBox.Text += "CSV data end\r\n";
@@ -909,11 +1053,11 @@ namespace ResultsBrowser
{
switch (testBenchId)
{
case 4: return "WR9";
case 5: return "WR10";
case 6: return "WR11";
case 8: return "WR13";
case 9: return "WR15";
case 4: return "WR9";
case 5: return "WR10";
case 6: return "WR11";
case 8: return "WR13";
case 9: return "WR15";
case 10: return "WR14";
case 11: return "WR18";
case 12: return "WR19";
+3 -3
View File
@@ -250,13 +250,13 @@ namespace Statistics
{
"SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.128.61; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.156; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
"SERVER=10.42.130.131; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
};
+5 -3
View File
@@ -88,19 +88,21 @@ namespace Statistics
for (int i = 0; i < Program.LocalSettings.ConnectionStrings.Length; i++)
{
if (!string.IsNullOrEmpty(Program.LocalSettings.GetConnectionString(i)))
string connStr = Program.LocalSettings.GetConnectionString(i);
if (!string.IsNullOrEmpty(connStr))
{
sessionFactories[i] = null;
try
{
sessionFactories[i] = Fluently.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(Program.LocalSettings.GetConnectionString(i)))
.Database(MySQLConfiguration.Standard.ConnectionString(connStr))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Results.Entities.Batch>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
catch (Exception)
{
sessionFactories[i] = null;
MessageBox.Show(string.Format("Cannot open one of database of {0}", Program.LocalSettings.GetBenchName(i)), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
+35 -1
View File
@@ -1,8 +1,10 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using Results.Entities;
@@ -10,10 +12,24 @@ using Statistics.Resources;
namespace Statistics.UserControls
{
class DataPoint
{
public DateTime StartTime;
public double RefError;
public DataPoint(DateTime startTime, double refError)
{
StartTime = startTime;
RefError = refError;
}
}
public partial class StatisticsCtrl : UserControl
{
public int Id; /// Index of the tab page
public MidOrWaterMetersCtrl MidCtrl; /// Reference to the parent control
IList<DataPoint> currentData;
public StatisticsCtrl()
{
@@ -21,6 +37,7 @@ namespace Statistics.UserControls
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "dd.MM.yy";
chart1.ChartAreas[0].AxisX.Interval = 1;
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;
currentData = new List<DataPoint>();
}
private void updateButton_Click(object sender, EventArgs e)
@@ -36,6 +53,8 @@ namespace Statistics.UserControls
if (results != null)
{
currentData.Clear();
foreach (var r in results)
{
if (r.ErrorMaster != 0)
@@ -45,6 +64,7 @@ namespace Statistics.UserControls
if (MidCtrl.IsFlowEnabled(i) && (MidCtrl.FlowFrom(i) <= r.FlowMean) && (r.FlowMean <= MidCtrl.FlowTo(i)))
{
chart1.Series[string.Format("Flow {0}", i)].Points.AddXY(r.StartTime, r.ErrorMaster);
currentData.Add(new DataPoint(r.StartTime, r.ErrorMaster));
}
}
}
@@ -56,7 +76,21 @@ namespace Statistics.UserControls
private void exportButton_Click(object sender, EventArgs e)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
using (TextWriter writer = new StreamWriter(dlg.FileName))
{
foreach (var d in currentData)
{
writer.WriteLine("{0:dd.MM.yyyy HH:mm}; {1}", d.StartTime, d.RefError);
}
}
MessageBox.Show(string.Format("Data written to file {0}", dlg.FileName));
}
}
}
}
+40
View File
@@ -69,6 +69,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterface", "DataStreamInterface\DataStreamInterface.csproj", "{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResetBatchNr", "ResetBatchNr\ResetBatchNr.csproj", "{D7F5A111-B2DF-4761-9574-AB730DF573A6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterfaceTest", "DataStreamInterfaceTest\DataStreamInterfaceTest.csproj", "{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}"
ProjectSection(ProjectDependencies) = postProject
{E6925701-57A6-4167-B5C4-BF670F1DE310} = {E6925701-57A6-4167-B5C4-BF670F1DE310}
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28} = {7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamMeter", "DataStreamMeter\DataStreamMeter.csproj", "{E6925701-57A6-4167-B5C4-BF670F1DE310}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -303,6 +313,36 @@ Global
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}.Release|x86.ActiveCfg = Release|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|x86.ActiveCfg = Debug|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Any CPU.Build.0 = Release|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|x86.ActiveCfg = Release|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Debug|x86.ActiveCfg = Debug|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Any CPU.Build.0 = Release|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1D1EEF9C-7F41-43D3-BD09-5054D00F7A23}.Release|x86.ActiveCfg = Release|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Debug|x86.ActiveCfg = Debug|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Any CPU.Build.0 = Release|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E6925701-57A6-4167-B5C4-BF670F1DE310}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin and the End form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Combined
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Combined
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Combined
/// <summary> Number of water meters </summary>
public readonly int WaterMetersCount; /// Main + Aux water meter count as one (combined) water meter
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -78,7 +78,7 @@ namespace TBF.BenchControl.DataEntry.Combined
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -105,7 +105,7 @@ namespace TBF.BenchControl.DataEntry.Combined
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] mainStartStateStr, string[] auxStartStateStr,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] mainStartStateStr, string[] auxStartStateStr,
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WMsCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -122,7 +122,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -116,7 +116,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -125,7 +125,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -140,7 +140,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
double refEnergy, double energyErrLimLo, double energyErrLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -135,7 +135,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
bool[] disabled, double refVolume, double errLimLo, double errLimHi,
double refEnergy, double energyErrLimLo, double energyErrLimHi)
: this()
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -116,7 +116,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -125,7 +125,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -140,7 +140,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
double refEnergy, double energyErrLimLo, double energyErrLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -127,7 +127,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
bool[] disabled, double refVolume, double errLimLo, double errLimHi,
double refEnergy, double energyErrLimLo, double energyErrLimHi)
: this()
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin and the End form
@@ -103,7 +103,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -112,7 +112,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// <summary> Number of water meters </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -62,7 +62,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// Constructor to fill in start states
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// Constructor to fill in end states
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Single
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Single
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Single
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Single
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -91,7 +91,7 @@ namespace TBF.BenchControl.DataEntry.Single
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, int lineSize, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, int lineSize, IRegReader[] regReaders, bool[] disabled)
: this(waterMetersCount, lineSize)
{
endStates = false;
@@ -113,7 +113,7 @@ namespace TBF.BenchControl.DataEntry.Single
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, int lineSize, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, int lineSize, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this(waterMetersCount, lineSize)
{
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -105,7 +105,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -122,7 +122,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -130,7 +130,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -94,7 +94,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -103,7 +103,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
/// <summary> Number of water meters </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
/// Constructor to fill in start states
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
{
InitializeComponent();
ControlBox = false;
@@ -63,7 +63,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
/// Constructor to fill in end states
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
{
endStates = true;
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
public string[] StartImages
@@ -148,7 +148,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TestStartStates;
@@ -157,7 +157,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TestEndStates;
@@ -169,7 +169,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
}
/// <returns>Reference to the operation</returns>
public IOperation ShowDeferredTestEvalFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowDeferredTestEvalFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.DeferredTestEval;
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
/// <summary> Number of text boxes for serial numbers </summary>
readonly Tst mode; /// Start, End or Deferred
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
readonly string[] startImages;
readonly string[] endImages;
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] startImages, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, bool[] disabled)
: this()
{
mode = Tst.Start;
@@ -174,7 +174,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -210,7 +210,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
WMEndState = new double[waterMetersCount];
}
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] startImages, string[] endImages,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, string[] endImages,
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
: this()
{
@@ -297,7 +297,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
switch (mode)
{
case Tst.Start:
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1])
if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
{
startTextBoxes[i].Enabled = false;
}
@@ -309,8 +310,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
break;
case Tst.End:
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1])
{
if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
{
startTextBoxes[i].Enabled = false;
endTextBoxes[i].Enabled = false;
}
@@ -324,8 +326,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
break;
case Tst.Both:
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1])
{
if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
{
startTextBoxes[i].Enabled = false;
endTextBoxes[i].Enabled = false;
}
@@ -561,8 +564,29 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
if (enabledTextBoxes[i] == currentFocusOwner)
{
/// Change focus to the next enabled text box
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus();
return;
var currentTextBox = enabledTextBoxes[(i + 1) % enabledTextBoxes.Count];
currentTextBox.Focus();
/// Load the respective image
for (int j = 0; j < startTextBoxes.Length; j++)
{
if (startTextBoxes[j] == currentTextBox)
{
LoadImage(Tst.Start, j);
return;
}
}
for (int j = 0; j < endTextBoxes.Length; j++)
{
if (endTextBoxes[j] == currentTextBox)
{
LoadImage(Tst.End, j);
return;
}
}
/// No image found
return;
}
}
}
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
public bool UsesCameras() { return false; }
readonly EntryFormCfg entryFormCfg;
IRegisterReader[] regReaders;
IRegReader[] regReaders;
/// <summary>
/// Properties set by the Begin, End and WMStates form
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly IRegisterReader[] regReaders;
readonly IRegReader[] regReaders;
readonly bool[] disabled;
// To be retrieved after the form closes
@@ -89,7 +89,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
/// </summary>
/// <param name="waterMetersCount">Number of water meters</param>
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
: this()
{
endStates = false;
@@ -113,7 +113,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
double refVolume, double errLimLo, double errLimHi)
: this()
{

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