Compare commits
544
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
121b034516 | ||
|
|
d2d571945c | ||
|
|
bd9c3aa5e2 | ||
|
|
73ea0ff586 | ||
|
|
78408ed5eb | ||
|
|
f04cdccd20 | ||
|
|
82acf60f2e | ||
|
|
68413867ad | ||
|
|
1fd8881d53 | ||
|
|
cebdd71065 | ||
|
|
668304cb72 | ||
|
|
c28c5a5554 | ||
|
|
450493069c | ||
|
|
d7519aa95a | ||
|
|
e89ab89874 | ||
|
|
025fa81941 | ||
|
|
845c66b511 | ||
|
|
3725e238fc | ||
|
|
ac2ac82187 | ||
|
|
5e6be0c4b4 | ||
|
|
ed66c6a259 | ||
|
|
0db7736247 | ||
|
|
02cebe0966 | ||
|
|
4f2bb6291f | ||
|
|
498c8afbe4 | ||
|
|
0e6dce4750 | ||
|
|
7a74579c8b | ||
|
|
c23630a980 | ||
|
|
205df83c1c | ||
|
|
b26f65dab4 | ||
|
|
8d1ac8f41d | ||
|
|
115916fd36 | ||
|
|
6641ed9d96 | ||
|
|
5e3d408706 | ||
|
|
8fc9e3e5ce | ||
|
|
e7aa9731d0 | ||
|
|
0fc63655e9 | ||
|
|
86b47cb434 | ||
|
|
b3ec97d95c | ||
|
|
1620758545 | ||
|
|
5a2d51db95 | ||
|
|
c0e99364a4 | ||
|
|
371a27c646 | ||
|
|
4a06dcff3e | ||
|
|
0f54bf86ac | ||
|
|
921c524f0e | ||
|
|
a8df9b50de | ||
|
|
5da9b1e94e | ||
|
|
63871c9bcc | ||
|
|
e5b61825ff | ||
|
|
2d484ea993 | ||
|
|
b5b7d50742 | ||
|
|
19d77a9ad9 | ||
|
|
e77c0460de | ||
|
|
2ad5843f4f | ||
|
|
631ef5fe20 | ||
|
|
cd246e89c8 | ||
|
|
438374532f | ||
|
|
92609b9ead | ||
|
|
07b51f12a2 | ||
|
|
16494389c6 | ||
|
|
be86f0278f | ||
|
|
7e7ae86f65 | ||
|
|
3b2139d3df | ||
|
|
16c59b5c47 | ||
|
|
49cc584914 | ||
|
|
aeefac1d4e | ||
|
|
2b30607d9c | ||
|
|
cef8d3ff95 | ||
|
|
64646486e9 | ||
|
|
769e68d49b | ||
|
|
3dcb134aa1 | ||
|
|
81cb0eae64 | ||
|
|
4fad9925ec | ||
|
|
92d246eda0 | ||
|
|
34479778b9 | ||
|
|
163d209071 | ||
|
|
8eb601f24d | ||
|
|
ac9407b59d | ||
|
|
00dd0ed8fd | ||
|
|
6a53417b62 | ||
|
|
90f2b83fc0 | ||
|
|
3382c6e77a | ||
|
|
072de642e1 | ||
|
|
489ebd04aa | ||
|
|
2a68934b0e | ||
|
|
f3a502b7df | ||
|
|
2b0e66c71d | ||
|
|
e5c01a14d9 | ||
|
|
e5ef10beac | ||
|
|
4c3c499ad5 | ||
|
|
bdc7f5abd8 | ||
|
|
0ff78b9d4c | ||
|
|
41959d863f | ||
|
|
e7d495e47d | ||
|
|
e4f5be3f41 | ||
|
|
f42c1b7f0c | ||
|
|
9dbca87429 | ||
|
|
49ae2a84c4 | ||
|
|
34073844bc | ||
|
|
6f3b9be77e | ||
|
|
f675c7ada2 | ||
|
|
6aee0a71ed | ||
|
|
fa818c5cf8 | ||
|
|
0ef9505af1 | ||
|
|
bf69524fd8 | ||
|
|
58df07300e | ||
|
|
bef4928162 | ||
|
|
5995204d8d | ||
|
|
69b7c94176 | ||
|
|
540bc8ca74 | ||
|
|
03920d5b90 | ||
|
|
765637ce2d | ||
|
|
b4596ae6e9 | ||
|
|
4c92cb7af0 | ||
|
|
770b8447ac | ||
|
|
f3532fc3cb | ||
|
|
a7cfbc0b76 | ||
|
|
608dd087b8 | ||
|
|
5d2871b9ed | ||
|
|
779c870613 | ||
|
|
3cd585fe41 | ||
|
|
ff27ae7635 | ||
|
|
a41e805e8d | ||
|
|
9bcf3aa7f6 | ||
|
|
ff2248720c | ||
|
|
9bd2cd2634 | ||
|
|
9ba1b58d2e | ||
|
|
1d8728c7ce | ||
|
|
af68f35400 | ||
|
|
de269b66b5 | ||
|
|
ea894c2db5 | ||
|
|
bd9785c195 | ||
|
|
044046080d | ||
|
|
04efa02089 | ||
|
|
426a21fd0b | ||
|
|
8523324962 | ||
|
|
f06f819adb | ||
|
|
ac8e766476 | ||
|
|
a67a709782 | ||
|
|
9543de4170 | ||
|
|
79fea707f3 | ||
|
|
1034c8e752 | ||
|
|
aa95f60a81 | ||
|
|
420cf6397b | ||
|
|
fce2fcf293 | ||
|
|
41c662f053 | ||
|
|
72d2b602ab | ||
|
|
dc08f308d0 | ||
|
|
910f15dfbf | ||
|
|
d4f8c23cce | ||
|
|
324be83f9b | ||
|
|
ea8d4cb63d | ||
|
|
7b5231af80 | ||
|
|
63b7b83363 | ||
|
|
7a814c2a00 | ||
|
|
76053d466b | ||
|
|
6020d6e4eb | ||
|
|
61d06dc910 | ||
|
|
e889215cf4 | ||
|
|
cdc971f733 | ||
|
|
863856d27d | ||
|
|
cf5dd8cb71 | ||
|
|
619c06a511 | ||
|
|
9b85630405 | ||
|
|
078dc08ed0 | ||
|
|
f82658cee2 | ||
|
|
7c2135a8fe | ||
|
|
b5383a445e | ||
|
|
f3c0da79e8 | ||
|
|
c4c221f58c | ||
|
|
2a622d4aa2 | ||
|
|
baa67cfe02 | ||
|
|
d0cddd072c | ||
|
|
e20a95029c | ||
|
|
392a02b83c | ||
|
|
385825c9e8 | ||
|
|
acb5491225 | ||
|
|
5d4dedcb25 | ||
|
|
775af25d1b | ||
|
|
c4e4bb2e77 | ||
|
|
7e2781148e | ||
|
|
dd851fb344 | ||
|
|
531a728b37 | ||
|
|
f10c5797bb | ||
|
|
052f39d330 | ||
|
|
2e593d11eb | ||
|
|
e150624f4d | ||
|
|
ca9d83e424 | ||
|
|
3b1544b330 | ||
|
|
518a1f792c | ||
|
|
2f3b09ffc5 | ||
|
|
d9c60584eb | ||
|
|
d8e0772a0f | ||
|
|
875caf0e28 | ||
|
|
86601e1ba1 | ||
|
|
67a762e51c | ||
|
|
d6881bfdf3 | ||
|
|
878c89591e | ||
|
|
f332fd7141 | ||
|
|
bb3be1c649 | ||
|
|
e88175b349 | ||
|
|
c0f4c5acef | ||
|
|
1f9df9bb67 | ||
|
|
de4a0c61b9 | ||
|
|
0f3f54f8d0 | ||
|
|
60f7fbe4c3 | ||
|
|
37e84ee678 | ||
|
|
04878cea50 | ||
|
|
7c940bd633 | ||
|
|
5769b6ad48 | ||
|
|
b17d710044 | ||
|
|
441601bd42 | ||
|
|
d1f5bd8300 | ||
|
|
98c1194e5b | ||
|
|
85f2f31469 | ||
|
|
fe3867bc5c | ||
|
|
b2e467714e | ||
|
|
0993716c8e | ||
|
|
c19802fa13 | ||
|
|
efa5084d8b | ||
|
|
673e04a1b6 | ||
|
|
a4a589a40c | ||
|
|
0436906a59 | ||
|
|
f2a3c47cf7 | ||
|
|
80db263929 | ||
|
|
701c2f33bb | ||
|
|
dd8dce1d59 | ||
|
|
cd1bee1018 | ||
|
|
3f9312a606 | ||
|
|
f2c7b9904b | ||
|
|
9ac7f691e0 | ||
|
|
bf1da91018 | ||
|
|
3f8fc9475a | ||
|
|
72c3006c8a | ||
|
|
5c8ebd6476 | ||
|
|
2efdb8bb61 | ||
|
|
b9886599ed | ||
|
|
570570570b | ||
|
|
1593dc3070 | ||
|
|
9931138e5d | ||
|
|
91e7b95332 | ||
|
|
f912389a36 | ||
|
|
be5122cec6 | ||
|
|
9f9883ac3e | ||
|
|
5e50056f4a | ||
|
|
d97fa481c8 | ||
|
|
495fb4e074 | ||
|
|
82a1669306 | ||
|
|
0adec1cb51 | ||
|
|
f8a358c21e | ||
|
|
6a40a351a7 | ||
|
|
e8af9418bf | ||
|
|
4245238112 | ||
|
|
88c92dd762 | ||
|
|
6a38189ee2 | ||
|
|
694e20c9b6 | ||
|
|
d0c27c4fe0 | ||
|
|
82e71f6779 | ||
|
|
ab6b96976c | ||
|
|
47c2184d5f | ||
|
|
04b0be79cd | ||
|
|
9b212bd455 | ||
|
|
62b06b23a5 | ||
|
|
bbea6da45c | ||
|
|
4452b62cbd | ||
|
|
4a7d14b01f | ||
|
|
9ab78cf824 | ||
|
|
615b3409be | ||
|
|
7465f23809 | ||
|
|
0598491753 | ||
|
|
88bf586da4 | ||
|
|
369753f94a | ||
|
|
29f79285a7 | ||
|
|
81951287c6 | ||
|
|
be86f791e4 | ||
|
|
4c70ac6412 | ||
|
|
d8de284c37 | ||
|
|
39d43bc217 | ||
|
|
7bb6d7f0e9 | ||
|
|
fc8bf749a4 | ||
|
|
95a3d7def6 | ||
|
|
1155cae130 | ||
|
|
f645aea402 | ||
|
|
1a82625f39 | ||
|
|
bcc54ccd8f | ||
|
|
5df13df7fc | ||
|
|
47fd6206f6 | ||
|
|
776f8ed841 | ||
|
|
cf20ca885e | ||
|
|
e2e7a091af | ||
|
|
17e605cfd9 | ||
|
|
80999a8573 | ||
|
|
8deb18fe9c | ||
|
|
bb3688bf7a | ||
|
|
d3c7d54466 | ||
|
|
b844aafcf3 | ||
|
|
5f17dabb0b | ||
|
|
e0fb7927ed | ||
|
|
567ea533a9 | ||
|
|
cb62b0eb3a | ||
|
|
069d3865d4 | ||
|
|
a40ba5243e | ||
|
|
2c7d1af146 | ||
|
|
6bf5bdce2b | ||
|
|
c5c4a571c5 | ||
|
|
9464e3e4e1 | ||
|
|
03b99f1bbf | ||
|
|
d2e9b6f582 | ||
|
|
2bc8a5629f | ||
|
|
95ad2484ef | ||
|
|
9a8f8722bd | ||
|
|
08cf231dfc | ||
|
|
1f13ac3c77 | ||
|
|
d9bea4209c | ||
|
|
159390c094 | ||
|
|
0d3ee53bd5 | ||
|
|
06018303e7 | ||
|
|
51e91cdab0 | ||
|
|
7038c1163f | ||
|
|
812b5cddcc | ||
|
|
caed4635eb | ||
|
|
7043e4e11e | ||
|
|
566dfb7ba8 | ||
|
|
b0238fc0a3 | ||
|
|
47ae6ab4ae | ||
|
|
14716e4ed1 | ||
|
|
095d4aab2b | ||
|
|
4144a8970b | ||
|
|
ec3c0aae0a | ||
|
|
b443cab973 | ||
|
|
2e3b120bb1 | ||
|
|
d640a2f4b6 | ||
|
|
5116767ec7 | ||
|
|
43412cde9e | ||
|
|
d225d97863 | ||
|
|
7983423e2a | ||
|
|
7859ce582a | ||
|
|
3e1013fc12 | ||
|
|
5f7b4443c2 | ||
|
|
57977ae8b6 | ||
|
|
d21d4fb766 | ||
|
|
298d4a9b17 | ||
|
|
be82f1fe0e | ||
|
|
459cb5bb4a | ||
|
|
8d39bf82d2 | ||
|
|
e762aca7fb | ||
|
|
ace0bdb2a6 | ||
|
|
f6e44914fa | ||
|
|
6b6098164a | ||
|
|
6572623313 | ||
|
|
7f4bbcccf2 | ||
|
|
a49a81cff7 | ||
|
|
88fc2d4951 | ||
|
|
2c64b8905d | ||
|
|
dda796b929 | ||
|
|
4fd332490a | ||
|
|
be7c433343 | ||
|
|
6181e6a0f2 | ||
|
|
c5453fff5b | ||
|
|
b9b7fc95b4 | ||
|
|
b8a51409ab | ||
|
|
cebaab8e8b | ||
|
|
76bef24456 | ||
|
|
871b95891d | ||
|
|
f5ddde647a | ||
|
|
d4de7db70d | ||
|
|
ad858266d5 | ||
|
|
8772004e8e | ||
|
|
aec3519ec9 | ||
|
|
20bbbc7741 | ||
|
|
5ee93200ed | ||
|
|
981c399e65 | ||
|
|
96429a8c7a | ||
|
|
e1fc3e7b82 | ||
|
|
498115637a | ||
|
|
2322a145f6 | ||
|
|
53bab003bf | ||
|
|
97fc922321 | ||
|
|
8c32d64f35 | ||
|
|
1dfbf12f46 | ||
|
|
0f9256325c | ||
|
|
93c6ba5e74 | ||
|
|
2d3e14fc6c | ||
|
|
3ad842b02a | ||
|
|
14cfb65b6b | ||
|
|
cd926f559d | ||
|
|
cafa247279 | ||
|
|
e411b80fdc | ||
|
|
ae5e680e35 | ||
|
|
db684afd84 | ||
|
|
dc2ab14412 | ||
|
|
9e28ca5df3 | ||
|
|
dcfc12a849 | ||
|
|
ad3f9b53ad | ||
|
|
e7e0937ae5 | ||
|
|
0325b0214b | ||
|
|
6d616ca4cc | ||
|
|
a2620870ad | ||
|
|
a9ab29fcbb | ||
|
|
65f2c4d4a5 | ||
|
|
2ba5c8277d | ||
|
|
28f3b3f323 | ||
|
|
607dbaacb1 | ||
|
|
656bd36a1d | ||
|
|
1b83bd22b9 | ||
|
|
54eba8509e | ||
|
|
996b88cb2e | ||
|
|
441d950e94 | ||
|
|
59c2afe0e8 | ||
|
|
441cf91ff6 | ||
|
|
41a1b3323f | ||
|
|
4e31493cc8 | ||
|
|
8abe8df823 | ||
|
|
39af5d29c6 | ||
|
|
52d073cb8c | ||
|
|
65a6854cc0 | ||
|
|
ec540bcf20 | ||
|
|
4e9748f4dc | ||
|
|
82da9bc2e7 | ||
|
|
4cc9715f57 | ||
|
|
75f72cb04e | ||
|
|
3d58b8baf2 | ||
|
|
0c2839e6c9 | ||
|
|
0df833ca8a | ||
|
|
82988ce74f | ||
|
|
32fbb2964e | ||
|
|
38d7562bb3 | ||
|
|
a8dd8d98cb | ||
|
|
615383f924 | ||
|
|
25fa494b7b | ||
|
|
8b321e36db | ||
|
|
3822c6f5ab | ||
|
|
21a329b1d3 | ||
|
|
8d669d9f54 | ||
|
|
9a905c6111 | ||
|
|
239bcddfa2 | ||
|
|
cd5e20a3f4 | ||
|
|
518e87e4f1 | ||
|
|
6cd0be4c17 | ||
|
|
04db65f01f | ||
|
|
aa63fe2cb4 | ||
|
|
0593e3484c | ||
|
|
80bb277386 | ||
|
|
ec22661e87 | ||
|
|
80cdc2fb95 | ||
|
|
bfedd4d11b | ||
|
|
f58831f916 | ||
|
|
328d6b7fa7 | ||
|
|
98105cbf21 | ||
|
|
c9c57db7c1 | ||
|
|
7d4f1b2a44 | ||
|
|
7b7d1994c7 | ||
|
|
8b438d8d76 | ||
|
|
7a510a98ad | ||
|
|
66034de880 | ||
|
|
b9ca3e6beb | ||
|
|
9ad0872854 | ||
|
|
e6933922cd | ||
|
|
d6d6d88e20 | ||
|
|
8974d93877 | ||
|
|
7e6bef9008 | ||
|
|
1e2711a616 | ||
|
|
fd81675168 | ||
|
|
3dc347c66a | ||
|
|
8a8f4fa563 | ||
|
|
ed3fc330ab | ||
|
|
9fa025caa4 | ||
|
|
b54f938bd5 | ||
|
|
4efba80fc6 | ||
|
|
c3eab4820f | ||
|
|
a5bb127a1e | ||
|
|
ae1ed99c9f | ||
|
|
fa36932fbc | ||
|
|
9ac3dd07b9 | ||
|
|
4ca28941d0 | ||
|
|
4b2e207ddf | ||
|
|
88055f1c84 | ||
|
|
2f68a9444a | ||
|
|
0ccd711b0f | ||
|
|
63a6cb7afe | ||
|
|
d9fc5482db | ||
|
|
4f06438371 | ||
|
|
5afb5f2419 | ||
|
|
9f467a23b4 | ||
|
|
76dd46b30c | ||
|
|
0c1ddecaf1 | ||
|
|
d36d4733ca | ||
|
|
18dac8fb72 | ||
|
|
fb1db6df1c | ||
|
|
3fb487b67b | ||
|
|
2e1d497aad | ||
|
|
754bd14342 | ||
|
|
c4026c87ce | ||
|
|
e6b8454a94 | ||
|
|
98f68d6b45 | ||
|
|
5ef1bcbdb6 | ||
|
|
7846239be9 | ||
|
|
f8e2d6c86b | ||
|
|
b06f4a5781 | ||
|
|
968faf9200 | ||
|
|
62ceb13385 | ||
|
|
bed0046618 | ||
|
|
8a2287c685 | ||
|
|
3c85440d34 | ||
|
|
7ed21ff08c | ||
|
|
df42ec3d3a | ||
|
|
35b62520c9 | ||
|
|
e6936dc10e | ||
|
|
d5904fe9fa | ||
|
|
20d8fbc389 | ||
|
|
70ccb8b4d8 | ||
|
|
175571072f | ||
|
|
b0e25a35fb | ||
|
|
08e7041bcf | ||
|
|
b58ebcd7a7 | ||
|
|
8eb2472171 | ||
|
|
f73d89f41b | ||
|
|
95848197c5 | ||
|
|
442ac6969f | ||
|
|
3fb2c0aeff | ||
|
|
8ed99092ff | ||
|
|
f393709944 | ||
|
|
527da6bcc5 | ||
|
|
17940d453c | ||
|
|
8d623ae8fa | ||
|
|
c9d3480c58 | ||
|
|
e133b68472 | ||
|
|
9ecfe1e10e | ||
|
|
3a38ca6b61 | ||
|
|
62cb5cdba7 | ||
|
|
1cb0345b37 | ||
|
|
b3e6a3f157 | ||
|
|
6ed831c968 | ||
|
|
3f1d992879 | ||
|
|
c076ebce6f | ||
|
|
56e006318f | ||
|
|
4867b031b9 | ||
|
|
548973cf11 | ||
|
|
9c575d7fbf | ||
|
|
feefbeb5b4 | ||
|
|
a4d8081b73 | ||
|
|
467e51374d | ||
|
|
ec27a5843b |
+8
-2
@@ -4,12 +4,18 @@ DeviceTest/bin/
|
||||
DeviceTest/obj/
|
||||
Dirichlet.Numerics/bin
|
||||
Dirichlet.Numerics/obj
|
||||
GemCard/bin
|
||||
GemCard/obj
|
||||
GraphLib/bin
|
||||
GraphLib/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
ResultsBrowser/obj/
|
||||
TestBenchFramework/bin/
|
||||
TestBenchFramework/obj/
|
||||
TBF/bin/
|
||||
TBF/obj/
|
||||
TBFSetup/Debug/
|
||||
TBFSetup/Release/
|
||||
Users/bin/
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -77,6 +77,7 @@
|
||||
<Compile Include="Entities\IHasItemNr.cs" />
|
||||
<Compile Include="Entities\IHasName.cs" />
|
||||
<Compile Include="Entities\IHasValves.cs" />
|
||||
<Compile Include="Entities\IParamsProvider.cs" />
|
||||
<Compile Include="Entities\MeasurementCorrection.cs" />
|
||||
<Compile Include="Entities\MetersPath.cs" />
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
@@ -91,6 +92,7 @@
|
||||
<Compile Include="Entities\Watermeter.cs" />
|
||||
<Compile Include="Entities\WMType.cs" />
|
||||
<Compile Include="FluentCommon.cs" />
|
||||
<Compile Include="Formulas.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
<Compile Include="Mappings\ComponentMap.cs" />
|
||||
<Compile Include="Mappings\ComponentProcedureMap.cs" />
|
||||
@@ -117,6 +119,7 @@
|
||||
<DependentUpon>Strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Units.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Strings.cs.resx" />
|
||||
|
||||
+30
-6
@@ -14,38 +14,62 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif DN100 || BADGER_VELKA_TRAT
|
||||
#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 FUZHOU300 || FUZHOU150 || PT200IL || PUCHONG_PT200 || GENESIS || SLM_150 || PETERSBURG_200
|
||||
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_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 TORINO50 || BADGER_MALA_TRAT || BERLIN
|
||||
#elif DUBAJ_50
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 5;
|
||||
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;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN
|
||||
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 TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50
|
||||
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50
|
||||
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
|
||||
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
|
||||
public const int WMsCount = 6;
|
||||
#elif TURA_SPECIAL || SENTEC
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Config
|
||||
result.IsRealBench = IsRealBench;
|
||||
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
|
||||
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
|
||||
result.UsersDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
|
||||
result.UsersDBSettings = (Users.DBSettings)UsersDBSettings.Clone();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -22,6 +24,8 @@ namespace Config.Entities
|
||||
|
||||
public Component()
|
||||
{
|
||||
Name = string.Empty;
|
||||
ClassName = string.Empty;
|
||||
Corrections = new List<MeasurementCorrection>();
|
||||
}
|
||||
|
||||
@@ -53,6 +57,59 @@ namespace Config.Entities
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(ClassName);
|
||||
output.WriteLine(ParentName);
|
||||
output.WriteLine(Mode.ToString());
|
||||
output.WriteLine(Logging.ToString());
|
||||
output.Write(Parameters);
|
||||
|
||||
output.Close();
|
||||
}
|
||||
|
||||
public static Component Import(StreamReader input)
|
||||
{
|
||||
Component result = new Component();
|
||||
|
||||
result.Name = input.ReadLine();
|
||||
result.ClassName = input.ReadLine();
|
||||
result.ParentName = input.ReadLine();
|
||||
|
||||
string line = input.ReadLine();
|
||||
if (line.Equals(DebugMode.DetectedOff.ToString())) result.Mode = DebugMode.DetectedOff;
|
||||
else if (line.Equals(DebugMode.DetectedOn.ToString())) result.Mode = DebugMode.DetectedOn;
|
||||
else if (line.Equals(DebugMode.Normal.ToString())) result.Mode = DebugMode.Normal;
|
||||
else if (line.Equals(DebugMode.AutoDetect.ToString())) result.Mode = DebugMode.AutoDetect;
|
||||
else if (line.Equals(DebugMode.FailureDuringOperation.ToString())) result.Mode = DebugMode.FailureDuringOperation;
|
||||
else if (line.Equals(DebugMode.Off.ToString())) result.Mode = DebugMode.Off;
|
||||
else if (line.Equals(DebugMode.Record.ToString())) result.Mode = DebugMode.Record;
|
||||
else if (line.Equals(DebugMode.Reply.ToString())) result.Mode = DebugMode.Reply;
|
||||
else if (line.Equals(DebugMode.Simulate.ToString())) result.Mode = DebugMode.Simulate;
|
||||
else if (line.Equals(DebugMode.Inherit.ToString())) result.Mode = DebugMode.Inherit;
|
||||
|
||||
line = input.ReadLine();
|
||||
if (line.Equals(LogLevel.Off.ToString())) result.Logging = LogLevel.Off;
|
||||
else if (line.Equals(LogLevel.Fatal.ToString())) result.Logging = LogLevel.Fatal;
|
||||
else if (line.Equals(LogLevel.Error.ToString())) result.Logging = LogLevel.Error;
|
||||
else if (line.Equals(LogLevel.Warn.ToString())) result.Logging = LogLevel.Warn;
|
||||
else if (line.Equals(LogLevel.Info.ToString())) result.Logging = LogLevel.Info;
|
||||
else if (line.Equals(LogLevel.Debug.ToString())) result.Logging = LogLevel.Debug;
|
||||
else if (line.Equals(LogLevel.All.ToString())) result.Logging = LogLevel.All;
|
||||
|
||||
result.Parameters = string.Empty;
|
||||
line = input.ReadLine();
|
||||
while (line != null)
|
||||
{
|
||||
result.Parameters += line;
|
||||
result.Parameters += Environment.NewLine;
|
||||
line = input.ReadLine();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string ToString(string indent)
|
||||
{
|
||||
string result = string.Empty;
|
||||
@@ -70,5 +127,10 @@ namespace Config.Entities
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} ({1})", Name, ClassName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -13,13 +13,25 @@ namespace Config.Entities
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
IParamsProvider paramsProvider;
|
||||
///
|
||||
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
|
||||
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
|
||||
|
||||
|
||||
protected ComponentProcedure() { }
|
||||
|
||||
public ComponentProcedure(string name, string parameters, Procedure procedure)
|
||||
{
|
||||
this.CmpntName = name;
|
||||
this.Parameters = parameters;
|
||||
this.Procedure = procedure;
|
||||
}
|
||||
|
||||
|
||||
public virtual ComponentProcedure Clone(Procedure newProcedure)
|
||||
{
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
return new ComponentProcedure(CmpntName, Parameters, newProcedure);
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
@@ -34,11 +46,16 @@ namespace Config.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
try
|
||||
{
|
||||
string cmptnName = firstLine;
|
||||
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
return new ComponentProcedure(cmptnName, parameters, newProcedure);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -13,13 +13,25 @@ namespace Config.Entities
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Test Test { get; set; }
|
||||
|
||||
IParamsProvider paramsProvider;
|
||||
///
|
||||
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
|
||||
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
|
||||
|
||||
|
||||
protected ComponentTest() { }
|
||||
|
||||
public ComponentTest(string name, string parameters, Test test)
|
||||
{
|
||||
this.CmpntName = name;
|
||||
this.Parameters = parameters;
|
||||
this.Test = test;
|
||||
}
|
||||
|
||||
|
||||
public virtual ComponentTest Clone()
|
||||
{
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Test = Test;
|
||||
return result;
|
||||
return new ComponentTest(CmpntName, Parameters, Test);
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
@@ -34,11 +46,16 @@ namespace Config.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Test = newTest;
|
||||
return result;
|
||||
try
|
||||
{
|
||||
string cmptnName = firstLine;
|
||||
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
return new ComponentTest(cmptnName, parameters, newTest);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+131
-11
@@ -38,7 +38,45 @@ namespace Config.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public enum ProcedureState
|
||||
/// <summary>
|
||||
/// Flags returned by each device configuration control Verify(...) function.
|
||||
/// </summary>
|
||||
public enum CfgUpdateFlags
|
||||
{
|
||||
None = 0,
|
||||
Error = 0x1, /// Some settings in the user control are invalid and cannot be set
|
||||
Warning = 0x02, /// Some settings in the user control are suspicious, can be set after user confirmation
|
||||
RestartRqrd = 0x04, /// TBF program restart is required to apply all changed parameters
|
||||
AnyChange = 0x08, /// At least one parameter have changed
|
||||
VolatileChange = 0x10,
|
||||
InvokeCfgChange = 0x20, /// Invoke CfgChange handler of the component
|
||||
}
|
||||
|
||||
public enum RemoteDBUse
|
||||
{
|
||||
[Description("Local DB only")] LocalDBOnly,
|
||||
[Description("Remote DB only")] RemoteDBOnly,
|
||||
[Description("Both DB-s, local 1st")] BothDBsLocalFirst,
|
||||
[Description("Both DB-s, remote 1st")] BothDBsRemoteFirst,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains a procedure name and a database specification (local/remote).
|
||||
/// </summary>
|
||||
public class ProcedureInfo
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly Users.Entities.DBKind DBKind;
|
||||
|
||||
public ProcedureInfo(string name, Users.Entities.DBKind dbKind)
|
||||
{
|
||||
Name = name;
|
||||
DBKind = dbKind;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ProcedureState
|
||||
{
|
||||
Active,
|
||||
History,
|
||||
@@ -56,8 +94,12 @@ namespace Config.Entities
|
||||
[Description("Vodoměry")] Single,
|
||||
[Description("Kombinované vodoměry")] Combined,
|
||||
[Description("Měřiče tepla")] HeatMeter,
|
||||
#elif LANG_RU
|
||||
[Description("Счетчик")] Single,
|
||||
[Description("Комбинированный счетчик")] Combined,
|
||||
[Description("Счетчик тепла")] HeatMeter,
|
||||
#else
|
||||
[Description("Water meters")] Single,
|
||||
[Description("Water meters")] Single,
|
||||
[Description("Compound water meters")] Combined,
|
||||
[Description("Heat meters")] HeatMeter,
|
||||
#endif
|
||||
@@ -76,22 +118,29 @@ namespace Config.Entities
|
||||
|
||||
public enum Medium
|
||||
{
|
||||
[Description("")] NotSpecified,
|
||||
ColdWater,
|
||||
HotWater,
|
||||
[Description("")] NotSpecified,
|
||||
#if LANG_PL
|
||||
[Description("zimna")] ColdWater,
|
||||
[Description("ciepła")] HotWater,
|
||||
#elif LANG_IT
|
||||
[Description("freddo")] ColdWater,
|
||||
[Description("caldo")] HotWater,
|
||||
#else
|
||||
[Description("cold")] ColdWater,
|
||||
[Description("hot")] HotWater,
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
|
||||
public enum Mounting
|
||||
{
|
||||
[Description("")] NotSpecified,
|
||||
#if LANG_DE
|
||||
[Description("")] NotSpecified,
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("STR")] S, /// standrohre
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("STR")] S, /// standrohre
|
||||
[Description("F")] F, /// fall
|
||||
#else
|
||||
[Description("")] NotSpecified,
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("S")] S, /// steig
|
||||
@@ -153,6 +202,17 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary> Register reader type </summary>
|
||||
public enum RegisterReaderType
|
||||
{
|
||||
Unknown,
|
||||
Pulses, /// Sick, optical and similar
|
||||
Camera, /// CLP1611
|
||||
DataStream, /// iPerl
|
||||
Manual, /// Entered by human via form (also from camera images)
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary> Transition step is finished when this condition is fulfilled </summary>
|
||||
public enum StepCondition
|
||||
{
|
||||
@@ -370,4 +430,64 @@ namespace Config.Entities
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
|
||||
public enum VertAlignment
|
||||
{
|
||||
[Description("Top")] Top,
|
||||
[Description("Middle")] Middle,
|
||||
[Description("Bottom")] Bottom,
|
||||
}
|
||||
|
||||
public enum TableForm
|
||||
{
|
||||
None,
|
||||
Rows,
|
||||
Columns,
|
||||
ColumnsPL,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ImageRotation
|
||||
{
|
||||
[Description("0 deg")] None,
|
||||
[Description("90 deg")] Deg90,
|
||||
[Description("180 deg")] Deg180,
|
||||
[Description("270 deg")] Deg270,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum CameraDisplayResolution
|
||||
{
|
||||
Small,
|
||||
Medium,
|
||||
Large,
|
||||
// FullScreen,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ErrorFlagsMode : sbyte
|
||||
{
|
||||
#if LANG_DE
|
||||
[Description("aus")] Off,
|
||||
[Description("info")] Info,
|
||||
[Description("ein")] On,
|
||||
#elif LANG_CS
|
||||
[Description("vypnuto")] Off,
|
||||
[Description("info")] Info,
|
||||
[Description("zapnuto")] On,
|
||||
#elif LANG_RU
|
||||
[Description("выкл")] Off,
|
||||
[Description("инфо")] Info,
|
||||
[Description("вкл")] On,
|
||||
#elif LANG_PL
|
||||
[Description("nie")] Off,
|
||||
[Description("info")] Info,
|
||||
[Description("tak")] On,
|
||||
#else // LANG_EN
|
||||
[Description("off")] Off,
|
||||
[Description("info")] Info,
|
||||
[Description("on")] On,
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
}
|
||||
|
||||
+21
-6
@@ -1,10 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Generic
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public interface IParamsProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Get XML Serializer
|
||||
/// </summary>
|
||||
XmlSerializer GetSerializer();
|
||||
|
||||
string ComponentName { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -13,13 +22,19 @@ namespace TBF.BenchControl.Generic
|
||||
int ParamsCount();
|
||||
|
||||
/// <summary>
|
||||
/// Parameter names
|
||||
/// Returns a parameter name
|
||||
/// </summary>
|
||||
/// <param name="ix">Zero based index of the parameter</param>
|
||||
string ParamName(int ix);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of possible values of one parameter (ComboBox when editing) or null (Textbox when editing).
|
||||
/// </summary>
|
||||
/// <param name="ix">Zero based index of the parameter</param>
|
||||
IList<string> ParamValues(int ix);
|
||||
|
||||
/// <summary>
|
||||
/// Parameter values in string form
|
||||
/// Returns a parameter value in the string form
|
||||
/// </summary>
|
||||
/// <param name="ix">Zero based index of the parameter</param>
|
||||
string ToString(int ix);
|
||||
@@ -43,9 +58,9 @@ namespace TBF.BenchControl.Generic
|
||||
/// </summary>
|
||||
/// <param name="ix">Zero based index of the parameter</param>
|
||||
/// <param name="strValue">String representation of the parameter</param>
|
||||
void UpdateParam(int ix, string strValue);
|
||||
CfgUpdateFlags UpdateParam(int ix, string strValue);
|
||||
|
||||
void UpdateDbEntity();
|
||||
void UpdateEmbeddedDbEntity();
|
||||
|
||||
/// <summary>
|
||||
/// Creates an object copy
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
@@ -8,7 +8,15 @@ namespace Config.Entities
|
||||
public class MeasurementCorrection
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int RangeIx { get; set; } /// 0..5
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float Correction { get; set; }
|
||||
|
||||
public MeasurementCorrection() { }
|
||||
|
||||
public MeasurementCorrection(int rangeIx)
|
||||
{
|
||||
RangeIx = rangeIx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,15 @@ namespace Config.Entities
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public virtual ComponentProcedure GetProcedureParamsEntity(string cmpntName)
|
||||
{
|
||||
foreach (var procPrms in MoreParams)
|
||||
{
|
||||
if (procPrms.CmpntName == cmpntName) return procPrms;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}, rev.{1}", Name, Revision);
|
||||
|
||||
+64
-6
@@ -25,8 +25,8 @@ namespace Config.Entities
|
||||
public virtual float Volume { get; set; } /// Test volume (target) in [l]
|
||||
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
|
||||
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
|
||||
public virtual int Repeats { get; set; }
|
||||
public virtual bool DoDraining { get; set; }
|
||||
@@ -115,6 +115,10 @@ namespace Config.Entities
|
||||
result.Qto = Qto;
|
||||
result.Volume = Volume;
|
||||
result.TstTime = TstTime;
|
||||
result.Method = Method;
|
||||
result.ErrLimLo = ErrLimLo;
|
||||
result.ErrLimHi = ErrLimHi;
|
||||
result.Uncertainty = Uncertainty;
|
||||
result.Repeats = Repeats;
|
||||
result.DoDraining = DoDraining;
|
||||
result.DoZeroing = DoZeroing;
|
||||
@@ -129,10 +133,6 @@ namespace Config.Entities
|
||||
result.TimeFlow2Mass = TimeFlow2Mass;
|
||||
result.TimePump2StartV = TimePump2StartV;
|
||||
result.TimeStop2Mass = TimeStop2Mass;
|
||||
result.Method = Method;
|
||||
result.ErrLimLo = ErrLimLo;
|
||||
result.ErrLimHi = ErrLimHi;
|
||||
result.Uncertainty = Uncertainty;
|
||||
result.TolerRed = TolerRed;
|
||||
result.RedType = RedType;
|
||||
result.FeedingPath = FeedingPath;
|
||||
@@ -301,6 +301,64 @@ namespace Config.Entities
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public virtual ComponentTest GetTestParamsEntity(string cmpntName)
|
||||
{
|
||||
foreach (var tstPrms in MoreParams)
|
||||
{
|
||||
if (tstPrms.CmpntName == cmpntName) return tstPrms;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual float GetErrLimLo(float flow)
|
||||
{
|
||||
if (ErrLimLo <= ErrLimHi)
|
||||
{
|
||||
return ErrLimLo; /// Error limit of a water meter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(ErrLimLo);
|
||||
float Qp = Math.Abs(ErrLimHi);
|
||||
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
{
|
||||
default:
|
||||
case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
|
||||
case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
|
||||
case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual float GetErrLimHi(float flow)
|
||||
{
|
||||
if (ErrLimLo <= ErrLimHi)
|
||||
{
|
||||
return ErrLimHi; /// Error limit of a water meter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(ErrLimLo);
|
||||
float Qp = Math.Abs(ErrLimHi);
|
||||
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
{
|
||||
default:
|
||||
case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
|
||||
case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
|
||||
case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty;
|
||||
|
||||
+7
-62
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@@ -39,7 +39,11 @@ namespace Config
|
||||
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
break;
|
||||
}
|
||||
case Users.Entities.DBKind.RemoteConfig:
|
||||
dbType = Data.CurrentBench.UsersDBSettings.DbType;
|
||||
connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString;
|
||||
break;
|
||||
}
|
||||
|
||||
return CreateSessionFactory(database, dbType, connectionString, false);
|
||||
}
|
||||
@@ -69,6 +73,7 @@ namespace Config
|
||||
{
|
||||
default:
|
||||
case Users.Entities.DBKind.Config:
|
||||
case Users.Entities.DBKind.RemoteConfig:
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
|
||||
break;
|
||||
case Users.Entities.DBKind.Results:
|
||||
@@ -122,41 +127,6 @@ namespace Config
|
||||
return SessionFactories[ix].OpenSession();
|
||||
}
|
||||
|
||||
public static void SaveToDb(Users.Entities.DBKind database, object obj)
|
||||
{
|
||||
SaveToDb(CreateSession(database), obj);
|
||||
}
|
||||
|
||||
public static void SaveToDb(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
session.SaveOrUpdate(obj);
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(Users.Entities.DBKind database, object obj)
|
||||
{
|
||||
DeleteFromDb(CreateSession(database), obj);
|
||||
}
|
||||
|
||||
public static void DeleteFromDb(ISession session, object obj)
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
session.Delete(obj);
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty users database.
|
||||
/// Database contains only the user 'admin' and the control board component 'CB'.
|
||||
@@ -213,30 +183,5 @@ namespace Config
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an empty water meters database
|
||||
/// </summary>
|
||||
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
|
||||
/// <param name="connectionString">Connection string</param>
|
||||
/// <returns>true=success, false=error</returns>
|
||||
public static bool CreateEmptyResultsDB(Users.Entities.DBType dbType, string connectionString)
|
||||
{
|
||||
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Results, dbType, connectionString, true);
|
||||
if (sessionFactory == null) return false;
|
||||
|
||||
/// Populate the database
|
||||
//using (var session = sessionFactory.OpenSession())
|
||||
//{
|
||||
// using (var transaction = session.BeginTransaction())
|
||||
// {
|
||||
// /// Create one component
|
||||
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
|
||||
// session.SaveOrUpdate(cmpnt);
|
||||
// transaction.Commit();
|
||||
// }
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl
|
||||
namespace Config
|
||||
{
|
||||
public static class Formulas
|
||||
{
|
||||
@@ -83,19 +83,50 @@ namespace TBF.BenchControl
|
||||
0.191203,
|
||||
0.049025,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate density of distilled water from temperature
|
||||
/// </summary>
|
||||
/// <param name="t">ITS-90 temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double DistilledWaterDensityFromTemp(double t)
|
||||
{
|
||||
if (t <= 40)
|
||||
{
|
||||
const double c0 = 999.839564;
|
||||
const double c1 = 0.067998613;
|
||||
const double c2 = -0.0091101468;
|
||||
const double c3 = 0.00010058299;
|
||||
const double c4 = -0.0000011275659;
|
||||
const double c5 = 6.5985371e-09;
|
||||
|
||||
return ((((c5 * t + c4) * t + c3) * t + c2) * t + c1) * t + c0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const double a0 = 9.9983952E2;
|
||||
const double a1 = 1.6952577E1;
|
||||
const double a2 = -7.9905127E-3;
|
||||
const double a3 = -4.6241757E-5;
|
||||
const double a4 = 1.0584601E-7;
|
||||
const double a5 = -2.8103006E-10;
|
||||
const double b = 1.6887236E-2;
|
||||
|
||||
return (((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0) / (1.0 + b * t);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate density of distilled water from temperature
|
||||
/// Calculate density of distilled water from temperature (obsolete)
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <param name="t">IPTS-68 temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double DistilledWaterDensityFromTemp(double t)
|
||||
public static double DistilledWaterDensityFromTempIPTS68(double t)
|
||||
{
|
||||
const double a0 = 999.842594;
|
||||
const double a1 = 0.06793952;
|
||||
const double a2 = -0.00909529;
|
||||
const double a2 = -0.009095290;
|
||||
const double a3 = 0.0001001685;
|
||||
const double a4 = -0.000001120083;
|
||||
const double a5 = 6.536332e-09;
|
||||
@@ -122,12 +153,29 @@ namespace TBF.BenchControl
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double WaterDensityFromTemp(double t)
|
||||
public static double WaterDensityFromTemp(double t, double realDensity, double atTemperature)
|
||||
{
|
||||
return DistilledWaterDensityFromTemp(t) +
|
||||
DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature);
|
||||
return DistilledWaterDensityFromTemp(t) + DensityCorrection(realDensity, atTemperature);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate corrected (real) water density from temperature
|
||||
/// </summary>
|
||||
/// <param name="t">Temperature in [°C]</param>
|
||||
/// <returns>Density in [kg/m3]</returns>
|
||||
public static double WaterDensityFromTempPress(double temp, double pressure, double realDensity, double atTemperature)
|
||||
{
|
||||
double x0 = 5.08821E-10;
|
||||
double x1 = 1.2639418;
|
||||
double x2 = 0.2660269;
|
||||
double x3 = 0.3734838;
|
||||
double x4 = 2.0205242;
|
||||
double theta = temp / 100.0;
|
||||
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
|
||||
|
||||
return WaterDensityFromTemp(temp, realDensity, atTemperature) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
|
||||
}
|
||||
|
||||
|
||||
public static float AirDensityFromAmbientVales(float tempC, float pressureBar, float humiPct)
|
||||
{
|
||||
@@ -160,13 +208,14 @@ namespace TBF.BenchControl
|
||||
{
|
||||
if (measuredVolume <= float.Epsilon)
|
||||
{
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, 99.0);
|
||||
return 99.0;
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, -100.0);
|
||||
return -100.0;
|
||||
}
|
||||
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, 99.0);
|
||||
return 99.0;
|
||||
}
|
||||
|
||||
double error = 100.0 * (measuredVolume - trueVolume) / trueVolume;
|
||||
log.InfoFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, error);
|
||||
return error;
|
||||
@@ -213,6 +262,20 @@ namespace TBF.BenchControl
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a measurement error to a correction (used when preparing correction tables).
|
||||
/// </summary>
|
||||
/// <param name="measuredValue">Measured value (in arbitrary units)</param>
|
||||
/// <param name="error">Measurement error in %</param>
|
||||
/// <returns>Correction in the same units as the measured value</returns>
|
||||
public static double CorrectionFromError(double measuredValue, double error)
|
||||
{
|
||||
double trueValue = measuredValue / (1 + error/100);
|
||||
double correction = trueValue - measuredValue;
|
||||
return correction;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the heat coefficient for water
|
||||
/// </summary>
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -11,6 +11,7 @@ namespace Config.Mappings
|
||||
public MeasurementCorrectionMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.RangeIx);
|
||||
Map(x => x.Measurement);
|
||||
Map(x => x.Correction);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Config")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2016 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 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.14.595.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.595.0")]
|
||||
[assembly: AssemblyVersion("2.18.982.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.982.0")]
|
||||
|
||||
+91
-12
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Reflection;
|
||||
@@ -11,7 +11,14 @@ namespace Config
|
||||
{
|
||||
[Description("---")] None,
|
||||
|
||||
[Description("imp.")] pulse,
|
||||
#if LANG_PL
|
||||
[Description("stopień")] degree,
|
||||
#else
|
||||
[Description("degree")] degree,
|
||||
#endif
|
||||
[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
|
||||
@@ -29,7 +36,7 @@ namespace Config
|
||||
[Description("hr")] hour, /// 1 hour = 60 min = 3600 s
|
||||
[Description("ms")] ms, /// 1 ms = 0.001 s
|
||||
|
||||
[Description("°C")] C, /// * degree Celsius
|
||||
[Description("°C")] C, /// * degree Celsius (°C)
|
||||
[Description("°F")] F, /// degree Fahrenheit
|
||||
[Description("K")] K, /// degree Kelvin
|
||||
|
||||
@@ -61,9 +68,28 @@ namespace Config
|
||||
[Description("kWh")] kWh, /// 1 kWh = 3600000 J
|
||||
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
|
||||
|
||||
#if LANG_PL
|
||||
[Description("imp/l")] ppl, /// * 1 pulse/l
|
||||
[Description("imp/dm3")] ppdm3, /// * 1 pulse/dm3
|
||||
[Description("stopień/l")] degpl, /// * 1 degree/l
|
||||
[Description("stopień/dm3")] degpdm3, /// * 1 degree/dm3
|
||||
[Description("l/imp")] lpp, /// * 1 l/pulse
|
||||
[Description("dm3/imp")] dm3pp, /// * 1 dm3/pulse
|
||||
[Description("l/stopień")] lpdeg, /// * 1 l/degree
|
||||
[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
|
||||
#endif
|
||||
///
|
||||
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
|
||||
[Description("kWh/pulse")] kWhpp, /// * 1 kWh/pulse
|
||||
|
||||
Count
|
||||
}
|
||||
@@ -83,6 +109,7 @@ namespace Config
|
||||
[Description("Länge")] Length,
|
||||
[Description("Dichte")] Density,
|
||||
[Description("Energie")] Energy,
|
||||
[Description("Impulse")] Pulses,
|
||||
[Description("Impulse/l")] PulsePerLtr,
|
||||
[Description("Impulse/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -92,7 +119,7 @@ namespace Config
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum und Uhrzeit")] DateTime,
|
||||
#elif LANG_PL
|
||||
[Description("Objętość")] Volume,
|
||||
[Description("Objętość")] Volume,
|
||||
[Description("Przepływ")] Flow,
|
||||
[Description("Masa")] Mass,
|
||||
[Description("Czas")] Time,
|
||||
@@ -103,6 +130,7 @@ namespace Config
|
||||
[Description("Długość")] Length,
|
||||
[Description("Gęstość")] Density,
|
||||
[Description("Energia")] Energy,
|
||||
[Description("Impulsy")] Pulses,
|
||||
[Description("Impulsy/litr")] PulsePerLtr,
|
||||
[Description("Impulsy/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -123,6 +151,7 @@ namespace Config
|
||||
[Description("Délka")] Length,
|
||||
[Description("Hustota")] Density,
|
||||
[Description("Energie")] Energy,
|
||||
[Description("Pulzy")] Pulses,
|
||||
[Description("Pulzy/litr")] PulsePerLtr,
|
||||
[Description("Pulzy/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -131,8 +160,29 @@ namespace Config
|
||||
[Description("Text")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum a čas")] DateTime,
|
||||
#else
|
||||
#elif LANG_IT
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flusso")] Flow,
|
||||
[Description("Massa")] Mass,
|
||||
[Description("Tempo")] Time,
|
||||
[Description("Temperatura")] Temperature,
|
||||
[Description("Pressione")] Pressure,
|
||||
[Description("Umidità")] Humidity,
|
||||
[Description("Errore")] Error,
|
||||
[Description("Lungezza")] Length,
|
||||
[Description("Densità")] Density,
|
||||
[Description("Energia")] Energy,
|
||||
[Description("Impulso")] Pulses,
|
||||
[Description("Impulso/litro")] PulsePerLtr,
|
||||
[Description("Impulso/kWh")] PulsePerKWh,
|
||||
|
||||
/// Quantities without units and conversions
|
||||
[Description("Numero")] Number,
|
||||
[Description("Stringa")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Data e ora")] DateTime,
|
||||
#else
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flow")] Flow,
|
||||
[Description("Mass")] Mass,
|
||||
[Description("Time")] Time,
|
||||
@@ -143,6 +193,7 @@ namespace Config
|
||||
[Description("Length")] Length,
|
||||
[Description("Density")] Density,
|
||||
[Description("Energy")] Energy,
|
||||
[Description("Pulses")] Pulses,
|
||||
[Description("Pulses/liter")] PulsePerLtr,
|
||||
[Description("Pulses/kWh")] PulsePerKWh,
|
||||
|
||||
@@ -152,7 +203,7 @@ namespace Config
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Date and time")] DateTime,
|
||||
#endif
|
||||
Count,
|
||||
Count,
|
||||
}
|
||||
|
||||
public static class Units
|
||||
@@ -177,7 +228,12 @@ namespace Config
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
case Unit.pulse:
|
||||
case Unit.degree:
|
||||
return Config.Quantity.Pulses;
|
||||
|
||||
case Unit.l:
|
||||
case Unit.dm3:
|
||||
case Unit.m3:
|
||||
case Unit.gal_UK:
|
||||
case Unit.gal_US:
|
||||
@@ -239,9 +295,17 @@ namespace Config
|
||||
return Config.Quantity.Energy;
|
||||
|
||||
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 Config.Quantity.PulsePerLtr;
|
||||
|
||||
case Unit.ppkWh:
|
||||
case Unit.kWhpp:
|
||||
return Config.Quantity.PulsePerKWh;
|
||||
|
||||
default:
|
||||
@@ -260,6 +324,7 @@ namespace Config
|
||||
public static bool IsLength(Unit units) { return IsQuantity(units, Config.Quantity.Length); }
|
||||
public static bool IsDensity(Unit units) { return IsQuantity(units, Config.Quantity.Density); }
|
||||
public static bool IsEnergy(Unit units) { return IsQuantity(units, Config.Quantity.Energy); }
|
||||
public static bool IsPulses(Unit units) { return IsQuantity(units, Config.Quantity.Pulses); }
|
||||
public static bool IsPulsePerLtr(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerLtr); }
|
||||
public static bool IsPulsePerKWh(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerKWh); }
|
||||
|
||||
@@ -269,6 +334,7 @@ namespace Config
|
||||
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
|
||||
@@ -290,8 +356,8 @@ namespace Config
|
||||
case Unit.hour: return v / 3600;
|
||||
case Unit.ms: return 1000 * v;
|
||||
|
||||
/// Temperature: internal representation in degree C
|
||||
case Unit.C: return v; /// degree Celsius
|
||||
/// 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
|
||||
|
||||
@@ -326,7 +392,13 @@ namespace Config
|
||||
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
|
||||
|
||||
default: return v;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,6 +407,7 @@ 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
|
||||
@@ -356,8 +429,8 @@ namespace Config
|
||||
case Unit.hour: return 3600 * v;
|
||||
case Unit.ms: return v / 1000;
|
||||
|
||||
/// Temperature: internal representation in degree C
|
||||
case Unit.C: return v; /// degree Celsius
|
||||
/// 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
|
||||
|
||||
@@ -392,7 +465,13 @@ namespace Config
|
||||
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
|
||||
|
||||
default: return v;
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return ((v == 0) ? 0 : 1 / v);
|
||||
|
||||
default: return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
if (sigDigits == 6)
|
||||
{
|
||||
if (value >= 99999.5 || value < -99999.5) return "F0";
|
||||
else if (value >= 9999.95 || value < -9999.95) return "F1";
|
||||
else if (value >= 999.995 || value < -999.995) return "F2";
|
||||
else if (value >= 99.9995 || value < -99.9995) return "F3";
|
||||
else if (value >= 9.99995 || value < -9.99995) return "F4";
|
||||
else if (value >= 0.999995 || value < -0.999995) return "F5";
|
||||
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
|
||||
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
|
||||
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
|
||||
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
|
||||
else return "F10";
|
||||
}
|
||||
else if (sigDigits == 5)
|
||||
{
|
||||
if (value >= 9999.5 || value < -9999.5) return "F0";
|
||||
else if (value >= 999.95 || value < -999.95) return "F1";
|
||||
else if (value >= 99.995 || value < -99.995) return "F2";
|
||||
else if (value >= 9.9995 || value < -9.9995) return "F3";
|
||||
else if (value >= 0.99995 || value < -0.99995) return "F4";
|
||||
else if (value >= 0.099995 || value < -0.099995) return "F5";
|
||||
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
|
||||
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
|
||||
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
|
||||
else return "F9";
|
||||
}
|
||||
else if (sigDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return "F0";
|
||||
else if (value >= 99.95 || value < -99.95) return "F1";
|
||||
else if (value >= 9.995 || value < -9.995) return "F2";
|
||||
else if (value >= 0.9995 || value < -0.9995) return "F3";
|
||||
else if (value >= 0.09995 || value < -0.09995) return "F4";
|
||||
else if (value >= 0.009995 || value < -0.009995) return "F5";
|
||||
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
|
||||
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
|
||||
else return "F8";
|
||||
}
|
||||
else if (sigDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return "F0";
|
||||
else if (value >= 9.95 || value < -9.95) return "F1";
|
||||
else if (value >= 0.995 || value < -0.995) return "F2";
|
||||
else if (value >= 0.0995 || value < -0.0995) return "F3";
|
||||
else if (value >= 0.00995 || value < -0.00995) return "F4";
|
||||
else if (value >= 0.000995 || value < -0.000995) return "F5";
|
||||
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
|
||||
else return "F7";
|
||||
}
|
||||
else if (sigDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return "F0";
|
||||
else if (value >= 0.95 || value < -0.95) return "F1";
|
||||
else if (value >= 0.095 || value < -0.095) return "F2";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F3";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F4";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F5";
|
||||
else return "F6";
|
||||
}
|
||||
else /// if (sigDigits == 1)
|
||||
{
|
||||
if (value >= 0.95 || value < -0.95) return "F0";
|
||||
else if (value >= 0.095 || value < -0.095) return "F1";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F2";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F3";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F4";
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@
|
||||
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TestBenchFramework\TBF.csproj">
|
||||
<ProjectReference Include="..\TBF\TBF.csproj">
|
||||
<Project>{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}</Project>
|
||||
<Name>TBF</Name>
|
||||
</ProjectReference>
|
||||
|
||||
+36
-12
@@ -56,7 +56,10 @@ namespace DeviceTest
|
||||
|
||||
|
||||
static TBF.Boxes.FloatBox floatBox;
|
||||
static Event evnt;
|
||||
static TBF.Boxes.DoubleBox dblBox1;
|
||||
static TBF.Boxes.DoubleBox dblBox2;
|
||||
static TBF.Boxes.DoubleBox dblBox3;
|
||||
static Event evnt;
|
||||
|
||||
|
||||
static DeviceTestDlg()
|
||||
@@ -68,10 +71,10 @@ namespace DeviceTest
|
||||
public DeviceTestDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
compClasses = new List<string>();
|
||||
radioButton0.Checked = true;
|
||||
stopButton.Enabled = false;
|
||||
|
||||
|
||||
compClasses = new List<string>();
|
||||
foreach (var componentFactory in TbfComponents.Factories)
|
||||
{
|
||||
compClasses.Add(componentFactory.ClassName);
|
||||
@@ -657,7 +660,13 @@ namespace DeviceTest
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -681,10 +690,16 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
|
||||
{
|
||||
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -708,10 +723,16 @@ namespace DeviceTest
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
|
||||
{
|
||||
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
|
||||
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
|
||||
@@ -720,11 +741,14 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
|
||||
while (workerThreadRunning)
|
||||
int time = 0;
|
||||
while (workerThreadRunning)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
|
||||
if (workerThreadRunning)
|
||||
StateMachine.Time = ++time;
|
||||
|
||||
if (workerThreadRunning)
|
||||
{
|
||||
foreach (var d in tbfDevices) d.RunDeviceBefore();
|
||||
|
||||
|
||||
@@ -72,10 +72,10 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
/// Configure and start logging
|
||||
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(LocAppDataDir + log4netConfigFName));
|
||||
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Path.Combine(LocAppDataDir, log4netConfigFName)));
|
||||
log = LogManager.GetLogger(typeof(Program));
|
||||
log.Fatal("--------------------------------------------------------------------------------");
|
||||
log.Fatal(string.Format("TBF ver.{0}", Version));
|
||||
log.FatalFormat("DeviceTest ver.{0}", Version);
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents a command APDU
|
||||
/// </summary>
|
||||
public class APDUCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Minimun size of an APDU command in bytes
|
||||
/// </summary>
|
||||
public const int APDU_MIN_LENGTH = 4;
|
||||
|
||||
public byte Class; /// Class byte
|
||||
public byte Ins; /// Instruction byte
|
||||
public byte P1; /// Parameter P1 byte
|
||||
public byte P2; /// Parameter P2 byte
|
||||
public byte[] Data; /// Data to send to the card if any, null if no data to send
|
||||
public byte Le; /// Number of data expected, 0 if none
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="bCla">Class byte</param>
|
||||
/// <param name="bIns">Instruction byte</param>
|
||||
/// <param name="bP1">Parameter P1 byte</param>
|
||||
/// <param name="bP2">Parameter P2 byte</param>
|
||||
/// <param name="baData">Data to send to the card if any, null if no data to send</param>
|
||||
/// <param name="bLe">Number of data expected, 0 if none</param>
|
||||
public APDUCommand(byte bCla, byte bIns, byte bP1, byte bP2, byte[] baData, byte bLe)
|
||||
{
|
||||
this.Class = bCla;
|
||||
this.Ins = bIns;
|
||||
this.P1 = bP1;
|
||||
this.P2 = bP2;
|
||||
this.Data = baData;
|
||||
this.Le = bLe;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update the current APDU with selected parameters
|
||||
/// </summary>
|
||||
/// <param name="apduParam">APDU parameters</param>
|
||||
public void Update(APDUParam apduParam)
|
||||
{
|
||||
if (apduParam.UseData) Data = apduParam.Data;
|
||||
if (apduParam.UseLe) Le = apduParam.Le;
|
||||
if (apduParam.UseP1) P1 = apduParam.P1;
|
||||
if (apduParam.UseP2) P2 = apduParam.P2;
|
||||
if (apduParam.UseChannel) Class += apduParam.Channel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the ToString method to format to a string the APDUCommand object
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
string strData = null;
|
||||
byte bLc = 0;
|
||||
byte bP3 = Le;
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
StringBuilder sData = new StringBuilder(Data.Length * 2);
|
||||
for (int nI = 0; nI < Data.Length; nI++)
|
||||
{
|
||||
sData.AppendFormat("{0:X02}", Data[nI]);
|
||||
}
|
||||
|
||||
strData = "Data=" + sData.ToString();
|
||||
bLc = (byte) Data.Length;
|
||||
bP3 = bLc;
|
||||
}
|
||||
|
||||
//string strApdu = string.Format("Class={0:X02} Ins={1:X02} P1={2:X02} P2={3:X02} Le={4:X02} Lc={5:X02} ",
|
||||
//m_bCla, m_bIns, m_bP1, m_bP2, m_bLe, bLc);
|
||||
StringBuilder strApdu = new StringBuilder();
|
||||
|
||||
strApdu.AppendFormat("Class={0:X02} Ins={1:X02} P1={2:X02} P2={3:X02} P3={4:X02} ",
|
||||
Class, Ins, P1, P2, bP3);
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
strApdu.Append(strData);
|
||||
}
|
||||
|
||||
return strApdu.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is used to update a set of parameters of an APDUCommand object
|
||||
/// </summary>
|
||||
public class APDUParam
|
||||
{
|
||||
byte bClass;
|
||||
byte bChannel;
|
||||
byte bP2;
|
||||
byte bP1;
|
||||
|
||||
byte[] baData;
|
||||
short nLe;
|
||||
|
||||
bool fUseP1;
|
||||
bool fUseP2;
|
||||
bool fChannel;
|
||||
bool fData;
|
||||
bool fClass;
|
||||
bool fLe;
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current instance, all flags are set to false
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
bClass = 0;
|
||||
bChannel = 0;
|
||||
bP2 = 0;
|
||||
bP1 = 0;
|
||||
|
||||
baData = null;
|
||||
nLe = -1;
|
||||
|
||||
fUseP1 = false;
|
||||
fUseP2 = false;
|
||||
fChannel = false;
|
||||
fData = false;
|
||||
fClass = false;
|
||||
fLe = false;
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
|
||||
public APDUParam()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor (used for cloning)
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
public APDUParam(APDUParam param)
|
||||
{
|
||||
// Copy field
|
||||
if (param.baData != null)
|
||||
{
|
||||
param.baData.CopyTo(baData, 0);
|
||||
}
|
||||
|
||||
this.bClass = param.bClass;
|
||||
this.bChannel = param.bChannel;
|
||||
this.bP1 = param.bP1;
|
||||
this.bP2 = param.bP2;
|
||||
this.nLe = param.nLe;
|
||||
|
||||
// Copy flags field
|
||||
this.fChannel = param.fChannel;
|
||||
this.fClass = param.fClass;
|
||||
this.fData = param.fData;
|
||||
this.fLe = param.fLe;
|
||||
this.fUseP1 = param.fUseP1;
|
||||
this.fUseP2 = param.fUseP2;
|
||||
}
|
||||
|
||||
public APDUParam(byte bClass, byte bP1, byte bP2, byte[] baData, short nLe)
|
||||
{
|
||||
this.Class = bClass;
|
||||
this.P1 = bP1;
|
||||
this.P2 = bP2;
|
||||
this.Data = baData;
|
||||
this.Le = (byte)nLe;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Clones the current APDUParam instance
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public APDUParam Clone()
|
||||
{
|
||||
return new APDUParam(this);
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool UseClass { get { return fClass; } }
|
||||
public bool UseChannel { get { return fChannel; } }
|
||||
public bool UseLe { get { return fLe; } }
|
||||
public bool UseData { get { return fData; } }
|
||||
public bool UseP1 { get { return fUseP1; } }
|
||||
public bool UseP2 { get { return fUseP2; } }
|
||||
|
||||
public byte P1
|
||||
{
|
||||
get { return bP1; }
|
||||
set { bP1 = value; fUseP1 = true; }
|
||||
}
|
||||
|
||||
public byte P2
|
||||
{
|
||||
get { return bP2; }
|
||||
set { bP2 = value; fUseP2 = true; }
|
||||
}
|
||||
|
||||
public byte[] Data
|
||||
{
|
||||
get { return baData; }
|
||||
set { baData = value; fData = true; }
|
||||
}
|
||||
|
||||
public byte Le
|
||||
{
|
||||
get { return (byte)nLe; }
|
||||
set { nLe = value; fLe = true; }
|
||||
}
|
||||
|
||||
public byte Channel
|
||||
{
|
||||
get { return bChannel; }
|
||||
set { bChannel = value; fChannel = true; }
|
||||
}
|
||||
|
||||
public byte Class
|
||||
{
|
||||
get { return bClass; }
|
||||
set { bClass = value; fClass = true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the APDU response sent by the card
|
||||
/// </summary>
|
||||
public class APDUResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Status bytes length
|
||||
/// </summary>
|
||||
public const int SW_LENGTH = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Response data. Contains the data sent by the card minus the 2 status bytes (SW1, SW2)
|
||||
/// null if no data were sent by the card
|
||||
/// </summary>
|
||||
public byte[] Data;
|
||||
public byte SW1;
|
||||
public byte SW2;
|
||||
|
||||
/// <summary>
|
||||
/// Status get property
|
||||
/// </summary>
|
||||
public ushort Status
|
||||
{
|
||||
get { return (ushort)(((short)SW1 << 8) + (short)SW2); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor from the byte data sent back by the card
|
||||
/// </summary>
|
||||
/// <param name="baData">Buffer of data from the card</param>
|
||||
public APDUResponse(byte[] baData)
|
||||
{
|
||||
if (baData.Length > SW_LENGTH)
|
||||
{
|
||||
Data = new byte[baData.Length - SW_LENGTH];
|
||||
|
||||
for (int nI = 0; nI < baData.Length - SW_LENGTH; nI++)
|
||||
{
|
||||
this.Data[nI] = baData[nI];
|
||||
}
|
||||
}
|
||||
|
||||
this.SW1 = baData[baData.Length - 2];
|
||||
this.SW2 = baData[baData.Length - 1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the ToString method to format to a string the APDUResponse object
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Data != null)
|
||||
{
|
||||
StringBuilder sData = new StringBuilder(Data.Length * 2);
|
||||
for (int nI = 0; nI < Data.Length; nI++)
|
||||
{
|
||||
sData.AppendFormat("{0:X02}", Data[nI]);
|
||||
}
|
||||
|
||||
return sData.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// 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("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// Values for AttrId of SCardGetAttrib
|
||||
/// </summary>
|
||||
public class SCARD_ATTR_VALUE
|
||||
{
|
||||
private const uint
|
||||
SCARD_CLASS_COMMUNICATIONS = 2,
|
||||
SCARD_CLASS_PROTOCOL = 3,
|
||||
SCARD_CLASS_MECHANICAL = 6,
|
||||
SCARD_CLASS_VENDOR_DEFINED = 7,
|
||||
SCARD_CLASS_IFD_PROTOCOL = 8,
|
||||
SCARD_CLASS_ICC_STATE = 9,
|
||||
SCARD_CLASS_SYSTEM = 0x7fff;
|
||||
|
||||
private static UInt32 SCardAttrValue(UInt32 attrClass, UInt32 val)
|
||||
{
|
||||
return (attrClass << 16) | val;
|
||||
}
|
||||
|
||||
public static UInt32 CHANNEL_ID { get { return SCardAttrValue(SCARD_CLASS_COMMUNICATIONS, 0x0110); } }
|
||||
|
||||
public static UInt32 CHARACTERISTICS { get { return SCardAttrValue(SCARD_CLASS_MECHANICAL, 0x0150); } }
|
||||
|
||||
public static UInt32 CURRENT_PROTOCOL_TYPE { get { return SCardAttrValue(SCARD_CLASS_IFD_PROTOCOL, 0x0201); } }
|
||||
|
||||
public static UInt32 DEVICE_UNIT { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0001); } }
|
||||
public static UInt32 DEVICE_FRIENDLY_NAME { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0003); } }
|
||||
public UInt32 DEVICE_SYSTEM_NAME { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0004); } }
|
||||
|
||||
public static UInt32 ICC_PRESENCE { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0300); } }
|
||||
public static UInt32 ICC_INTERFACE_STATUS { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0301); } }
|
||||
public static UInt32 ATR_STRING { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0303); } }
|
||||
public static UInt32 ICC_TYPE_PER_ATR { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0304); } }
|
||||
|
||||
public static UInt32 PROTOCOL_TYPES { get { return SCardAttrValue(SCARD_CLASS_PROTOCOL, 0x0120); } }
|
||||
|
||||
public static UInt32 VENDOR_NAME { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0100); } }
|
||||
public static UInt32 VENDOR_IFD_TYPE { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0101); } }
|
||||
public static UInt32 VENDOR_IFD_VERSION { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0102); } }
|
||||
public static UInt32 VENDOR_IFD_SERIAL_NO { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0103); } }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstract class that adds a basic event management to the ICard interface.
|
||||
/// </summary>
|
||||
abstract public class CardBase : ICard
|
||||
{
|
||||
protected const uint INFINITE = 0xFFFFFFFF;
|
||||
protected const uint WAIT_TIME = 250;
|
||||
|
||||
protected bool m_bRunCardDetection = true;
|
||||
protected Thread m_thread = null;
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the card insertion
|
||||
/// </summary>
|
||||
public event EventHandler<CardInsertedEventArgs> OnCardInserted = null;
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the card removal
|
||||
/// </summary>
|
||||
public event EventHandler<CardRemovedEventArgs> OnCardRemoved = null;
|
||||
|
||||
~CardBase()
|
||||
{
|
||||
// Stop any eventual card detection thread
|
||||
StopCardEvents();
|
||||
}
|
||||
|
||||
#region Abstract method that implement the ICard interface
|
||||
abstract public string[] ListReaders();
|
||||
abstract public void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols);
|
||||
abstract public void Disconnect(DISCONNECT Disposition);
|
||||
abstract public APDUResponse Transmit(APDUCommand ApduCmd);
|
||||
abstract public void BeginTransaction();
|
||||
abstract public void EndTransaction(DISCONNECT Disposition);
|
||||
abstract public byte[] GetAttribute(UInt32 AttribId);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This method should start a thread that checks for card insertion or removal
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
public void StartCardEvents(string Reader)
|
||||
{
|
||||
if (m_thread == null)
|
||||
{
|
||||
m_bRunCardDetection = true;
|
||||
|
||||
m_thread = new Thread(new ParameterizedThreadStart(RunCardDetection));
|
||||
m_thread.Start(Reader);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the card events thread
|
||||
/// </summary>
|
||||
public void StopCardEvents()
|
||||
{
|
||||
if (m_thread != null)
|
||||
{
|
||||
int
|
||||
nTimeOut = 10,
|
||||
nCount = 0;
|
||||
bool m_bStop = false;
|
||||
m_bRunCardDetection = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (nCount > nTimeOut)
|
||||
{
|
||||
m_thread.Abort();
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_thread.ThreadState == ThreadState.Aborted)
|
||||
m_bStop = true;
|
||||
|
||||
if (m_thread.ThreadState == ThreadState.Stopped)
|
||||
m_bStop = true;
|
||||
|
||||
Thread.Sleep(200);
|
||||
++nCount; // Manage time out
|
||||
}
|
||||
while (!m_bStop);
|
||||
|
||||
m_thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function must implement a card detection mechanism.
|
||||
///
|
||||
/// When card insertion is detected, it must call the method CardInserted()
|
||||
/// When card removal is detected, it must call the method CardRemoved()
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="Reader">Name of the reader to scan for card event</param>
|
||||
abstract protected void RunCardDetection(object Reader);
|
||||
|
||||
#region Event methods
|
||||
|
||||
protected void CardInserted(object sender, CardInsertedEventArgs args)
|
||||
{
|
||||
if (OnCardInserted != null) OnCardInserted(sender, args);
|
||||
}
|
||||
|
||||
protected void CardRemoved(object sender, CardRemovedEventArgs args)
|
||||
{
|
||||
if (OnCardRemoved != null) OnCardRemoved(sender, args);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using SCARDSSPLib;
|
||||
using GemCardExLib;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements the ICard interface using the SCard COM objects from Microsoft and SCardDatabaseEx object
|
||||
/// for the ListReaders function.
|
||||
/// </summary>
|
||||
public class CardCOM : CardBase
|
||||
{
|
||||
private ISCard m_itfCard = null;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public CardCOM()
|
||||
{
|
||||
// Create the SCard object
|
||||
m_itfCard = new CSCardClass();
|
||||
}
|
||||
|
||||
#region ICard Members
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/// LPCTSTR mszGroups,
|
||||
/// LPTSTR mszReaders,
|
||||
/// LPDWORD pcchReaders
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <returns>A string array of the readers</returns>
|
||||
public override string[] ListReaders()
|
||||
{
|
||||
ISCardDatabaseEx itfCardBase = new SCardDatabaseEx();
|
||||
|
||||
return (string[]) itfCardBase.ListReaders();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardConnect(
|
||||
/// IN SCARDCONTEXT hContext,
|
||||
/// IN LPCTSTR szReader,
|
||||
/// IN DWORD dwShareMode,
|
||||
/// IN DWORD dwPreferredProtocols,
|
||||
/// OUT LPSCARDHANDLE phCard,
|
||||
/// OUT LPDWORD pdwActiveProtocol
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
/// <param name="ShareMode"></param>
|
||||
/// <param name="PreferredProtocols"></param>
|
||||
public override void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols)
|
||||
{
|
||||
// Calls AttachReader to connect to the card
|
||||
m_itfCard.AttachByReader(Reader, (SCARD_SHARE_MODES) ShareMode, (SCARD_PROTOCOLS) PreferredProtocols);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardDisconnect(
|
||||
/// IN SCARDHANDLE hCard,
|
||||
/// IN DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition"></param>
|
||||
public override void Disconnect(DISCONNECT Disposition)
|
||||
{
|
||||
// Off the connection with the card
|
||||
m_itfCard.Detach((SCARD_DISPOSITIONS) Disposition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardTransmit(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// LPCSCARD_I0_REQUEST pioSendPci,
|
||||
/// LPCBYTE pbSendBuffer,
|
||||
/// DWORD cbSendLength,
|
||||
/// LPSCARD_IO_REQUEST pioRecvPci,
|
||||
/// LPBYTE pbRecvBuffer,
|
||||
/// LPDWORD pcbRecvLength
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
|
||||
/// <returns>An APDUResponse object with the response from the card</returns>
|
||||
public override APDUResponse Transmit(APDUCommand ApduCmd)
|
||||
{
|
||||
CSCardCmd itfCmd = new CSCardCmdClass();
|
||||
CByteBuffer itfData = new CByteBufferClass();
|
||||
int nLe = ApduCmd.Le;
|
||||
|
||||
if (ApduCmd.Data == null)
|
||||
{
|
||||
itfData.SetSize(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nWrite = 0;
|
||||
|
||||
itfData.SetSize(ApduCmd.Data.Length);
|
||||
itfData.Write(ref ApduCmd.Data[0], ApduCmd.Data.Length, ref nWrite);
|
||||
}
|
||||
|
||||
// Build the APDU command
|
||||
itfCmd.BuildCmd(ApduCmd.Class, ApduCmd.Ins, ApduCmd.P1, ApduCmd.P2, itfData, ref nLe);
|
||||
|
||||
// Send the command
|
||||
m_itfCard.Transaction(ref itfCmd);
|
||||
|
||||
// Analyse the response
|
||||
int nRead = 0;
|
||||
byte[] pbResp = new byte[itfCmd.ApduReplyLength];
|
||||
|
||||
itfCmd.ApduReply.Read(ref pbResp[0], itfCmd.ApduReplyLength, ref nRead);
|
||||
|
||||
return new APDUResponse(pbResp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PSCS function
|
||||
/// LONG SCardBeginTransaction(
|
||||
/// SCARDHANDLE hCard
|
||||
// );
|
||||
/// This function is not supported in the COM implementation
|
||||
/// </summary>
|
||||
public override void BeginTransaction()
|
||||
{
|
||||
throw new NotImplementedException("BeginTransaction is not supported in the COM implementation");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEndTransaction(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// DWORD dwDisposition
|
||||
/// );
|
||||
/// This function is not supported in the COM implementation
|
||||
/// </summary>
|
||||
/// <param name="Disposition">A value from DISCONNECT enum</param>
|
||||
public override void EndTransaction(DISCONNECT Disposition)
|
||||
{
|
||||
throw new NotImplementedException("EndTransaction is not supported in the COM implementation");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of the card
|
||||
/// </summary>
|
||||
/// <param name="AttribId">Identifier for the Attribute to get</param>
|
||||
/// <returns>Attribute content</returns>
|
||||
public override byte[] GetAttribute(UInt32 AttribId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This function must implement a card detection mechanism.
|
||||
///
|
||||
/// When card insertion is detected, it must call the method CardInserted()
|
||||
/// When card removal is detected, it must call the method CardRemoved()
|
||||
///
|
||||
/// </summary>
|
||||
protected override void RunCardDetection(object Reader)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
public class CardInsertedEventArgs : EventArgs
|
||||
{
|
||||
public CardInsertedEventArgs() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,620 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// CARD_STATE enumeration, used by the PC/SC function SCardGetStatusChanged
|
||||
/// </summary>
|
||||
enum CARD_STATE
|
||||
{
|
||||
UNAWARE = 0x00000000,
|
||||
IGNORE = 0x00000001,
|
||||
CHANGED = 0x00000002,
|
||||
UNKNOWN = 0x00000004,
|
||||
UNAVAILABLE = 0x00000008,
|
||||
EMPTY = 0x00000010,
|
||||
PRESENT = 0x00000020,
|
||||
ATRMATCH = 0x00000040,
|
||||
EXCLUSIVE = 0x00000080,
|
||||
INUSE = 0x00000100,
|
||||
MUTE = 0x00000200,
|
||||
UNPOWERED = 0x00000400
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the SCARD_IO_STRUCTURE
|
||||
///
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SCard_IO_Request
|
||||
{
|
||||
public UInt32 m_dwProtocol;
|
||||
public UInt32 m_cbPciLength;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wraps theSCARD_READERSTATE structure of PC/SC
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct SCard_ReaderState
|
||||
{
|
||||
public string m_szReader;
|
||||
public IntPtr m_pvUserData;
|
||||
public UInt32 m_dwCurrentState;
|
||||
public UInt32 m_dwEventState;
|
||||
public UInt32 m_cbAtr;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
|
||||
public byte[] m_rgbAtr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of ICard using native (P/Invoke) interoperability for PC/SC
|
||||
/// </summary>
|
||||
public class CardNative : CardBase
|
||||
{
|
||||
private UInt32 m_hContext = 0;
|
||||
private UInt32 m_hCard = 0;
|
||||
private UInt32 m_nProtocol = (uint) PROTOCOL.T0;
|
||||
private int m_nLastError = 0;
|
||||
|
||||
#region PCSC_FUNCTIONS
|
||||
/// <summary>
|
||||
/// Native SCardGetStatusChanged from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <param name="dwTimeout"></param>
|
||||
/// <param name="rgReaderStates"></param>
|
||||
/// <param name="cReaders"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardGetStatusChange(UInt32 hContext,
|
||||
UInt32 dwTimeout,
|
||||
[In,Out] SCard_ReaderState[] rgReaderStates,
|
||||
UInt32 cReaders);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardListReaders function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <param name="mszGroups"></param>
|
||||
/// <param name="mszReaders"></param>
|
||||
/// <param name="pcchReaders"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardListReaders(UInt32 hContext,
|
||||
[MarshalAs(UnmanagedType.LPTStr)] string mszGroups,
|
||||
IntPtr mszReaders,
|
||||
out UInt32 pcchReaders);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardEstablishContext function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="dwScope"></param>
|
||||
/// <param name="pvReserved1"></param>
|
||||
/// <param name="pvReserved2"></param>
|
||||
/// <param name="phContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardEstablishContext(UInt32 dwScope,
|
||||
IntPtr pvReserved1,
|
||||
IntPtr pvReserved2,
|
||||
IntPtr phContext);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardReleaseContext function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardReleaseContext(UInt32 hContext);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardConnect function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <param name="szReader"></param>
|
||||
/// <param name="dwShareMode"></param>
|
||||
/// <param name="dwPreferredProtocols"></param>
|
||||
/// <param name="phCard"></param>
|
||||
/// <param name="pdwActiveProtocol"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true, CharSet=CharSet.Auto)]
|
||||
internal static extern int SCardConnect(UInt32 hContext,
|
||||
[MarshalAs(UnmanagedType.LPTStr)] string szReader,
|
||||
UInt32 dwShareMode,
|
||||
UInt32 dwPreferredProtocols,
|
||||
IntPtr phCard,
|
||||
IntPtr pdwActiveProtocol);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardDisconnect function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hCard"></param>
|
||||
/// <param name="dwDisposition"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardDisconnect(UInt32 hCard,
|
||||
UInt32 dwDisposition);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardTransmit function from winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hCard"></param>
|
||||
/// <param name="pioSendPci"></param>
|
||||
/// <param name="pbSendBuffer"></param>
|
||||
/// <param name="cbSendLength"></param>
|
||||
/// <param name="pioRecvPci"></param>
|
||||
/// <param name="pbRecvBuffer"></param>
|
||||
/// <param name="pcbRecvLength"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError=true)]
|
||||
internal static extern int SCardTransmit(UInt32 hCard,
|
||||
[In] ref SCard_IO_Request pioSendPci,
|
||||
byte[] pbSendBuffer,
|
||||
UInt32 cbSendLength,
|
||||
IntPtr pioRecvPci,
|
||||
[Out] byte[] pbRecvBuffer,
|
||||
out UInt32 pcbRecvLength
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardBeginTransaction function of winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardBeginTransaction(UInt32 hContext);
|
||||
|
||||
/// <summary>
|
||||
/// Native SCardEndTransaction function of winscard.dll
|
||||
/// </summary>
|
||||
/// <param name="hContext"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardEndTransaction(UInt32 hContext, UInt32 dwDisposition);
|
||||
|
||||
[DllImport("winscard.dll", SetLastError = true)]
|
||||
internal static extern int SCardGetAttrib(UInt32 hCard,
|
||||
UInt32 dwAttribId,
|
||||
[Out] byte[] pbAttr,
|
||||
out UInt32 pcbAttrLen);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public CardNative()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object destruction
|
||||
/// </summary>
|
||||
~CardNative()
|
||||
{
|
||||
Disconnect(DISCONNECT.Unpower);
|
||||
|
||||
ReleaseContext();
|
||||
}
|
||||
|
||||
#region ICard Members
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/// LPCTSTR mszGroups,
|
||||
/// LPTSTR mszReaders,
|
||||
/// LPDWORD pcchReaders
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <returns>A string array of the readers</returns>
|
||||
public override string[] ListReaders()
|
||||
{
|
||||
EstablishContext(SCOPE.User);
|
||||
|
||||
string[] sListReaders = null;
|
||||
UInt32 pchReaders = 0;
|
||||
IntPtr szListReaders = IntPtr.Zero;
|
||||
|
||||
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
|
||||
if (m_nLastError == 0)
|
||||
{
|
||||
szListReaders = Marshal.AllocHGlobal((int) pchReaders);
|
||||
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
|
||||
if (m_nLastError == 0)
|
||||
{
|
||||
char[] caReadersData = new char[pchReaders];
|
||||
int nbReaders = 0;
|
||||
for (int nI = 0; nI < pchReaders; nI++)
|
||||
{
|
||||
caReadersData[nI] = (char) Marshal.ReadByte(szListReaders, nI);
|
||||
|
||||
if (caReadersData[nI] == 0)
|
||||
nbReaders++;
|
||||
}
|
||||
|
||||
// Remove last 0
|
||||
--nbReaders;
|
||||
|
||||
if (nbReaders != 0)
|
||||
{
|
||||
sListReaders = new string[nbReaders];
|
||||
char[] caReader = new char[pchReaders];
|
||||
int nIdx = 0;
|
||||
int nIdy = 0;
|
||||
int nIdz = 0;
|
||||
// Get the nJ string from the multi-string
|
||||
|
||||
while(nIdx < pchReaders - 1)
|
||||
{
|
||||
caReader[nIdy] = caReadersData[nIdx];
|
||||
if (caReader[nIdy] == 0)
|
||||
{
|
||||
sListReaders[nIdz] = new string(caReader, 0, nIdy);
|
||||
++nIdz;
|
||||
nIdy = 0;
|
||||
caReader = new char[pchReaders];
|
||||
}
|
||||
else
|
||||
++nIdy;
|
||||
|
||||
++nIdx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Marshal.FreeHGlobal(szListReaders);
|
||||
}
|
||||
|
||||
ReleaseContext();
|
||||
|
||||
return sListReaders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEstablishContext(
|
||||
/// IN DWORD dwScope,
|
||||
/// IN LPCVOID pvReserved1,
|
||||
/// IN LPCVOID pvReserved2,
|
||||
/// OUT LPSCARDCONTEXT phContext
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Scope"></param>
|
||||
public void EstablishContext(SCOPE Scope)
|
||||
{
|
||||
IntPtr hContext = Marshal.AllocHGlobal(Marshal.SizeOf(m_hContext));
|
||||
|
||||
m_nLastError = SCardEstablishContext((uint) Scope, IntPtr.Zero, IntPtr.Zero, hContext);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardEstablishContext error: " + m_nLastError;
|
||||
|
||||
Marshal.FreeHGlobal(hContext);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
m_hContext = (uint) Marshal.ReadInt32(hContext);
|
||||
|
||||
Marshal.FreeHGlobal(hContext);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardReleaseContext(
|
||||
/// IN SCARDCONTEXT hContext
|
||||
/// );
|
||||
/// </summary>
|
||||
public void ReleaseContext()
|
||||
{
|
||||
if (m_hContext != 0)
|
||||
{
|
||||
m_nLastError = SCardReleaseContext(m_hContext);
|
||||
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardReleaseContext error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
m_hContext = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardConnect(
|
||||
/// IN SCARDCONTEXT hContext,
|
||||
/// IN LPCTSTR szReader,
|
||||
/// IN DWORD dwShareMode,
|
||||
/// IN DWORD dwPreferredProtocols,
|
||||
/// OUT LPSCARDHANDLE phCard,
|
||||
/// OUT LPDWORD pdwActiveProtocol
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
/// <param name="ShareMode"></param>
|
||||
/// <param name="PreferredProtocols"></param>
|
||||
public override void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols)
|
||||
{
|
||||
EstablishContext(SCOPE.User);
|
||||
|
||||
IntPtr hCard = Marshal.AllocHGlobal(Marshal.SizeOf(m_hCard));
|
||||
IntPtr pProtocol = Marshal.AllocHGlobal(Marshal.SizeOf(m_nProtocol));
|
||||
|
||||
m_nLastError = SCardConnect(m_hContext,
|
||||
Reader,
|
||||
(uint) ShareMode,
|
||||
(uint) PreferredProtocols,
|
||||
hCard,
|
||||
pProtocol);
|
||||
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardConnect error: " + m_nLastError;
|
||||
|
||||
Marshal.FreeHGlobal(hCard);
|
||||
Marshal.FreeHGlobal(pProtocol);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
m_hCard = (uint) Marshal.ReadInt32(hCard);
|
||||
m_nProtocol = (uint) Marshal.ReadInt32(pProtocol);
|
||||
|
||||
Marshal.FreeHGlobal(hCard);
|
||||
Marshal.FreeHGlobal(pProtocol);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardDisconnect(
|
||||
/// IN SCARDHANDLE hCard,
|
||||
/// IN DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition"></param>
|
||||
public override void Disconnect(DISCONNECT Disposition)
|
||||
{
|
||||
if (m_hCard != 0)
|
||||
{
|
||||
m_nLastError = SCardDisconnect(m_hCard, (uint) Disposition);
|
||||
m_hCard = 0;
|
||||
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardDisconnect error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
ReleaseContext();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardTransmit(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// LPCSCARD_I0_REQUEST pioSendPci,
|
||||
/// LPCBYTE pbSendBuffer,
|
||||
/// DWORD cbSendLength,
|
||||
/// LPSCARD_IO_REQUEST pioRecvPci,
|
||||
/// LPBYTE pbRecvBuffer,
|
||||
/// LPDWORD pcbRecvLength
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
|
||||
/// <returns>An APDUResponse object with the response from the card</returns>
|
||||
public override APDUResponse Transmit(APDUCommand ApduCmd)
|
||||
{
|
||||
uint RecvLength = (uint) (ApduCmd.Le + APDUResponse.SW_LENGTH);
|
||||
byte[] ApduBuffer = null;
|
||||
byte[] ApduResponse = new byte[ApduCmd.Le + APDUResponse.SW_LENGTH];
|
||||
SCard_IO_Request ioRequest = new SCard_IO_Request();
|
||||
ioRequest.m_dwProtocol = m_nProtocol;
|
||||
ioRequest.m_cbPciLength = 8;
|
||||
|
||||
// Build the command APDU
|
||||
if (ApduCmd.Data == null)
|
||||
{
|
||||
ApduBuffer = new byte[APDUCommand.APDU_MIN_LENGTH + ((ApduCmd.Le != 0) ? 1 : 0)];
|
||||
|
||||
if (ApduCmd.Le != 0)
|
||||
ApduBuffer[4] = (byte) ApduCmd.Le;
|
||||
}
|
||||
else
|
||||
{
|
||||
ApduBuffer = new byte[APDUCommand.APDU_MIN_LENGTH + 1 + ApduCmd.Data.Length];
|
||||
|
||||
for (int nI = 0; nI < ApduCmd.Data.Length; nI++)
|
||||
ApduBuffer[APDUCommand.APDU_MIN_LENGTH + 1 + nI] = ApduCmd.Data[nI];
|
||||
|
||||
ApduBuffer[APDUCommand.APDU_MIN_LENGTH] = (byte) ApduCmd.Data.Length;
|
||||
}
|
||||
|
||||
ApduBuffer[0] = ApduCmd.Class;
|
||||
ApduBuffer[1] = ApduCmd.Ins;
|
||||
ApduBuffer[2] = ApduCmd.P1;
|
||||
ApduBuffer[3] = ApduCmd.P2;
|
||||
|
||||
m_nLastError = SCardTransmit(m_hCard, ref ioRequest, ApduBuffer, (uint) ApduBuffer.Length, IntPtr.Zero, ApduResponse, out RecvLength);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardTransmit error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
byte[] ApduData = new byte[RecvLength];
|
||||
|
||||
for (int nI = 0; nI < RecvLength; nI++)
|
||||
ApduData[nI] = ApduResponse[nI];
|
||||
|
||||
return new APDUResponse(ApduData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PSCS function
|
||||
/// LONG SCardBeginTransaction(
|
||||
/// SCARDHANDLE hCard
|
||||
// );
|
||||
/// </summary>
|
||||
public override void BeginTransaction()
|
||||
{
|
||||
if (m_hCard != 0)
|
||||
{
|
||||
m_nLastError = SCardBeginTransaction(m_hCard);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardBeginTransaction error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEndTransaction(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition">A value from DISCONNECT enum</param>
|
||||
public override void EndTransaction(DISCONNECT Disposition)
|
||||
{
|
||||
if (m_hCard != 0)
|
||||
{
|
||||
m_nLastError = SCardEndTransaction(m_hCard, (UInt32)Disposition);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardEndTransaction error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of the card
|
||||
/// </summary>
|
||||
/// <param name="AttribId">Identifier for the Attribute to get</param>
|
||||
/// <returns>Attribute content</returns>
|
||||
public override byte[] GetAttribute(UInt32 AttribId)
|
||||
{
|
||||
byte[] attr = null;
|
||||
UInt32 attrLen = 0;
|
||||
|
||||
m_nLastError = SCardGetAttrib(m_hCard, AttribId, attr, out attrLen);
|
||||
if (m_nLastError == 0)
|
||||
{
|
||||
if (attrLen != 0)
|
||||
{
|
||||
attr = new byte[attrLen];
|
||||
m_nLastError = SCardGetAttrib(m_hCard, AttribId, attr, out attrLen);
|
||||
if (m_nLastError != 0)
|
||||
{
|
||||
string msg = "SCardGetAttr error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "SCardGetAttr error: " + m_nLastError;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
return attr;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This function must implement a card detection mechanism.
|
||||
///
|
||||
/// When card insertion is detected, it must call the method CardInserted()
|
||||
/// When card removal is detected, it must call the method CardRemoved()
|
||||
///
|
||||
/// </summary>
|
||||
protected override void RunCardDetection(object Reader)
|
||||
{
|
||||
bool bFirstLoop = true;
|
||||
UInt32 hContext = 0; // Local context
|
||||
IntPtr phContext;
|
||||
|
||||
phContext = Marshal.AllocHGlobal(Marshal.SizeOf(hContext));
|
||||
|
||||
if (SCardEstablishContext((uint) SCOPE.User, IntPtr.Zero, IntPtr.Zero, phContext) == 0)
|
||||
{
|
||||
hContext = (uint)Marshal.ReadInt32(phContext);
|
||||
Marshal.FreeHGlobal(phContext);
|
||||
|
||||
UInt32 nbReaders = 1;
|
||||
SCard_ReaderState[] readerState = new SCard_ReaderState[nbReaders];
|
||||
|
||||
readerState[0].m_dwCurrentState = (UInt32) CARD_STATE.UNAWARE;
|
||||
readerState[0].m_szReader = (string)Reader;
|
||||
|
||||
UInt32 eventState;
|
||||
UInt32 currentState = readerState[0].m_dwCurrentState;
|
||||
|
||||
// Card detection loop
|
||||
do
|
||||
{
|
||||
if (SCardGetStatusChange(hContext, WAIT_TIME
|
||||
, readerState, nbReaders) == 0)
|
||||
{
|
||||
eventState = readerState[0].m_dwEventState;
|
||||
currentState = readerState[0].m_dwCurrentState;
|
||||
|
||||
// Check state
|
||||
if (((eventState & (uint) CARD_STATE.CHANGED) == (uint) CARD_STATE.CHANGED) && !bFirstLoop)
|
||||
{
|
||||
// State has changed
|
||||
if ((eventState & (uint) CARD_STATE.EMPTY) == (uint) CARD_STATE.EMPTY)
|
||||
{
|
||||
// There is no card, card has been removed -> Fire CardRemoved event
|
||||
CardRemoved(this, new CardRemovedEventArgs());
|
||||
}
|
||||
|
||||
if (((eventState & (uint)CARD_STATE.PRESENT) == (uint)CARD_STATE.PRESENT) &&
|
||||
((eventState & (uint) CARD_STATE.PRESENT) != (currentState & (uint) CARD_STATE.PRESENT)))
|
||||
{
|
||||
// There is a card in the reader -> Fire CardInserted event
|
||||
CardInserted(this, new CardInsertedEventArgs());
|
||||
}
|
||||
|
||||
if ((eventState & (uint) CARD_STATE.ATRMATCH) == (uint) CARD_STATE.ATRMATCH)
|
||||
{
|
||||
// There is a card in the reader and it matches the ATR we were expecting-> Fire CardInserted event
|
||||
CardInserted(this, new CardInsertedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
// The current stateis now the event state
|
||||
readerState[0].m_dwCurrentState = eventState;
|
||||
|
||||
bFirstLoop = false;
|
||||
}
|
||||
|
||||
Thread.Sleep(100);
|
||||
|
||||
if (m_bRunCardDetection == false)
|
||||
break;
|
||||
}
|
||||
while (true); // Exit on request
|
||||
}
|
||||
else
|
||||
{
|
||||
Marshal.FreeHGlobal(phContext);
|
||||
throw new Exception("PC/SC error");
|
||||
}
|
||||
|
||||
SCardReleaseContext(hContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
public class CardRemovedEventArgs : EventArgs
|
||||
{
|
||||
public CardRemovedEventArgs() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>GemCard</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>GemCard</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="APDUCommand.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="APDUParam.cs" />
|
||||
<Compile Include="APDUResponse.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="CardBase.cs" />
|
||||
<Compile Include="CardInsertedEventArgs.cs" />
|
||||
<Compile Include="CardNative.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CardRemovedEventArgs.cs" />
|
||||
<Compile Include="ICard.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SmartCardException.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastOpenVersion>8.0.50215</LastOpenVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ReferencePath>
|
||||
</ReferencePath>
|
||||
<CopyProjectDestinationFolder>
|
||||
</CopyProjectDestinationFolder>
|
||||
<CopyProjectUncPath>
|
||||
</CopyProjectUncPath>
|
||||
<CopyProjectOption>0</CopyProjectOption>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectTrust>0</ProjectTrust>
|
||||
<PublishUrlHistory />
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>true</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>false</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<StartWithIE>true</StartWithIE>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,149 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface gives access to the basic card functions. It must be implemented by a class.
|
||||
/// </summary>
|
||||
public interface ICard
|
||||
{
|
||||
/// <summary>
|
||||
/// Wraps the PCSC funciton
|
||||
/// LONG SCardListReaders(SCARDCONTEXT hContext,
|
||||
/// LPCTSTR mszGroups,
|
||||
/// LPTSTR mszReaders,
|
||||
/// LPDWORD pcchReaders
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <returns>A string array of the readers</returns>
|
||||
string[] ListReaders();
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardConnect(
|
||||
/// IN SCARDCONTEXT hContext,
|
||||
/// IN LPCTSTR szReader,
|
||||
/// IN DWORD dwShareMode,
|
||||
/// IN DWORD dwPreferredProtocols,
|
||||
/// OUT LPSCARDHANDLE phCard,
|
||||
/// OUT LPDWORD pdwActiveProtocol
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Reader"></param>
|
||||
/// <param name="ShareMode"></param>
|
||||
/// <param name="PreferredProtocols"></param>
|
||||
void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardDisconnect(
|
||||
/// IN SCARDHANDLE hCard,
|
||||
/// IN DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="Disposition"></param>
|
||||
void Disconnect(DISCONNECT Disposition);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardTransmit(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// LPCSCARD_I0_REQUEST pioSendPci,
|
||||
/// LPCBYTE pbSendBuffer,
|
||||
/// DWORD cbSendLength,
|
||||
/// LPSCARD_IO_REQUEST pioRecvPci,
|
||||
/// LPBYTE pbRecvBuffer,
|
||||
/// LPDWORD pcbRecvLength
|
||||
/// );
|
||||
/// </summary>
|
||||
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
|
||||
/// <returns>An APDUResponse object with the response from the card</returns>
|
||||
APDUResponse Transmit(APDUCommand ApduCmd);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PSCS function
|
||||
/// LONG SCardBeginTransaction(
|
||||
/// SCARDHANDLE hCard
|
||||
// );
|
||||
/// </summary>
|
||||
void BeginTransaction();
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the PCSC function
|
||||
/// LONG SCardEndTransaction(
|
||||
/// SCARDHANDLE hCard,
|
||||
/// DWORD dwDisposition
|
||||
/// );
|
||||
/// </summary>
|
||||
void EndTransaction(DISCONNECT Disposition);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of the card
|
||||
/// </summary>
|
||||
/// <param name="AttribId">Identifier for the Attribute to get</param>
|
||||
/// <returns>Attribute content</returns>
|
||||
byte[] GetAttribute(UInt32 AttribId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SCOPE context
|
||||
/// </summary>
|
||||
public enum SCOPE
|
||||
{
|
||||
/// <summary>
|
||||
/// The context is a user context, and any database operations are performed within the
|
||||
/// domain of the user.
|
||||
/// </summary>
|
||||
User,
|
||||
|
||||
/// <summary>
|
||||
/// The context is that of the current terminal, and any database operations are performed
|
||||
/// within the domain of that terminal. (The calling application must have appropriate
|
||||
/// access permissions for any database actions.)
|
||||
/// </summary>
|
||||
Terminal,
|
||||
|
||||
/// <summary>
|
||||
/// The context is the system context, and any database operations are performed within the
|
||||
/// domain of the system. (The calling application must have appropriate access
|
||||
/// permissions for any database actions.)
|
||||
/// </summary>
|
||||
System
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SHARE mode enumeration
|
||||
/// </summary>
|
||||
public enum SHARE
|
||||
{
|
||||
Exclusive = 1, /// This app. is not willing to share this card with other applications.
|
||||
Shared, /// This app. is willing to share this card with other applications.
|
||||
Direct, /// This app. demands direct control of the reader, so it is not available to other applications.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PROTOCOL enumeration
|
||||
/// </summary>
|
||||
public enum PROTOCOL
|
||||
{
|
||||
Undefined = 0x00000000, /// There is no active protocol.
|
||||
T0 = 0x00000001, /// T=0 is the active protocol.
|
||||
T1 = 0x00000002, /// T=1 is the active protocol.
|
||||
T0orT1 = T0 | T1, /// T=1 or T=0 can be the active protocol
|
||||
Raw = 0x00010000, /// Raw is the active protocol.
|
||||
Default = unchecked ((int) 0x80000000), /// Use implicit PTS.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// DISCONNECT action enumeration
|
||||
/// </summary>
|
||||
public enum DISCONNECT
|
||||
{
|
||||
Leave, /// Don't do anything special on close
|
||||
Reset, /// Reset the card on close
|
||||
Unpower, /// Power down the card on close
|
||||
Eject, /// Eject(!) the card on close
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
namespace GemCard
|
||||
{
|
||||
/// <summary>
|
||||
/// Smart card exceptions
|
||||
/// </summary>
|
||||
public class SmartCardException : Exception
|
||||
{
|
||||
|
||||
public SmartCardException() : base("Smart card exception")
|
||||
{
|
||||
}
|
||||
|
||||
public SmartCardException(string Message) : base(Message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ApduCommandException : Exception
|
||||
{
|
||||
public const string
|
||||
NotValidDocument = "The file is not a valid APDU command document",
|
||||
NoSuchCommand = "No such APDU command in the document",
|
||||
ParamLeFormat = "Le parameter format is not correct",
|
||||
ParamP3Format = "P3 parameter format is not correct",
|
||||
NoSuchSequence = "No such APDU sequence in the document",
|
||||
MissingApduOrCommand = "An Apdu or a Sequence is missing in this Sequence";
|
||||
|
||||
public ApduCommandException() : base("APDU command exception")
|
||||
{
|
||||
}
|
||||
|
||||
public ApduCommandException(string Message) : base(Message)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
|
||||
|
||||
/* Copyright (c) 2008-2014 DI Zimmermann Stephan (stefan.zimmermann@tele2.at)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
namespace GraphLib
|
||||
{
|
||||
public class BackBuffer
|
||||
{
|
||||
private Graphics graphics;
|
||||
private Bitmap memoryBitmap;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
public BackBuffer()
|
||||
{
|
||||
width = 0;
|
||||
height = 0;
|
||||
}
|
||||
|
||||
public bool Init(Graphics g, int width, int height)
|
||||
{
|
||||
if (memoryBitmap != null)
|
||||
{
|
||||
memoryBitmap.Dispose();
|
||||
memoryBitmap = null;
|
||||
}
|
||||
|
||||
if (graphics != null)
|
||||
{
|
||||
graphics.Dispose();
|
||||
graphics = null;
|
||||
}
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return false;
|
||||
|
||||
if ((width != this.width) || (height != this.height) || graphics == null)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
memoryBitmap = new Bitmap(width, height);
|
||||
graphics = Graphics.FromImage(memoryBitmap);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Render(Graphics g)
|
||||
{
|
||||
if (memoryBitmap != null)
|
||||
{
|
||||
g.DrawImage(memoryBitmap,
|
||||
new Rectangle(0, 0, width, height),
|
||||
0, 0, width, height,
|
||||
GraphicsUnit.Pixel);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanDoubleBuffer() { return graphics != null; }
|
||||
|
||||
public Graphics Graphics { get { return graphics; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
/* Copyright (c) 2008-2014 DI Zimmermann Stephan (stefan.zimmermann@tele2.at)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace GraphLib
|
||||
{
|
||||
public class DataSource
|
||||
{
|
||||
public delegate String OnDrawXAxisLabelEvent(DataSource src, int idx);
|
||||
public delegate String OnDrawYAxisLabelEvent(DataSource src, float value);
|
||||
|
||||
public OnDrawXAxisLabelEvent OnRenderXAxisLabel = null;
|
||||
public OnDrawYAxisLabelEvent OnRenderYAxisLabel = null;
|
||||
|
||||
private PointF[] samples = null;
|
||||
private int length = 0;
|
||||
|
||||
private String name = String.Empty;
|
||||
private int downSample = 1;
|
||||
private Color color = Color.Black;
|
||||
|
||||
public float VisibleDataRange_X = 0;
|
||||
public float DY = 0;
|
||||
public float YD0 = -200;
|
||||
public float YD1 = 200;
|
||||
public float Cur_YD0 = -200;
|
||||
public float Cur_YD1 = 200;
|
||||
|
||||
public float grid_distance_y = 200; // grid distance in units ( draw a horizontal line every 200 units )
|
||||
|
||||
public float off_Y = 0;
|
||||
public float grid_off_y = 0;
|
||||
|
||||
public bool yFlip = true;
|
||||
|
||||
public bool Active = true;
|
||||
|
||||
public float XAutoScaleOffset = 100;
|
||||
|
||||
public float CurGraphHeight = 1.0f;
|
||||
|
||||
public float CurGraphWidth = 1.0f;
|
||||
|
||||
private bool autoScaleY = false;
|
||||
private bool autoScaleX = false;
|
||||
|
||||
|
||||
public bool AutoScaleY
|
||||
{
|
||||
get { return autoScaleY; }
|
||||
set { autoScaleY = value; }
|
||||
}
|
||||
|
||||
public bool AutoScaleX
|
||||
{
|
||||
get { return autoScaleX; }
|
||||
set { autoScaleX = value; }
|
||||
}
|
||||
|
||||
public PointF[] Samples
|
||||
{
|
||||
get { return samples; }
|
||||
set
|
||||
{
|
||||
samples = value;
|
||||
length = samples.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public float XMin
|
||||
{
|
||||
get
|
||||
{
|
||||
float x_min = float.MaxValue;
|
||||
if (samples != null && samples.Length > 0)
|
||||
{
|
||||
foreach (PointF p in samples) if (p.X < x_min) x_min=p.X;
|
||||
}
|
||||
return x_min;
|
||||
}
|
||||
}
|
||||
|
||||
public float XMax
|
||||
{
|
||||
get
|
||||
{
|
||||
float x_max = float.MinValue;
|
||||
if (samples != null && samples.Length > 0)
|
||||
{
|
||||
foreach (PointF p in samples) if (p.X > x_max) x_max = p.X;
|
||||
}
|
||||
return x_max;
|
||||
}
|
||||
}
|
||||
|
||||
public float YMin
|
||||
{
|
||||
get
|
||||
{
|
||||
float y_min = float.MaxValue;
|
||||
if (samples != null && samples.Length > 0)
|
||||
{
|
||||
foreach (PointF p in samples) if (p.Y < y_min) y_min = p.Y;
|
||||
}
|
||||
return y_min;
|
||||
}
|
||||
}
|
||||
|
||||
public float YMax
|
||||
{
|
||||
get
|
||||
{
|
||||
float y_max = float.MinValue;
|
||||
if (samples.Length > 0)
|
||||
{
|
||||
foreach (PointF p in samples) if (p.Y > y_max) y_max = p.Y;
|
||||
}
|
||||
return y_max;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDisplayRangeY(float y_start, float y_end)
|
||||
{
|
||||
YD0 = y_start;
|
||||
YD1 = y_end;
|
||||
}
|
||||
|
||||
public void SetGridDistanceY(float grid_dist_y_units)
|
||||
{
|
||||
grid_distance_y = grid_dist_y_units;
|
||||
}
|
||||
|
||||
public void SetGridOriginY(float off_y)
|
||||
{
|
||||
grid_off_y = off_y;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Load Samples from a file. Returns loaded points count.
|
||||
/// </summary>
|
||||
/// <param name="pathName">File pathname</param>
|
||||
/// <returns>Loaded points count</returns>
|
||||
public int LoadSamples(string pathName, out float yMin, out float yMax)
|
||||
{
|
||||
yMin = float.MaxValue;
|
||||
yMax = float.MinValue;
|
||||
try
|
||||
{
|
||||
Int64 size = new FileInfo(pathName).Length;
|
||||
if ((size % 8) != 0) return 0;
|
||||
int samplesCount = (int)(size / 8L) - 1;
|
||||
if (samplesCount <= 0) return 0;
|
||||
|
||||
PointF[] newSamples = new PointF[samplesCount];
|
||||
using (BinaryReader reader = new BinaryReader(File.Open(pathName, FileMode.Open)))
|
||||
{
|
||||
for (int i = 0; i < samplesCount; i++)
|
||||
{
|
||||
newSamples[i].X = reader.ReadSingle();
|
||||
newSamples[i].Y = reader.ReadSingle();
|
||||
}
|
||||
yMin = reader.ReadSingle();
|
||||
yMax = reader.ReadSingle();
|
||||
}
|
||||
|
||||
Samples = newSamples;
|
||||
return samplesCount;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Category("Properties")] // Take this out, and you will soon have problems with serialization;
|
||||
[DefaultValue(typeof(string), "")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public String Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; }
|
||||
}
|
||||
|
||||
[Category("Properties")] // Take this out, and you will soon have problems with serialization;
|
||||
[DefaultValue(typeof(Color), "")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public Color GraphColor
|
||||
{
|
||||
get { return color; }
|
||||
set { color = value; }
|
||||
}
|
||||
|
||||
[Category("Properties")] // Take this out, and you will soon have problems with serialization;
|
||||
[DefaultValue(typeof(int), "0")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public int Length
|
||||
{
|
||||
get { return length; }
|
||||
set
|
||||
{
|
||||
length = value;
|
||||
if (length != 0)
|
||||
{
|
||||
samples = new PointF[length];
|
||||
}
|
||||
else
|
||||
{
|
||||
// length is 0
|
||||
if (samples != null)
|
||||
{
|
||||
samples = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Properties")] // Take this out, and you will soon have problems with serialization;
|
||||
[DefaultValue(typeof(int), "1")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public int Downsampling
|
||||
{
|
||||
get { return downSample; }
|
||||
set { downSample = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||
<AssemblyName>GraphLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
</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.Data" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PlotterGraphPaneEx.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PlotterGraphPaneEx.Designer.cs">
|
||||
<DependentUpon>PlotterGraphPaneEx.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PlotterDisplayEx.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PlotterDisplayEx.designer.cs">
|
||||
<DependentUpon>PlotterDisplayEx.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BackBuffer.cs" />
|
||||
<Compile Include="PlotterGraphSelectCurvesForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PlotterGraphSelectCurvesForm.Designer.cs">
|
||||
<DependentUpon>PlotterGraphSelectCurvesForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataSource.cs" />
|
||||
<Compile Include="PrintPreviewForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PrintPreviewForm.Designer.cs">
|
||||
<DependentUpon>PrintPreviewForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="PlotterGraphPaneEx.resx">
|
||||
<DependentUpon>PlotterGraphPaneEx.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PlotterDisplayEx.resx">
|
||||
<DependentUpon>PlotterDisplayEx.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PlotterGraphSelectCurvesForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>PlotterGraphSelectCurvesForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PrintPreviewForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>PrintPreviewForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\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>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphLib", "GraphLib.csproj", "{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,298 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
|
||||
/* Copyright (c) 2008-2014 DI Zimmermann Stephan (stefan.zimmermann@tele2.at)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
namespace GraphLib
|
||||
{
|
||||
public partial class PlotterDisplayEx : UserControl
|
||||
{
|
||||
#region MEMBERS
|
||||
|
||||
delegate void InvokeVoidFuncDelegate();
|
||||
|
||||
PlotterGraphSelectCurvesForm GraphPropertiesForm = null;
|
||||
PrintPreviewForm printPreviewForm = null;
|
||||
|
||||
private bool paused = false;
|
||||
private bool isRunning = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region CONSTRUCTOR
|
||||
|
||||
public PlotterDisplayEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
isRunning = false;
|
||||
}
|
||||
|
||||
void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
{
|
||||
String text = e.ClickedItem.Text;
|
||||
foreach (DataSource s in gPane.Sources)
|
||||
{
|
||||
if (s.Name == text)
|
||||
{
|
||||
s.Active ^= true;
|
||||
gPane.Invalidate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PROPERTIES
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Editor(typeof(System.ComponentModel.Design.CollectionEditor),
|
||||
typeof(System.Drawing.Design.UITypeEditor))]
|
||||
public IList<DataSource> DataSources
|
||||
{
|
||||
get { return gPane.Sources; }
|
||||
}
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Editor(typeof(System.ComponentModel.Design.CollectionEditor),
|
||||
typeof(System.Drawing.Design.UITypeEditor))]
|
||||
public PlotterGraphPaneEx.LayoutMode PanelLayout
|
||||
{
|
||||
get { return gPane.layout; }
|
||||
set { gPane.layout = value; }
|
||||
}
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Editor(typeof(System.ComponentModel.Design.CollectionEditor),
|
||||
typeof(System.Drawing.Design.UITypeEditor))]
|
||||
public SmoothingMode Smoothing
|
||||
{
|
||||
get { return gPane.smoothing; }
|
||||
set { gPane.smoothing = value; }
|
||||
}
|
||||
|
||||
[Category("Playback")]
|
||||
[DefaultValue(typeof(bool), "true")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public bool ShowMovingGrid
|
||||
{
|
||||
get { return gPane.hasMovingGrid; }
|
||||
set { gPane.hasMovingGrid = value; }
|
||||
}
|
||||
|
||||
|
||||
[Category("Properties")]
|
||||
[DefaultValue(typeof(Color), "")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public Color BackgroundColorTop
|
||||
{
|
||||
get { return gPane.BgndColorTop; }
|
||||
set { gPane.BgndColorTop = value; }
|
||||
}
|
||||
|
||||
[Category("Properties")]
|
||||
[DefaultValue(typeof(Color), "")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public Color BackgroundColorBot
|
||||
{
|
||||
get { return gPane.BgndColorBot; }
|
||||
set { gPane.BgndColorBot = value; }
|
||||
}
|
||||
|
||||
[Category("Properties")]
|
||||
[DefaultValue(typeof(Color), "")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public Color DashedGridColor
|
||||
{
|
||||
get { return gPane.MinorGridColor; }
|
||||
set { gPane.MinorGridColor = value; }
|
||||
}
|
||||
|
||||
[Category("Properties")]
|
||||
[DefaultValue(typeof(Color), "")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public Color SolidGridColor
|
||||
{
|
||||
get { return gPane.MajorGridColor; }
|
||||
set { gPane.MajorGridColor = value; }
|
||||
}
|
||||
|
||||
|
||||
public bool DoubleBuffering
|
||||
{
|
||||
get { return gPane.useDoubleBuffer; }
|
||||
set { gPane.useDoubleBuffer = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
public void SetDisplayRangeX(float x_start, float x_end )
|
||||
{
|
||||
gPane.XD0 = x_start;
|
||||
gPane.XD1 = x_end;
|
||||
gPane.CurXD0 = gPane.XD0;
|
||||
gPane.CurXD1 = gPane.XD1;
|
||||
}
|
||||
|
||||
public void SetGridDistanceX(float grid_dist_x_samples)
|
||||
{
|
||||
gPane.grid_distance_x = grid_dist_x_samples;
|
||||
}
|
||||
|
||||
public void SetGridOriginX(float off_x)
|
||||
{
|
||||
gPane.grid_off_x = off_x;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region PRIVATE METHODS
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
paused = true;
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void SetPlayPanelVisible()
|
||||
{
|
||||
panel1.Visible = true;
|
||||
tb1.Buttons[0].Visible = true;
|
||||
tb1.Buttons[1].Visible = true;
|
||||
}
|
||||
|
||||
private void SetPlayPanelInvisible()
|
||||
{
|
||||
panel1.Visible = false;
|
||||
tb1.Buttons[0].Visible = false;
|
||||
tb1.Buttons[1].Visible = false;
|
||||
|
||||
}
|
||||
|
||||
private void UpdateControl()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool AllAutoscaled = true;
|
||||
|
||||
foreach (DataSource s in gPane.Sources)
|
||||
{
|
||||
AllAutoscaled &= s.AutoScaleX;
|
||||
}
|
||||
|
||||
|
||||
if (AllAutoscaled == true)
|
||||
{
|
||||
if (panel1.Visible == true)
|
||||
{
|
||||
this.Invoke(new MethodInvoker(SetPlayPanelInvisible));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (panel1.Visible == false)
|
||||
{
|
||||
this.Invoke(new MethodInvoker(SetPlayPanelVisible));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateScrollBar()
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new MethodInvoker(UpdateScrollBar));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gPane.Sources.Count > 0)
|
||||
{
|
||||
if (gPane.starting_idx > gPane.Sources[0].Length)
|
||||
{
|
||||
hScrollBar1.Value = 10000;
|
||||
}
|
||||
else if (gPane.starting_idx >= 0)
|
||||
{
|
||||
hScrollBar1.Value = 10000 * (int)gPane.starting_idx / gPane.Sources[0].Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
hScrollBar1.Value = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hScrollBar1.Value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnScrollbarScroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
if (gPane.Sources.Count > 0)
|
||||
{
|
||||
int val = hScrollBar1.Value;
|
||||
|
||||
int maxLen = 0;
|
||||
foreach (var s in DataSources)
|
||||
{
|
||||
if (s.Length > maxLen) maxLen = s.Length;
|
||||
}
|
||||
|
||||
gPane.starting_idx = (int)(maxLen * (float)val / 10000.0f);
|
||||
gPane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void selectGraphsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GraphPropertiesForm == null)
|
||||
{
|
||||
GraphPropertiesForm = new PlotterGraphSelectCurvesForm();
|
||||
}
|
||||
|
||||
GraphPropertiesForm.GraphPanel = this.gPane;
|
||||
GraphPropertiesForm.Show();
|
||||
// GraphPropertiesForm.BringToFront();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+200
@@ -0,0 +1,200 @@
|
||||
namespace GraphLib
|
||||
{
|
||||
partial class PlotterDisplayEx
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlotterDisplayEx));
|
||||
this.tb1 = new System.Windows.Forms.ToolBar();
|
||||
this.tbbSave = new System.Windows.Forms.ToolBarButton();
|
||||
this.tbbOpen = new System.Windows.Forms.ToolBarButton();
|
||||
this.imgList1 = new System.Windows.Forms.ImageList(this.components);
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.lb_Position = new System.Windows.Forms.Label();
|
||||
this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
|
||||
this.gPane = new GraphLib.PlotterGraphPaneEx();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.selectGraphsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tb1
|
||||
//
|
||||
this.tb1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
|
||||
this.tb1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
|
||||
this.tbbSave,
|
||||
this.tbbOpen});
|
||||
this.tb1.ButtonSize = new System.Drawing.Size(16, 16);
|
||||
this.tb1.Divider = false;
|
||||
this.tb1.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.tb1.DropDownArrows = true;
|
||||
this.tb1.ImageList = this.imgList1;
|
||||
this.tb1.Location = new System.Drawing.Point(11, 5);
|
||||
this.tb1.Name = "tb1";
|
||||
this.tb1.ShowToolTips = true;
|
||||
this.tb1.Size = new System.Drawing.Size(80, 26);
|
||||
this.tb1.TabIndex = 1;
|
||||
this.tb1.Visible = false;
|
||||
//
|
||||
// tbbSave
|
||||
//
|
||||
this.tbbSave.ImageIndex = 0;
|
||||
this.tbbSave.Name = "tbbSave";
|
||||
this.tbbSave.Tag = "play";
|
||||
//
|
||||
// tbbOpen
|
||||
//
|
||||
this.tbbOpen.ImageIndex = 1;
|
||||
this.tbbOpen.Name = "tbbOpen";
|
||||
this.tbbOpen.Tag = "stop";
|
||||
//
|
||||
// imgList1
|
||||
//
|
||||
this.imgList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgList1.ImageStream")));
|
||||
this.imgList1.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imgList1.Images.SetKeyName(0, "media-playback-start.png");
|
||||
this.imgList1.Images.SetKeyName(1, "media-playback-stop.png");
|
||||
this.imgList1.Images.SetKeyName(2, "media-playback-pause.png");
|
||||
this.imgList1.Images.SetKeyName(3, "printer.png");
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.IsSplitterFixed = true;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tb1);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.panel1);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.splitContainer1.Panel2.Controls.Add(this.gPane);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(598, 339);
|
||||
this.splitContainer1.SplitterDistance = 34;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
this.splitContainer1.TabStop = false;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.lb_Position);
|
||||
this.panel1.Controls.Add(this.hScrollBar1);
|
||||
this.panel1.Location = new System.Drawing.Point(99, 3);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(496, 28);
|
||||
this.panel1.TabIndex = 7;
|
||||
//
|
||||
// lb_Position
|
||||
//
|
||||
this.lb_Position.AutoSize = true;
|
||||
this.lb_Position.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lb_Position.Location = new System.Drawing.Point(6, 8);
|
||||
this.lb_Position.Name = "lb_Position";
|
||||
this.lb_Position.Size = new System.Drawing.Size(44, 13);
|
||||
this.lb_Position.TabIndex = 3;
|
||||
this.lb_Position.Text = "Position";
|
||||
//
|
||||
// hScrollBar1
|
||||
//
|
||||
this.hScrollBar1.Location = new System.Drawing.Point(57, 10);
|
||||
this.hScrollBar1.Maximum = 10000;
|
||||
this.hScrollBar1.Name = "hScrollBar1";
|
||||
this.hScrollBar1.Size = new System.Drawing.Size(118, 10);
|
||||
this.hScrollBar1.TabIndex = 4;
|
||||
this.hScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.OnScrollbarScroll);
|
||||
//
|
||||
// gPane
|
||||
//
|
||||
this.gPane.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gPane.Location = new System.Drawing.Point(0, 0);
|
||||
this.gPane.Name = "gPane";
|
||||
this.gPane.Size = new System.Drawing.Size(598, 301);
|
||||
this.gPane.TabIndex = 1;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.selectGraphsToolStripMenuItem,
|
||||
this.toolStripSeparator1});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(117, 32);
|
||||
//
|
||||
// selectGraphsToolStripMenuItem
|
||||
//
|
||||
this.selectGraphsToolStripMenuItem.Name = "selectGraphsToolStripMenuItem";
|
||||
this.selectGraphsToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
|
||||
this.selectGraphsToolStripMenuItem.Text = "Options";
|
||||
this.selectGraphsToolStripMenuItem.Click += new System.EventHandler(this.selectGraphsToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(113, 6);
|
||||
//
|
||||
// PlotterDisplayEx
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "PlotterDisplayEx";
|
||||
this.Size = new System.Drawing.Size(598, 339);
|
||||
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.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ToolBar tb1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ToolBarButton tbbSave;
|
||||
private System.Windows.Forms.ToolBarButton tbbOpen;
|
||||
private System.Windows.Forms.HScrollBar hScrollBar1;
|
||||
private PlotterGraphPaneEx gPane;
|
||||
private System.Windows.Forms.Label lb_Position;
|
||||
public System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem selectGraphsToolStripMenuItem;
|
||||
private System.Windows.Forms.ImageList imgList1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
<?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="imgList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="imgList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACI
|
||||
DgAAAk1TRnQBSQFMAgEBBAEAARQBAAEUAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AKgADAQECwAABtgGV
|
||||
AU8B/QHKAZgBWQH/AcoBlwFZAf8BygGXAVkB/wHKAZcBWQH/AcoBlwFYAf8ByQGXAVgB/wHJAZcBWAH/
|
||||
AcoBmAFZAf8BtgGUAU8B/RQAAxQBHAMRARcDAgEDrAADTgGZA10B0gNMAf8BxwGVAVUB/wH5AfcB9gH/
|
||||
AfkB8QHsAf8B+QHxAesB/wH4AfAB6QH/AfcB7QHmAf8B9AHqAeEB/wHyAegB3gH/AfoB+AH2Af8BxwGU
|
||||
AVUB/wMYAf8DWAHRA0QBeggAAxUBHQFiAlgB6QM6AWEDDQESAwABASwAAxsBJgMbASYDGwEmAxsBJgMb
|
||||
ASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmEAADGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEm
|
||||
AxsBJgMbASYDGwEmAxsBJgMbASYIAANUAf0DpwH/A7UB/wOBAf8BrwGsAaoB/wHFAcABvQH/AcUBwAG9
|
||||
Af8BxQHAAb0B/wHFAcABvQH/AcUBwAG9Af8BxQHAAb0B/wGtAaoBqAH/AyAB/wO1Af8DmwH/AxcB/wgA
|
||||
AxUBHQNNAfoBOgIrAfwDXwHgAysBQgMNARIoAAMbASYDKwH8AYACgQH/AYACgQH/AYACgQH/AYACgQH/
|
||||
AYACgQH/AYACgQH/AYACgQH/AYACgQH/AYACgQH/AxsBJhAAAxsBJgMrAfwBgAKBAf8BgAKBAf8BgAKB
|
||||
Af8DIwE0AxsBJgMrAfwBgAKBAf8BgAKBAf8BgAKBAf8DIwE0CAADZAH/A7UB/wO1Af8DlQH/A4EB/wOB
|
||||
Af8DbQH/A2IB/wNVAf8DRgH/AzcB/wM2Af8DYgH/A7UB/wO1Af8DGQH/CAADFQEdAV8CSgH7AfkB+gH5
|
||||
Af8DfwH+AV8BUwFSAfsDVQGyAx0BKgMIAQsgAAMbASYDQAH9IP8DQAH9AxsBJgMAAQEMAAMbASYDQAH9
|
||||
AfwB/QH8Bf8DQAH9AxsBJgMbASYDQAH9AfwB/QH8Bf8DQAH9AxsBJgMAAQEEAANpAf8DuwH/A7sB/wON
|
||||
Af8D1AH/A7kB/wO5Af8DuQH/A7kB/wO5Af8DuQH/A9MB/wODAf8DuwH/A7sB/wMeAf8IAAMVAR0DKwH8
|
||||
AfoC+wH/AfUC9gH/AfkC+gH/ATsBLgEtAfwBbQJRAfcDQgF2AxYBHgMFAQcYAAMbASYDQAH9BP8B1QHb
|
||||
AdgB/wHUAdsB1wH/AdQB2wHYAf8B0wHbAdcB/wHRAdkB1QH/Ac8B1wHTBf8DQAH9AxsBJgMBAQIMAAMb
|
||||
ASYDQAH9AeIB5QHkAf8B2AHfAdwB/wNAAf0DGwEmAxsBJgNAAf0D8wH/AfcB+AH3Af8DQAH9AxsBJgMB
|
||||
AQIEAANuAf8D1wH/A9cB/wOXAf8D2AH/A78B/wO/Af8DvwH/A78B/wO/Af8DvwH/A9cB/wOOAf8D1wH/
|
||||
A9cB/wMzAf8IAAMWAR4DKwH8A/sB/wHTAdoB1wH/AdoB3wHcAf8B9gH3AfYB/wHyAvMB/wE6AisB/AFg
|
||||
AlkB6wMzAVMDEgEZAwQBBRAAAxsBJgNAAf0E/wHaAeAB3QH/AdsB4QHeAf8B3QHiAeAB/wHdAeIB4AH/
|
||||
AdsB4QHeAf8B2AHeAdsF/wNAAf0DGwEmAwEBAgwAAxsBJgNAAf0B4gHmAeQB/wHcAeIB3wH/A0AB/QMb
|
||||
ASYDGwEmA0AB/QHvAfEB8AH/AfAB8wHxAf8DQAH9AxsBJgMBAQIEAANyAf8D+QH/A/kB/wOrAf8D3wH/
|
||||
A8sB/wPLAf8DywH/A8sB/wPLAf8DywH/A98B/wOjAf8D+QH/A/kB/wNVAf8IAAMWAR4DKwH8A/sB/wHf
|
||||
AeQB4QH/Ad4B4wHhAf8B3gHjAeAB/wHjAecB5QH/AfQC9QH/A38B/gGRAkAB/QNWAbYDJgE5AxABFQwA
|
||||
AxsBJgNAAf0E/wHdAeMB4AH/AeEB5gHjAf8B5AHpAecB/wHmAeoB6AH/AeUB6QHnAf8B4gHnAeQF/wNA
|
||||
Af0DGwEmAwEBAgwAAxsBJgNAAf0B5AHoAeUB/wHeAeMB4QH/A0AB/QMbASYDGwEmA0AB/QHsAe8B7gH/
|
||||
AecB6wHpAf8DQAH9AxsBJgMBAQIEAANqAfkD/AH/A/wB/wPLAf8D8gH/A/IB/wPyAf8D8gH/A/IB/wPy
|
||||
Af8D8gH/A/IB/wPGAf8D/AH/A/wB/wNwAf4IAAMWAR4DKwH8A/sB/wHqAe4B7AH/AewB7wHuAf8B7AHv
|
||||
Ae4B/wHrAe4B7QH/AekB7AHrAf8DfwH+AToCKwH8AVgCVgG7Ax0BKgMGAQgMAAMbASYDQAH9BP8B3wHk
|
||||
AeEB/wHkAekB5gH/AeoB7QHrAf8B7gHxAe8B/wHvAfEB8AH/AewB7wHuBf8DQAH9AxsBJgMBAQIMAAMb
|
||||
ASYDQAH9AesB7QHsAf8B3QHjAeAB/wNAAf0DGwEmAxsBJgNAAf0B7QHwAe8B/wHfAeQB4QH/A0AB/QMb
|
||||
ASYDAQECBAADXQTSAf8D6AH/A3EB/wNxAf8DcQH/A3EB/wNxAf8DcQH/A3EB/wNxAf8DcQH/A3EB/wPo
|
||||
Af8DxAH/A1wB3AgAAxYBHgMrAfwD+wH/AfUC9gH/AfoB+wH6Af8D+QH/Ad0C3gH/AWoCRwH5A10B7QE6
|
||||
AjkBYAMNAREUAAMbASYDQAH9BP8B3AHiAd8B/wHkAegB5gH/AesB7gHtAf8B8gH0AfMB/wH3AvgB/wH2
|
||||
AfgB9wX/A0AB/QMbASYDAQECDAADGwEmA0AB/QHyAfQB8wH/AdoB3wHdAf8DQAH9AxsBJgMcASgDQAH9
|
||||
AfMB9QH0Af8B1gHdAdkB/wNAAf0DGwEmAwEBAgQAAy0BRQOaAf8DzAH/AccBiwFCAf8B+QH0Ae0B/wH+
|
||||
AegB2AH/Af4B6AHXAf8B/QHlAdMB/wH8AeQB0QH/AfoB4AHHAf8B+QHdAcMB/wH6AfQB7QH/AccBhQE+
|
||||
Af8DwwH/A2gB/wMtAUUIAAMWAR4DKwH8A/sB/wHwAfMB8gH/AeYC6AH/A00B+gFiAlIB9AFRAk8BpQMU
|
||||
ARwDAAEBGAADGwEmA0AB/QT/AdgB3wHcAf8B4AHlAeMB/wHoAesB6gH/Ae8B8gHwAf8B9wH4AfcB/wP9
|
||||
Bf8DQAH9AxsBJgMBAQIMAAMbASYDQAH9A/wB/wHVAdsB2AH/A0AB/QMbASYDHAEoA0AB/QP8Af8B0gHa
|
||||
AdYB/wNAAf0DGwEmAwEBAggAAzsBYwNqAfMBxQGJAUAB/wH5AfQB7wH/Af4B5wHXAf8B/QHnAdUB/wH8
|
||||
AeYB0gH/AfsB4QHMAf8B+AHcAcIB/wH2AdoBvQH/AfoB9AHvAf8BxAGDATwB/wNdAfMDOwFjDAADFgEe
|
||||
AysB/AP7Af8BPgIyAfwDTQH6AVoCVwG9AxgBIgMCAQMgAAMbASYDQAH9IP8DQAH9AxsBJgMBAQIMAAMb
|
||||
ASYDQAH9CP8DQAH9AxsBJgMcASgDQAH9CP8DQAH9AxsBJgMBAQIMAAMHAQkBlgF6AUcC+QH0AfAB/wH8
|
||||
AeYB0wH/Af0B5wHTAf8B+wHjAc0B/wH6AeAByAH/AfUB1gG7Af8B8wHUAbUB/wH4AfQB8AH/AZUBagFH
|
||||
AfkDBwEJEAADFgEeA0AB/QFbAjIB+wFgAlwB1AMjATMDBwEKKAADGwEmAysB/AEpAS0BKwH/ASkBLQEr
|
||||
Af8BKQEtASsB/wEpAS0BKwH/ASkBLQErAf8BKQEtASsB/wEpAS0BKwH/ASkBLQErAf8BKQEtASsB/wMb
|
||||
ASYDAQECDAADGwEmAWMBVwFVAf4BKQEtASsB/wEpAS0BKwH/ASkBLQErAf8DGwEmAxwBKAFjAVcBVQH+
|
||||
ASkBLQErAf8BKQEtASsB/wEpAS0BKwH/AxsBJgMBAQIQAAGSAXoBUQH3AfkB9QHxAf8B/AHjAc8B/wH8
|
||||
AeQBzwH/AfoB4QHKAf8B+QHdAcQB/wH0AekB3wH/AfcB8gHsAf8B9QHvAekB/wGZAV8BRQH7FAADFgEf
|
||||
AV4CWgHYAygBPQMNAREwAAMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEm
|
||||
AxsBJgMAAQEMAAMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMA
|
||||
AQEQAAGJAWoBSQH2AfkB9QHxAf8B/AHjAc0B/wH7AeMBzQH/AfkB4AHIAf8B+AHcAcIB/wH9AfsB+AH/
|
||||
AfwB5gHNAf8B4gG2AYQB/wJUAVIBphQAAxYBHwMRARcDAgEDuAABngF1AU0B+gH3AfIB7AH/AfgB9AHu
|
||||
Af8B+AHzAe0B/wH4AfMB7QH/AfgB8gHsAf8B8gHmAdcB/wHiAbIBcQH/AZABcQFiAfYDBQEHFAADAwEE
|
||||
wAADOgFgAlgBVgG7AbEBfwFPAf4ByAGMAUMB/wGSAX8BUQH3AZIBfwFRAfcBrgF/AUwB/gNOAZQUAAFC
|
||||
AU0BPgcAAT4DAAEoAwABQAMAASADAAEBAQABAQYAAQEWAAP/gQAB3wX/AeABBwHHBf8CAAHBAf8BwAED
|
||||
AcABAwIAAcAB/wHAAQMBwAEDAgABwAE/AcABAQHAAQECAAHAAQ8BwAEBAcABAQIAAcABAwHAAQEBwAEB
|
||||
AgABwAEBAcABAQHAAQECAAHAAQEBwAEBAcABAQIAAcABBwHAAQEBwAEBAgABwAEPAcABAQHAAQEBgAEB
|
||||
AcABPwHAAQEBwAEBAcABAwHAAf8BwAEBAcABAQHgAQcBwwH/AcABAQHAAQEB4AEHAccF/wHgAQcB3wX/
|
||||
AeABHws=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>84, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Generated
+46
@@ -0,0 +1,46 @@
|
||||
namespace GraphLib
|
||||
{
|
||||
partial class PlotterGraphPaneEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PlotterGraphPane
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Name = "PlotterGraphPane";
|
||||
this.Size = new System.Drawing.Size(409, 150);
|
||||
this.Load += new System.EventHandler(this.OnLoadControl);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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=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>
|
||||
+365
@@ -0,0 +1,365 @@
|
||||
namespace GraphLib
|
||||
{
|
||||
partial class PlotterGraphSelectCurvesForm
|
||||
{
|
||||
/// <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.lb_Graphs = new System.Windows.Forms.CheckedListBox();
|
||||
this.gB_SelectedGraph = new System.Windows.Forms.GroupBox();
|
||||
this.cb_X_AutoScale = new System.Windows.Forms.CheckBox();
|
||||
this.tb_GraphName = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.cbDownSampling = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.btn_GraphColor = new System.Windows.Forms.Button();
|
||||
this.cb_Y_AutoScale = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.bt_MinorGridColor = new System.Windows.Forms.Button();
|
||||
this.bt_bg_col_bot = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.bt_MajorGridColor = new System.Windows.Forms.Button();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.bt_bg_col_top = new System.Windows.Forms.Button();
|
||||
this.btn_AutoScaleAll = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.cb_Layout = new System.Windows.Forms.ComboBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.gB_SelectedGraph.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lb_Graphs);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.gB_SelectedGraph);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.groupBox1);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.button1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(395, 431);
|
||||
this.splitContainer1.SplitterDistance = 171;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// lb_Graphs
|
||||
//
|
||||
this.lb_Graphs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lb_Graphs.FormattingEnabled = true;
|
||||
this.lb_Graphs.Location = new System.Drawing.Point(0, 0);
|
||||
this.lb_Graphs.Name = "lb_Graphs";
|
||||
this.lb_Graphs.Size = new System.Drawing.Size(171, 424);
|
||||
this.lb_Graphs.TabIndex = 0;
|
||||
this.lb_Graphs.SelectedIndexChanged += new System.EventHandler(this.checkedListBox1_SelectedIndexChanged_1);
|
||||
//
|
||||
// gB_SelectedGraph
|
||||
//
|
||||
this.gB_SelectedGraph.Controls.Add(this.cb_X_AutoScale);
|
||||
this.gB_SelectedGraph.Controls.Add(this.tb_GraphName);
|
||||
this.gB_SelectedGraph.Controls.Add(this.label3);
|
||||
this.gB_SelectedGraph.Controls.Add(this.cbDownSampling);
|
||||
this.gB_SelectedGraph.Controls.Add(this.label2);
|
||||
this.gB_SelectedGraph.Controls.Add(this.btn_GraphColor);
|
||||
this.gB_SelectedGraph.Controls.Add(this.cb_Y_AutoScale);
|
||||
this.gB_SelectedGraph.Location = new System.Drawing.Point(6, 232);
|
||||
this.gB_SelectedGraph.Name = "gB_SelectedGraph";
|
||||
this.gB_SelectedGraph.Size = new System.Drawing.Size(206, 158);
|
||||
this.gB_SelectedGraph.TabIndex = 6;
|
||||
this.gB_SelectedGraph.TabStop = false;
|
||||
this.gB_SelectedGraph.Text = "Selected Graph Options";
|
||||
this.gB_SelectedGraph.Visible = false;
|
||||
//
|
||||
// cb_X_AutoScale
|
||||
//
|
||||
this.cb_X_AutoScale.AutoSize = true;
|
||||
this.cb_X_AutoScale.Location = new System.Drawing.Point(12, 102);
|
||||
this.cb_X_AutoScale.Name = "cb_X_AutoScale";
|
||||
this.cb_X_AutoScale.Size = new System.Drawing.Size(93, 17);
|
||||
this.cb_X_AutoScale.TabIndex = 8;
|
||||
this.cb_X_AutoScale.Text = "X AutoScaling";
|
||||
this.cb_X_AutoScale.UseVisualStyleBackColor = true;
|
||||
this.cb_X_AutoScale.CheckedChanged += new System.EventHandler(this.cb_X_AutoScale_CheckedChanged);
|
||||
//
|
||||
// tb_GraphName
|
||||
//
|
||||
this.tb_GraphName.Location = new System.Drawing.Point(12, 24);
|
||||
this.tb_GraphName.Name = "tb_GraphName";
|
||||
this.tb_GraphName.Size = new System.Drawing.Size(167, 20);
|
||||
this.tb_GraphName.TabIndex = 7;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(52, 133);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(76, 13);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "Downsampling";
|
||||
//
|
||||
// cbDownSampling
|
||||
//
|
||||
this.cbDownSampling.FormattingEnabled = true;
|
||||
this.cbDownSampling.Items.AddRange(new object[] {
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6"});
|
||||
this.cbDownSampling.Location = new System.Drawing.Point(7, 130);
|
||||
this.cbDownSampling.Name = "cbDownSampling";
|
||||
this.cbDownSampling.Size = new System.Drawing.Size(39, 21);
|
||||
this.cbDownSampling.TabIndex = 5;
|
||||
this.cbDownSampling.Text = "1";
|
||||
this.cbDownSampling.SelectedIndexChanged += new System.EventHandler(this.OnDownsamplingChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(57, 55);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(63, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Graph Color";
|
||||
//
|
||||
// btn_GraphColor
|
||||
//
|
||||
this.btn_GraphColor.Location = new System.Drawing.Point(11, 50);
|
||||
this.btn_GraphColor.Name = "btn_GraphColor";
|
||||
this.btn_GraphColor.Size = new System.Drawing.Size(26, 23);
|
||||
this.btn_GraphColor.TabIndex = 3;
|
||||
this.btn_GraphColor.UseVisualStyleBackColor = true;
|
||||
this.btn_GraphColor.Click += new System.EventHandler(this.btn_GraphColor_Click);
|
||||
//
|
||||
// cb_Y_AutoScale
|
||||
//
|
||||
this.cb_Y_AutoScale.AutoSize = true;
|
||||
this.cb_Y_AutoScale.Location = new System.Drawing.Point(12, 79);
|
||||
this.cb_Y_AutoScale.Name = "cb_Y_AutoScale";
|
||||
this.cb_Y_AutoScale.Size = new System.Drawing.Size(93, 17);
|
||||
this.cb_Y_AutoScale.TabIndex = 2;
|
||||
this.cb_Y_AutoScale.Text = "Y AutoScaling";
|
||||
this.cb_Y_AutoScale.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label7);
|
||||
this.groupBox1.Controls.Add(this.label5);
|
||||
this.groupBox1.Controls.Add(this.bt_MinorGridColor);
|
||||
this.groupBox1.Controls.Add(this.bt_bg_col_bot);
|
||||
this.groupBox1.Controls.Add(this.label6);
|
||||
this.groupBox1.Controls.Add(this.bt_MajorGridColor);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.bt_bg_col_top);
|
||||
this.groupBox1.Controls.Add(this.btn_AutoScaleAll);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.cb_Layout);
|
||||
this.groupBox1.Location = new System.Drawing.Point(6, 5);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(206, 221);
|
||||
this.groupBox1.TabIndex = 4;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "General Options";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(57, 194);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(82, 13);
|
||||
this.label7.TabIndex = 10;
|
||||
this.label7.Text = "Minor Grid Color";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(57, 136);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(128, 13);
|
||||
this.label5.TabIndex = 8;
|
||||
this.label5.Text = "Background Color Bottom";
|
||||
//
|
||||
// bt_MinorGridColor
|
||||
//
|
||||
this.bt_MinorGridColor.Location = new System.Drawing.Point(11, 189);
|
||||
this.bt_MinorGridColor.Name = "bt_MinorGridColor";
|
||||
this.bt_MinorGridColor.Size = new System.Drawing.Size(26, 23);
|
||||
this.bt_MinorGridColor.TabIndex = 9;
|
||||
this.bt_MinorGridColor.UseVisualStyleBackColor = true;
|
||||
this.bt_MinorGridColor.Click += new System.EventHandler(this.bt_MinorGridColor_Click);
|
||||
//
|
||||
// bt_bg_col_bot
|
||||
//
|
||||
this.bt_bg_col_bot.Location = new System.Drawing.Point(11, 131);
|
||||
this.bt_bg_col_bot.Name = "bt_bg_col_bot";
|
||||
this.bt_bg_col_bot.Size = new System.Drawing.Size(26, 23);
|
||||
this.bt_bg_col_bot.TabIndex = 7;
|
||||
this.bt_bg_col_bot.UseVisualStyleBackColor = true;
|
||||
this.bt_bg_col_bot.Click += new System.EventHandler(this.bt_bg_col_bot_Click);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(57, 165);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(82, 13);
|
||||
this.label6.TabIndex = 8;
|
||||
this.label6.Text = "Major Grid Color";
|
||||
//
|
||||
// bt_MajorGridColor
|
||||
//
|
||||
this.bt_MajorGridColor.Location = new System.Drawing.Point(11, 160);
|
||||
this.bt_MajorGridColor.Name = "bt_MajorGridColor";
|
||||
this.bt_MajorGridColor.Size = new System.Drawing.Size(26, 23);
|
||||
this.bt_MajorGridColor.TabIndex = 7;
|
||||
this.bt_MajorGridColor.UseVisualStyleBackColor = true;
|
||||
this.bt_MajorGridColor.Click += new System.EventHandler(this.bt_MajorGridColor_Click);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(57, 107);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(114, 13);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Background Color Top";
|
||||
//
|
||||
// bt_bg_col_top
|
||||
//
|
||||
this.bt_bg_col_top.Location = new System.Drawing.Point(11, 102);
|
||||
this.bt_bg_col_top.Name = "bt_bg_col_top";
|
||||
this.bt_bg_col_top.Size = new System.Drawing.Size(26, 23);
|
||||
this.bt_bg_col_top.TabIndex = 5;
|
||||
this.bt_bg_col_top.UseVisualStyleBackColor = true;
|
||||
this.bt_bg_col_top.Click += new System.EventHandler(this.bt_bg_col_top_Click);
|
||||
//
|
||||
// btn_AutoScaleAll
|
||||
//
|
||||
this.btn_AutoScaleAll.Location = new System.Drawing.Point(11, 69);
|
||||
this.btn_AutoScaleAll.Name = "btn_AutoScaleAll";
|
||||
this.btn_AutoScaleAll.Size = new System.Drawing.Size(167, 25);
|
||||
this.btn_AutoScaleAll.TabIndex = 4;
|
||||
this.btn_AutoScaleAll.Text = "Auto Scale All";
|
||||
this.btn_AutoScaleAll.UseVisualStyleBackColor = true;
|
||||
this.btn_AutoScaleAll.Click += new System.EventHandler(this.OnButtonAutoScallOnClicked);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(9, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(39, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Layout";
|
||||
//
|
||||
// cb_Layout
|
||||
//
|
||||
this.cb_Layout.FormattingEnabled = true;
|
||||
this.cb_Layout.Items.AddRange(new object[] {
|
||||
"Normal",
|
||||
"Stacked",
|
||||
"Tiles - Fill Vertical",
|
||||
"Tiles - Fill Horizontal",
|
||||
"Vertically"});
|
||||
this.cb_Layout.Location = new System.Drawing.Point(11, 42);
|
||||
this.cb_Layout.Name = "cb_Layout";
|
||||
this.cb_Layout.Size = new System.Drawing.Size(168, 21);
|
||||
this.cb_Layout.TabIndex = 2;
|
||||
this.cb_Layout.Text = "Select";
|
||||
this.cb_Layout.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(66, 396);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(68, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Exit";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// PlotterGraphSelectCurvesForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(395, 431);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(16, 246);
|
||||
this.Name = "PlotterGraphSelectCurvesForm";
|
||||
this.Text = "Graph Properties";
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.gB_SelectedGraph.ResumeLayout(false);
|
||||
this.gB_SelectedGraph.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckedListBox lb_Graphs;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox cb_Layout;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button btn_GraphColor;
|
||||
private System.Windows.Forms.CheckBox cb_Y_AutoScale;
|
||||
private System.Windows.Forms.Button btn_AutoScaleAll;
|
||||
private System.Windows.Forms.GroupBox gB_SelectedGraph;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ComboBox cbDownSampling;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button bt_bg_col_top;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Button bt_bg_col_bot;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Button bt_MinorGridColor;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button bt_MajorGridColor;
|
||||
private System.Windows.Forms.TextBox tb_GraphName;
|
||||
private System.Windows.Forms.CheckBox cb_X_AutoScale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
/* Copyright (c) 2008-2014 DI Zimmermann Stephan (stefan.zimmermann@tele2.at)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
namespace GraphLib
|
||||
{
|
||||
public partial class PlotterGraphSelectCurvesForm : Form
|
||||
{
|
||||
private int selectetGraphIndex = -1;
|
||||
|
||||
private PlotterGraphPaneEx gpane = null;
|
||||
|
||||
public PlotterGraphSelectCurvesForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
FormClosing += new FormClosingEventHandler(OnFormClosing);
|
||||
lb_Graphs.SelectedIndexChanged += new EventHandler(OnSelectedGraphIndexChanged);
|
||||
VisibleChanged += new EventHandler(OnVisibleChanged);
|
||||
tb_GraphName.TextChanged += new EventHandler(tb_GraphName_TextChanged);
|
||||
}
|
||||
|
||||
void tb_GraphName_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (selectetGraphIndex >= 0 && selectetGraphIndex < gpane.Sources.Count)
|
||||
{
|
||||
DataSource src = gpane.Sources[selectetGraphIndex];
|
||||
String Text = tb_GraphName.Text;
|
||||
|
||||
if (String.IsNullOrEmpty(Text) == false)
|
||||
{
|
||||
src.Name = Text;
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PlotterGraphPaneEx GraphPanel
|
||||
{
|
||||
set
|
||||
{
|
||||
gpane = value;
|
||||
if (gpane != null)
|
||||
{
|
||||
this.lb_Graphs.Items.Clear();
|
||||
|
||||
foreach (DataSource s in gpane.Sources)
|
||||
{
|
||||
if (s.Active)
|
||||
{
|
||||
this.lb_Graphs.Items.Add(s.Name, CheckState.Checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lb_Graphs.Items.Add(s.Name, CheckState.Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAllCheckedState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAllCheckedState()
|
||||
{
|
||||
int AutoScaleOn = 0;
|
||||
|
||||
foreach (DataSource src in gpane.Sources)
|
||||
{
|
||||
if (src.AutoScaleY)
|
||||
{
|
||||
AutoScaleOn++;
|
||||
}
|
||||
}
|
||||
|
||||
if (AutoScaleOn == 0)
|
||||
{
|
||||
btn_AutoScaleAll.Visible = true;
|
||||
btn_AutoScaleAll.Text = "Auto Y-Scale all Graphs";
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_AutoScaleAll.Visible = true;
|
||||
btn_AutoScaleAll.Text = "Normal Y-Scale all Graphs";
|
||||
}
|
||||
}
|
||||
|
||||
void OnVisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Visible == true)
|
||||
{
|
||||
selectetGraphIndex = -1;
|
||||
gB_SelectedGraph.Visible = false;
|
||||
|
||||
if (gpane != null)
|
||||
{
|
||||
UpdateAllCheckedState();
|
||||
|
||||
if (gpane.layout == PlotterGraphPaneEx.LayoutMode.NORMAL)
|
||||
{
|
||||
cb_Layout.SelectedIndex = 0;
|
||||
}
|
||||
else if (gpane.layout == PlotterGraphPaneEx.LayoutMode.STACKED)
|
||||
{
|
||||
cb_Layout.SelectedIndex = 1;
|
||||
}
|
||||
else if (gpane.layout == PlotterGraphPaneEx.LayoutMode.TILES_HOR)
|
||||
{
|
||||
cb_Layout.SelectedIndex = 2;
|
||||
}
|
||||
else if (gpane.layout == PlotterGraphPaneEx.LayoutMode.TILES_VER)
|
||||
{
|
||||
cb_Layout.SelectedIndex = 3;
|
||||
}
|
||||
else if (gpane.layout == PlotterGraphPaneEx.LayoutMode.VERTICAL_ARRANGED)
|
||||
{
|
||||
cb_Layout.SelectedIndex = 4;
|
||||
}
|
||||
|
||||
bt_bg_col_top.BackColor = gpane.BgndColorTop;
|
||||
bt_bg_col_bot.BackColor = gpane.BgndColorBot;
|
||||
bt_MajorGridColor.BackColor = gpane.MajorGridColor;
|
||||
bt_MinorGridColor.BackColor = gpane.MinorGridColor;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnSelectedGraphIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (gpane != null)
|
||||
{
|
||||
for (int i = 0; i < gpane.Sources.Count; i++)
|
||||
{
|
||||
if (lb_Graphs.CheckedIndices.Contains(i))
|
||||
{
|
||||
gpane.Sources[i].Active = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gpane.Sources[i].Active = false;
|
||||
}
|
||||
}
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void OnFormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cb_Layout.SelectedIndex == 0)
|
||||
{
|
||||
gpane.layout = PlotterGraphPaneEx.LayoutMode.NORMAL;
|
||||
}
|
||||
if (cb_Layout.SelectedIndex == 1)
|
||||
{
|
||||
gpane.layout = PlotterGraphPaneEx.LayoutMode.STACKED;
|
||||
}
|
||||
|
||||
if (cb_Layout.SelectedIndex == 2)
|
||||
{
|
||||
gpane.layout = PlotterGraphPaneEx.LayoutMode.TILES_VER;
|
||||
}
|
||||
if (cb_Layout.SelectedIndex == 3)
|
||||
{
|
||||
gpane.layout = PlotterGraphPaneEx.LayoutMode.TILES_HOR;
|
||||
}
|
||||
if (cb_Layout.SelectedIndex == 4)
|
||||
{
|
||||
gpane.layout = PlotterGraphPaneEx.LayoutMode.VERTICAL_ARRANGED;
|
||||
}
|
||||
gpane.Invalidate();
|
||||
}
|
||||
|
||||
private void checkedListBox1_SelectedIndexChanged_1(object sender, EventArgs e)
|
||||
{
|
||||
selectetGraphIndex = lb_Graphs.SelectedIndex;
|
||||
|
||||
UpdateSelectedGraphInfo();
|
||||
gB_SelectedGraph.Visible = true;
|
||||
}
|
||||
|
||||
private void UpdateSelectedGraphInfo()
|
||||
{
|
||||
if (selectetGraphIndex >= 0 && selectetGraphIndex < gpane.Sources.Count)
|
||||
{
|
||||
DataSource src = gpane.Sources[selectetGraphIndex];
|
||||
btn_GraphColor.BackColor = src.GraphColor;
|
||||
|
||||
cb_Y_AutoScale.Checked = src.AutoScaleY;
|
||||
cb_X_AutoScale.Checked = src.AutoScaleX;
|
||||
|
||||
cbDownSampling.SelectedIndex = (src.Downsampling - 1);
|
||||
tb_GraphName.Text = src.Name;
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_GraphColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (selectetGraphIndex >= 0 && selectetGraphIndex < gpane.Sources.Count)
|
||||
{
|
||||
DataSource src = gpane.Sources[selectetGraphIndex];
|
||||
ColorDialog d = new ColorDialog();
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
btn_GraphColor.BackColor = d.Color;
|
||||
src.GraphColor = d.Color;
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnButtonAutoScallOnClicked(object sender, EventArgs e)
|
||||
{
|
||||
int AutoScaleOn = 0;
|
||||
|
||||
foreach (DataSource src in gpane.Sources)
|
||||
{
|
||||
if (src.AutoScaleY)
|
||||
{
|
||||
AutoScaleOn++;
|
||||
}
|
||||
}
|
||||
|
||||
if (AutoScaleOn == 0)
|
||||
{
|
||||
btn_AutoScaleAll.Text = "Normal scale for all graphs";
|
||||
foreach (DataSource src in gpane.Sources)
|
||||
{
|
||||
src.AutoScaleY = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_AutoScaleAll.Text = "Auto scale for all graphs";
|
||||
foreach (DataSource src in gpane.Sources)
|
||||
{
|
||||
src.AutoScaleY = false;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateSelectedGraphInfo();
|
||||
gpane.Invalidate();
|
||||
}
|
||||
|
||||
private void OnDownsamplingChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (selectetGraphIndex >= 0 && selectetGraphIndex < gpane.Sources.Count)
|
||||
{
|
||||
DataSource src = gpane.Sources[selectetGraphIndex];
|
||||
|
||||
src.Downsampling = (cbDownSampling.SelectedIndex + 1);
|
||||
}
|
||||
|
||||
gpane.Invalidate();
|
||||
}
|
||||
|
||||
private void bt_bg_col_top_Click(object sender, EventArgs e)
|
||||
{
|
||||
ColorDialog d = new ColorDialog();
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
bt_bg_col_top.BackColor = d.Color;
|
||||
gpane.BgndColorTop = d.Color;
|
||||
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_bg_col_bot_Click(object sender, EventArgs e)
|
||||
{
|
||||
ColorDialog d = new ColorDialog();
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
bt_bg_col_bot.BackColor = d.Color;
|
||||
gpane.BgndColorBot = d.Color;
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_MajorGridColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
ColorDialog d = new ColorDialog();
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
bt_MajorGridColor.BackColor = d.Color;
|
||||
gpane.MajorGridColor = d.Color;
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_MinorGridColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
ColorDialog d = new ColorDialog();
|
||||
if (d.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
bt_MinorGridColor.BackColor = d.Color;
|
||||
gpane.MinorGridColor = d.Color;
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void cb_Y_AutoScale_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (selectetGraphIndex >= 0 && selectetGraphIndex < gpane.Sources.Count)
|
||||
{
|
||||
DataSource src = gpane.Sources[selectetGraphIndex];
|
||||
|
||||
src.AutoScaleY = cb_Y_AutoScale.Checked;
|
||||
|
||||
UpdateAllCheckedState();
|
||||
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void cb_X_AutoScale_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (selectetGraphIndex >= 0 && selectetGraphIndex < gpane.Sources.Count)
|
||||
{
|
||||
DataSource src = gpane.Sources[selectetGraphIndex];
|
||||
|
||||
src.AutoScaleX = cb_X_AutoScale.Checked;
|
||||
|
||||
UpdateAllCheckedState();
|
||||
|
||||
gpane.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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=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>
|
||||
Generated
+264
@@ -0,0 +1,264 @@
|
||||
namespace GraphLib
|
||||
{
|
||||
partial class PrintPreviewForm
|
||||
{
|
||||
/// <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.printPreviewCtrl = new System.Windows.Forms.PrintPreviewControl();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.rb_Unscaled = new System.Windows.Forms.RadioButton();
|
||||
this.rb_BestFit = new System.Windows.Forms.RadioButton();
|
||||
this.rb_Scale = new System.Windows.Forms.RadioButton();
|
||||
this.cb_PrintBackground = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.cb_Printer = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.cb_Orientation = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.cb_PaperSize = new System.Windows.Forms.ComboBox();
|
||||
this.bt_Cancel = new System.Windows.Forms.Button();
|
||||
this.bt_print = new System.Windows.Forms.Button();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// printPreviewCtrl
|
||||
//
|
||||
this.printPreviewCtrl.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.printPreviewCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.printPreviewCtrl.Location = new System.Drawing.Point(0, 0);
|
||||
this.printPreviewCtrl.Name = "printPreviewCtrl";
|
||||
this.printPreviewCtrl.Size = new System.Drawing.Size(453, 501);
|
||||
this.printPreviewCtrl.TabIndex = 1;
|
||||
//
|
||||
// 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.printPreviewCtrl);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.groupBox1);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.cb_PrintBackground);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.label3);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.cb_Printer);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.label2);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.cb_Orientation);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.label1);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.cb_PaperSize);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.bt_Cancel);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.bt_print);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(681, 501);
|
||||
this.splitContainer1.SplitterDistance = 453;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.rb_Unscaled);
|
||||
this.groupBox1.Controls.Add(this.rb_BestFit);
|
||||
this.groupBox1.Controls.Add(this.rb_Scale);
|
||||
this.groupBox1.Location = new System.Drawing.Point(18, 188);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(93, 93);
|
||||
this.groupBox1.TabIndex = 12;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Scaling";
|
||||
//
|
||||
// rb_Unscaled
|
||||
//
|
||||
this.rb_Unscaled.AutoSize = true;
|
||||
this.rb_Unscaled.Location = new System.Drawing.Point(13, 19);
|
||||
this.rb_Unscaled.Name = "rb_Unscaled";
|
||||
this.rb_Unscaled.Size = new System.Drawing.Size(70, 17);
|
||||
this.rb_Unscaled.TabIndex = 8;
|
||||
this.rb_Unscaled.TabStop = true;
|
||||
this.rb_Unscaled.Text = "Unscaled";
|
||||
this.rb_Unscaled.UseVisualStyleBackColor = true;
|
||||
this.rb_Unscaled.CheckedChanged += new System.EventHandler(this.rb_Unscaled_CheckedChanged);
|
||||
//
|
||||
// rb_BestFit
|
||||
//
|
||||
this.rb_BestFit.AutoSize = true;
|
||||
this.rb_BestFit.Location = new System.Drawing.Point(13, 65);
|
||||
this.rb_BestFit.Name = "rb_BestFit";
|
||||
this.rb_BestFit.Size = new System.Drawing.Size(60, 17);
|
||||
this.rb_BestFit.TabIndex = 6;
|
||||
this.rb_BestFit.TabStop = true;
|
||||
this.rb_BestFit.Text = "Best Fit";
|
||||
this.rb_BestFit.UseVisualStyleBackColor = true;
|
||||
this.rb_BestFit.CheckedChanged += new System.EventHandler(this.rb_BestFit_CheckedChanged);
|
||||
//
|
||||
// rb_Scale
|
||||
//
|
||||
this.rb_Scale.AutoSize = true;
|
||||
this.rb_Scale.Location = new System.Drawing.Point(13, 42);
|
||||
this.rb_Scale.Name = "rb_Scale";
|
||||
this.rb_Scale.Size = new System.Drawing.Size(52, 17);
|
||||
this.rb_Scale.TabIndex = 7;
|
||||
this.rb_Scale.TabStop = true;
|
||||
this.rb_Scale.Text = "Scale";
|
||||
this.rb_Scale.UseVisualStyleBackColor = true;
|
||||
this.rb_Scale.CheckedChanged += new System.EventHandler(this.rb_Scale_CheckedChanged);
|
||||
//
|
||||
// cb_PrintBackground
|
||||
//
|
||||
this.cb_PrintBackground.AutoSize = true;
|
||||
this.cb_PrintBackground.Location = new System.Drawing.Point(22, 321);
|
||||
this.cb_PrintBackground.Name = "cb_PrintBackground";
|
||||
this.cb_PrintBackground.Size = new System.Drawing.Size(108, 17);
|
||||
this.cb_PrintBackground.TabIndex = 11;
|
||||
this.cb_PrintBackground.Text = "Print Background";
|
||||
this.cb_PrintBackground.UseVisualStyleBackColor = true;
|
||||
this.cb_PrintBackground.Visible = false;
|
||||
this.cb_PrintBackground.CheckedChanged += new System.EventHandler(this.cb_PrintBackground_CheckedChanged);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(19, 29);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(37, 13);
|
||||
this.label3.TabIndex = 10;
|
||||
this.label3.Text = "Printer";
|
||||
//
|
||||
// cb_Printer
|
||||
//
|
||||
this.cb_Printer.FormattingEnabled = true;
|
||||
this.cb_Printer.Location = new System.Drawing.Point(18, 45);
|
||||
this.cb_Printer.Name = "cb_Printer";
|
||||
this.cb_Printer.Size = new System.Drawing.Size(195, 21);
|
||||
this.cb_Printer.TabIndex = 9;
|
||||
this.cb_Printer.SelectedIndexChanged += new System.EventHandler(this.cb_Printer_SelectedIndexChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(19, 134);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(58, 13);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "Orientation";
|
||||
//
|
||||
// cb_Orientation
|
||||
//
|
||||
this.cb_Orientation.FormattingEnabled = true;
|
||||
this.cb_Orientation.Items.AddRange(new object[] {
|
||||
"Portrait",
|
||||
"Landscape"});
|
||||
this.cb_Orientation.Location = new System.Drawing.Point(18, 150);
|
||||
this.cb_Orientation.Name = "cb_Orientation";
|
||||
this.cb_Orientation.Size = new System.Drawing.Size(93, 21);
|
||||
this.cb_Orientation.TabIndex = 4;
|
||||
this.cb_Orientation.SelectedIndexChanged += new System.EventHandler(this.cb_Orientation_SelectedIndexChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(19, 81);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(58, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Paper Size";
|
||||
//
|
||||
// cb_PaperSize
|
||||
//
|
||||
this.cb_PaperSize.FormattingEnabled = true;
|
||||
this.cb_PaperSize.Location = new System.Drawing.Point(18, 97);
|
||||
this.cb_PaperSize.Name = "cb_PaperSize";
|
||||
this.cb_PaperSize.Size = new System.Drawing.Size(93, 21);
|
||||
this.cb_PaperSize.TabIndex = 2;
|
||||
this.cb_PaperSize.SelectedIndexChanged += new System.EventHandler(this.cb_PaperSize_SelectedIndexChanged);
|
||||
//
|
||||
// bt_Cancel
|
||||
//
|
||||
this.bt_Cancel.Location = new System.Drawing.Point(118, 450);
|
||||
this.bt_Cancel.Name = "bt_Cancel";
|
||||
this.bt_Cancel.Size = new System.Drawing.Size(69, 26);
|
||||
this.bt_Cancel.TabIndex = 1;
|
||||
this.bt_Cancel.Text = "Cancel";
|
||||
this.bt_Cancel.UseVisualStyleBackColor = true;
|
||||
this.bt_Cancel.Click += new System.EventHandler(this.bt_Cancel_Click);
|
||||
//
|
||||
// bt_print
|
||||
//
|
||||
this.bt_print.Location = new System.Drawing.Point(22, 450);
|
||||
this.bt_print.Name = "bt_print";
|
||||
this.bt_print.Size = new System.Drawing.Size(69, 26);
|
||||
this.bt_print.TabIndex = 0;
|
||||
this.bt_print.Text = "Print";
|
||||
this.bt_print.UseVisualStyleBackColor = true;
|
||||
this.bt_print.Click += new System.EventHandler(this.bt_print_Click);
|
||||
//
|
||||
// PrintPreviewForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(681, 501);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.MaximumSize = new System.Drawing.Size(697, 537);
|
||||
this.MinimumSize = new System.Drawing.Size(697, 537);
|
||||
this.Name = "PrintPreviewForm";
|
||||
this.Text = "PrintPreviewForm";
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PrintPreviewControl printPreviewCtrl;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Button bt_Cancel;
|
||||
private System.Windows.Forms.Button bt_print;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox cb_PaperSize;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ComboBox cb_Orientation;
|
||||
private System.Windows.Forms.RadioButton rb_Scale;
|
||||
private System.Windows.Forms.RadioButton rb_BestFit;
|
||||
private System.Windows.Forms.RadioButton rb_Unscaled;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ComboBox cb_Printer;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.CheckBox cb_PrintBackground;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Printing;
|
||||
|
||||
namespace GraphLib
|
||||
{
|
||||
public partial class PrintPreviewForm : Form
|
||||
{
|
||||
private PrintDocument printDoc = new PrintDocument();
|
||||
private PlotterGraphPaneEx gpane = null;
|
||||
private String strDefaultPrinter = String.Empty;
|
||||
|
||||
private bool bBestScale = false;
|
||||
private bool bPageScale = false;
|
||||
private bool bUnscaled = false;
|
||||
private bool bLandscape = false;
|
||||
private int selPrinterIndex = -1;
|
||||
|
||||
public PrintPreviewForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
printPreviewCtrl.Zoom = 1;
|
||||
rb_BestFit.Checked = true;
|
||||
rb_Scale.Checked = false;
|
||||
rb_Unscaled.Checked = false;
|
||||
cb_Orientation.SelectedIndex = 0;
|
||||
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
|
||||
this.VisibleChanged += new EventHandler(OnVisibleChanged);
|
||||
FormClosing += new FormClosingEventHandler(OnFormClosing);
|
||||
}
|
||||
|
||||
void FillInInstalledPrinters()
|
||||
{
|
||||
strDefaultPrinter = printDoc.PrinterSettings.PrinterName;
|
||||
cb_Printer.Items.Clear();
|
||||
foreach (String strPrinter in PrinterSettings.InstalledPrinters)
|
||||
{
|
||||
cb_Printer.Items.Add(strPrinter);
|
||||
|
||||
if (strPrinter == strDefaultPrinter)
|
||||
{
|
||||
cb_Printer.SelectedIndex = cb_Printer.Items.IndexOf(strPrinter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnVisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.Visible)
|
||||
{
|
||||
bLandscape = cb_Orientation.SelectedIndex == 1;
|
||||
|
||||
FillInInstalledPrinters();
|
||||
|
||||
FillInPaperSizes();
|
||||
|
||||
UpdateScaleRadioButtons();
|
||||
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OnFormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
void UpdateScaleRadioButtons()
|
||||
{
|
||||
bBestScale = rb_BestFit.Checked;
|
||||
bPageScale = rb_Scale.Checked;
|
||||
bUnscaled = rb_Unscaled.Checked;
|
||||
}
|
||||
|
||||
double AutoZoomPreview()
|
||||
{
|
||||
float zoom = 1.0f;
|
||||
float step = 0.05f;
|
||||
|
||||
float PaperWidth = printDoc.DefaultPageSettings.PaperSize.Width;
|
||||
float PaperHeight = printDoc.DefaultPageSettings.PaperSize.Height;
|
||||
|
||||
if (bLandscape)
|
||||
{
|
||||
PaperHeight = printDoc.DefaultPageSettings.PaperSize.Width * zoom;
|
||||
PaperWidth = printDoc.DefaultPageSettings.PaperSize.Height * zoom;
|
||||
}
|
||||
|
||||
while (zoom > 0.1f)
|
||||
{
|
||||
double CurW = PaperWidth * zoom;
|
||||
double CurH = PaperHeight * zoom;
|
||||
|
||||
if (splitContainer1.Panel1.Width < (CurW+10) || splitContainer1.Panel1.Height < (CurH+10))
|
||||
{
|
||||
zoom -= step;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return zoom;
|
||||
}
|
||||
|
||||
void FillInPaperSizes()
|
||||
{
|
||||
cb_PaperSize.Items.Clear();
|
||||
|
||||
foreach (PaperSize s in printDoc.PrinterSettings.PaperSizes)
|
||||
{
|
||||
cb_PaperSize.Items.Add(s.PaperName.ToString());
|
||||
}
|
||||
|
||||
if (cb_PaperSize.SelectedIndex == -1 || cb_PaperSize.SelectedIndex >= cb_PaperSize.Items.Count)
|
||||
{
|
||||
int idx = cb_PaperSize.Items.IndexOf(printDoc.DefaultPageSettings.PaperSize.PaperName);
|
||||
|
||||
if (idx >= 0 && idx < cb_PaperSize.Items.Count)
|
||||
{
|
||||
cb_PaperSize.SelectedIndex = idx;
|
||||
}
|
||||
else
|
||||
{
|
||||
cb_PaperSize.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InvalidatePrintPreview()
|
||||
{
|
||||
printDoc.DefaultPageSettings.Landscape = bLandscape;
|
||||
printPreviewCtrl.Document = printDoc;
|
||||
printPreviewCtrl.Document.DocumentName = "Preview";
|
||||
printPreviewCtrl.Zoom = AutoZoomPreview();
|
||||
printPreviewCtrl.InvalidatePreview();
|
||||
}
|
||||
|
||||
|
||||
public PlotterGraphPaneEx GraphPanel
|
||||
{
|
||||
set
|
||||
{
|
||||
gpane = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void AutoScaleDocument(ref float w, ref float h, ref float x, ref float y)
|
||||
{
|
||||
float CurGraphWidth = gpane.Width;
|
||||
float CurGraphHeight = gpane.Height;
|
||||
float CurPaperWidth = printDoc.DefaultPageSettings.PaperSize.Width;
|
||||
float CurPaperHeight = printDoc.DefaultPageSettings.PaperSize.Height;
|
||||
|
||||
if (bLandscape)
|
||||
{
|
||||
CurPaperWidth = printDoc.DefaultPageSettings.PaperSize.Height;
|
||||
CurPaperHeight = printDoc.DefaultPageSettings.PaperSize.Width;
|
||||
}
|
||||
|
||||
if (bUnscaled)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
if (bPageScale) // scale to page
|
||||
{
|
||||
CurGraphWidth = CurPaperWidth;
|
||||
CurGraphHeight = CurPaperHeight;
|
||||
}
|
||||
|
||||
if (bBestScale) // scale to best fit
|
||||
{
|
||||
float zoom = 1.0f;
|
||||
float step = 0.05f;
|
||||
|
||||
if (CurGraphWidth > (CurPaperWidth ) || CurGraphHeight > (CurPaperHeight ))
|
||||
{
|
||||
// scale down
|
||||
while ((zoom * gpane.Width > CurPaperWidth || zoom * gpane.Height > CurPaperHeight) && zoom > step)
|
||||
{
|
||||
zoom -= step;
|
||||
}
|
||||
zoom -= step;
|
||||
|
||||
}
|
||||
else if (CurGraphWidth < CurPaperWidth && CurGraphHeight < CurPaperHeight)
|
||||
{
|
||||
// scale up
|
||||
while (((zoom+step) * gpane.Width < CurPaperWidth && (zoom+step) * gpane.Height < CurPaperHeight) && zoom > step)
|
||||
{
|
||||
zoom += step;
|
||||
}
|
||||
|
||||
}
|
||||
CurGraphWidth = zoom * gpane.Width;
|
||||
CurGraphHeight = zoom * gpane.Height;
|
||||
}
|
||||
|
||||
w = CurGraphWidth;
|
||||
h = CurGraphHeight;
|
||||
|
||||
// center print
|
||||
x = (CurPaperWidth - w) / 2.0f;
|
||||
y = (CurPaperHeight - h) / 2.0f;
|
||||
}
|
||||
|
||||
private void printDoc_PrintPage(object sender, PrintPageEventArgs e)
|
||||
{
|
||||
if (gpane != null)
|
||||
{
|
||||
float x=0, y=0, w=gpane.Width, h=gpane.Height;
|
||||
|
||||
AutoScaleDocument(ref w, ref h, ref x, ref y);
|
||||
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
//gpane.PaintControl(e.Graphics, w, h,x,y,cb_PrintBackground.Checked);
|
||||
gpane.PaintControl(e.Graphics, w, h, x, y, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_print_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (printDoc != null)
|
||||
{
|
||||
printDoc.Print();
|
||||
this.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void cb_PaperSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cb_PaperSize.SelectedIndex >= 0 && cb_PaperSize.SelectedIndex < cb_PaperSize.Items.Count)
|
||||
{
|
||||
|
||||
foreach (PaperSize s in printDoc.PrinterSettings.PaperSizes)
|
||||
{
|
||||
if (s.PaperName == (string)cb_PaperSize.Items[cb_PaperSize.SelectedIndex])
|
||||
{
|
||||
printDoc.DefaultPageSettings.PaperSize = s;
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void rb_BestFit_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rb_BestFit.Checked)
|
||||
{
|
||||
rb_Scale.Checked = !rb_BestFit.Checked;
|
||||
rb_Unscaled.Checked = !rb_BestFit.Checked;
|
||||
}
|
||||
|
||||
UpdateScaleRadioButtons();
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
|
||||
private void rb_Scale_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rb_Scale.Checked)
|
||||
{
|
||||
rb_BestFit.Checked = !rb_Scale.Checked;
|
||||
rb_Unscaled.Checked = !rb_Scale.Checked;
|
||||
}
|
||||
|
||||
UpdateScaleRadioButtons();
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
|
||||
private void rb_Unscaled_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rb_Unscaled.Checked)
|
||||
{
|
||||
rb_Scale.Checked = !rb_Unscaled.Checked;
|
||||
rb_BestFit.Checked = !rb_Unscaled.Checked;
|
||||
}
|
||||
|
||||
UpdateScaleRadioButtons();
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
|
||||
private void cb_Printer_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
selPrinterIndex = cb_Printer.SelectedIndex;
|
||||
|
||||
if (selPrinterIndex >= 0 && selPrinterIndex < cb_Printer.Items.Count)
|
||||
{
|
||||
printDoc.PrinterSettings.PrinterName = (string)cb_Printer.Items[selPrinterIndex];
|
||||
this.Text = "Print Preview - " + printDoc.PrinterSettings.PrinterName;
|
||||
}
|
||||
|
||||
FillInPaperSizes();
|
||||
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
|
||||
private void cb_Orientation_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cb_Orientation.SelectedIndex == 0)
|
||||
{
|
||||
bLandscape = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bLandscape = true;
|
||||
}
|
||||
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
|
||||
private void cb_PrintBackground_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
InvalidatePrintPreview();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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=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>
|
||||
@@ -0,0 +1,35 @@
|
||||
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("GraphLibrary")]
|
||||
[assembly: AssemblyDescription("Library for easy and simple graph drawing")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("GraphLibrary")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008-2014 ZIMMERMANN STEPHAN")]
|
||||
[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("b23e30ac-c4b8-4863-90d0-cf0ad837c050")]
|
||||
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18408
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ClassLibrary1.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[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>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClassLibrary1.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </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,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=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>
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
|
||||
namespace GraphLib
|
||||
{
|
||||
public class Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// returns the most significant decimal digit
|
||||
/// 250 -> 100
|
||||
/// 350 -> 100
|
||||
/// 12 -> 10
|
||||
/// 5 -> 1
|
||||
/// 0.5 .> 0.1
|
||||
/// .....
|
||||
/// </summary>
|
||||
/// <param name="Value"></param>
|
||||
/// <returns></returns>
|
||||
static public float MostSignificantDigit(float Value)
|
||||
{
|
||||
float n = 1;
|
||||
|
||||
float val_abs = Math.Abs(Value);
|
||||
float sig = 1.0f * Math.Sign(Value);
|
||||
|
||||
if (val_abs > 1)
|
||||
{
|
||||
while (n < val_abs)
|
||||
{
|
||||
n *= 10.0f;
|
||||
}
|
||||
|
||||
return (float)((int)(sig * n / 10));
|
||||
}
|
||||
else // n <= 1
|
||||
{
|
||||
while (n > val_abs)
|
||||
{
|
||||
n /= 10.0f;
|
||||
}
|
||||
|
||||
return sig * n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
-4
@@ -27,8 +27,8 @@ namespace Results
|
||||
public Batch Batch;
|
||||
public WaterMeter[] WaterMeters;
|
||||
|
||||
public static BatchResults NewFromProcedure(int batchNr, int benchId, string user, int userNr, string programVer,
|
||||
Config.Entities.Procedure procedure,
|
||||
public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5,
|
||||
string user, int userNr, string programVer, Config.Entities.Procedure procedure,
|
||||
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
|
||||
{
|
||||
BatchResults d = new BatchResults(waterMeterDatas.Length);
|
||||
@@ -37,8 +37,14 @@ namespace Results
|
||||
/// Create new batch
|
||||
d.Batch = new Batch()
|
||||
{
|
||||
TestBenchId = benchId,
|
||||
BatchNr = batchNr,
|
||||
BatchNr = batchNr,
|
||||
TestBenchId = benchId,
|
||||
TestBenchName = benchName,
|
||||
Address1 = a1,
|
||||
Address2 = a2,
|
||||
Address3 = a3,
|
||||
Address4 = a4,
|
||||
Address5 = a5,
|
||||
ProgramVersion = programVer,
|
||||
UserName = user,
|
||||
UserNumber = userNr,
|
||||
@@ -189,5 +195,24 @@ namespace Results
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsProduction()
|
||||
{
|
||||
for (int i = 0; i < WMPositionsCount; i++)
|
||||
{
|
||||
if (WaterMeters[i] != null)
|
||||
{
|
||||
foreach (var mtr in WaterMeters[i].MeterTestRslts)
|
||||
{
|
||||
if (mtr.TestData().Name.ToLower().Contains("adj") || mtr.TestData().Name.ToLower().Contains("just"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-10
@@ -21,12 +21,19 @@ namespace Results
|
||||
public static ISessionFactory SessionFactory;
|
||||
|
||||
/// <summary> Connection string for all sessions </summary>
|
||||
private static string connectionString;
|
||||
static string connectionString;
|
||||
///
|
||||
public static string ConnectionString
|
||||
{
|
||||
get { return connectionString; }
|
||||
set { connectionString = value; SessionFactory = null; }
|
||||
set
|
||||
{
|
||||
if (value != connectionString)
|
||||
{
|
||||
connectionString = value;
|
||||
SessionFactory = null; /// Clear SessionFactory on connection string change
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Database type (MySQL or SQLite) for all sessions </summary>
|
||||
@@ -254,6 +261,12 @@ namespace Results
|
||||
foreach (var cd in ComponentsList) if (cd.Id == 0) session.SaveOrUpdate(cd);
|
||||
foreach (var wd in WaterMeterDataList) if (wd.Id == 0) session.SaveOrUpdate(wd);
|
||||
|
||||
log.Debug(batch.ToString(1));
|
||||
foreach (var tstRslt in batch.TestRslts)
|
||||
{
|
||||
log.Debug(tstRslt.ToString(1));
|
||||
}
|
||||
|
||||
session.SaveOrUpdate(batch);
|
||||
|
||||
transaction.Commit();
|
||||
@@ -261,7 +274,13 @@ namespace Results
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
|
||||
log.FatalFormat("Saving results of batch #{0} into the results DB failed: {1}", batch.BatchNr, exc.Message);
|
||||
if (exc.InnerException != null && !string.IsNullOrEmpty(exc.InnerException.Message))
|
||||
{
|
||||
log.FatalFormat("Inner exception message: {0}", exc.InnerException.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -277,13 +296,13 @@ namespace Results
|
||||
ISession session = DB.CreateSession();
|
||||
if (session == null) return null;
|
||||
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
|
||||
try
|
||||
{
|
||||
batches = session.QueryOver<Batch>()
|
||||
TestDataList = session.QueryOver<TestData>().List();
|
||||
ComponentsList = session.QueryOver<Components>().List();
|
||||
WaterMeterDataList = session.QueryOver<WaterMeterData>().List();
|
||||
|
||||
batches = session.QueryOver<Batch>()
|
||||
.Where(x => (x.BatchNr == batchNr))
|
||||
.List();
|
||||
|
||||
@@ -296,14 +315,14 @@ namespace Results
|
||||
.Where(x => (x.Batch.Id == batch.Id))
|
||||
.List();
|
||||
}
|
||||
}
|
||||
|
||||
return (batches.Count > 0) ? batches[0] : null;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.FatalFormat("Cannot load batch #{0}: {1}", batchNr, exc.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (batches.Count > 0) ? batches[0] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,13 @@ namespace Results.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int BatchNr { get; set; }
|
||||
public virtual int TestBenchId { get; set; }
|
||||
public virtual string ProgramVersion { get; set; }
|
||||
public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB
|
||||
public virtual string ProgramVersion { get; set; }
|
||||
public virtual string UserName { get; set; }
|
||||
public virtual int UserNumber { get; set; }
|
||||
public virtual string ProcedureName { get; set; }
|
||||
@@ -41,6 +47,18 @@ namespace Results.Entities
|
||||
TestRslts = new List<TestRslt>();
|
||||
}
|
||||
|
||||
public virtual int PassedMetersCount()
|
||||
{
|
||||
int count = 0;
|
||||
foreach (var mtr in WaterMeters) if (mtr.PassedFromTests()) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
public virtual int FailedMetersCount()
|
||||
{
|
||||
return WaterMeters.Count - PassedMetersCount();
|
||||
}
|
||||
|
||||
public virtual double AmbTempMean()
|
||||
{
|
||||
double timeSum = 0;
|
||||
@@ -95,6 +113,62 @@ namespace Results.Entities
|
||||
return (timeSum == 0) ? 0 : (sum / timeSum);
|
||||
}
|
||||
|
||||
public virtual double AmbTempStart()
|
||||
{
|
||||
for (int i = 0; i < TestRslts.Count; i++)
|
||||
{
|
||||
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
|
||||
return TestRslts[i].AmbTempStart;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public virtual double AmbPressStart()
|
||||
{
|
||||
for (int i = 0; i < TestRslts.Count; i++)
|
||||
{
|
||||
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
|
||||
return TestRslts[i].AmbPressStart;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public virtual double AmbHumiStart()
|
||||
{
|
||||
for (int i = 0; i < TestRslts.Count; i++)
|
||||
{
|
||||
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
|
||||
return TestRslts[i].AmbHumiStart;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual double AmbTempEnd()
|
||||
{
|
||||
for (int i = TestRslts.Count - 1; i >= 0; i++)
|
||||
{
|
||||
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
|
||||
return TestRslts[i].AmbTempEnd;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public virtual double AmbPressEnd()
|
||||
{
|
||||
for (int i = TestRslts.Count - 1; i >= 0; i++)
|
||||
{
|
||||
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
|
||||
return TestRslts[i].AmbPressEnd;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public virtual double AmbHumiEnd()
|
||||
{
|
||||
for (int i = TestRslts.Count - 1; i >= 0; i++)
|
||||
{
|
||||
if (TestRslts[i].Publish() == Config.Entities.Publish.Always)
|
||||
return TestRslts[i].AmbHumiEnd;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual double Buoyancy()
|
||||
{
|
||||
double timeSum = 0;
|
||||
@@ -126,5 +200,14 @@ namespace Results.Entities
|
||||
{
|
||||
return string.Format("Batch #{0}, Start:{1}, End:{2}, Procedure:{3}", BatchNr, StartTime, EndTime, ProcedureName);
|
||||
}
|
||||
|
||||
public virtual string ToString(int i)
|
||||
{
|
||||
return string.Format("Batch: BatchNr={0} TestBenchId={1} ProgramVersion={2} UserName={3} UserNumber={4} ProcedureName={5} ProcedureRevision={6} ProtocolTitle={7} Remark={8} DensityCorr={9} Custom2={10} Custom3={11} StartTime={12} EndTime={13} Dirty={14} RsltsSent={15} RsltsPrinted={16}",
|
||||
BatchNr, TestBenchId, ProgramVersion, UserName, UserNumber,
|
||||
ProcedureName, ProcedureRevision, ProtocolTitle, Remark, DensityCorr,
|
||||
Custom2, Custom3, StartTime, EndTime, Dirty,
|
||||
RsltsSent, RsltsPrinted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Results.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
|
||||
public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy
|
||||
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
|
||||
|
||||
public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses
|
||||
public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses)
|
||||
public virtual double PulsesPerLiter { get; set; } /// [l ^ -1], in case of heat meters (CompoundMeterId==5) pulses per kWh in [kWh ^ -1]
|
||||
@@ -23,8 +25,12 @@ namespace Results.Entities
|
||||
|
||||
/// Main result
|
||||
public virtual double Error { get; set; } /// [%]
|
||||
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
|
||||
public virtual bool TestDone { get; set; } /// true = test was completed
|
||||
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
|
||||
#if ORACLE_DB
|
||||
public virtual double LastError { get; set; } /// [%] Previous test error at this Q in case Pruefindex > 1
|
||||
#endif
|
||||
|
||||
public virtual WaterMeter WaterMeter { get; set; } /// reference to the WaterMeter entity
|
||||
public virtual TestRslt TestRslt { get; set; } /// reference to the TestRslt entity
|
||||
@@ -37,10 +43,10 @@ namespace Results.Entities
|
||||
public virtual double FlowMass() { return TestRslt.FlowMass; } /// [kg/h]
|
||||
public virtual double FlowVolume() { return TestRslt.FlowVolume; } /// [m3/h]
|
||||
public virtual double ErrorMaster() { return TestRslt.ErrorMaster; } /// [%]
|
||||
public virtual double DensityOut() { return TestRslt.DensityOut; }
|
||||
public virtual double DensityLine() { return TestRslt.DensityLine; }
|
||||
public virtual Components Components(){ return TestRslt.Components; }
|
||||
///
|
||||
protected virtual TestData TestData() { return TestRslt.TestData; }
|
||||
public virtual TestData TestData() { return TestRslt.TestData; }
|
||||
///
|
||||
public virtual int Repeats() { return TestData().Repeats; }
|
||||
public virtual double Qfrom() { return TestData().Qfrom; } /// [m3/h]
|
||||
@@ -72,16 +78,23 @@ namespace Results.Entities
|
||||
(CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy);
|
||||
}
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
public virtual bool IsPulses() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Pulses || RegReaderType == (int)Config.Entities.RegisterReaderType.Unknown); }
|
||||
public virtual bool IsCamera() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Camera); }
|
||||
public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); }
|
||||
public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); }
|
||||
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
#if PUCHONG_PT200
|
||||
if (!Evaluate()) return Passed ? "OK|White" : "NG|White";
|
||||
else return Passed ? "OK|Green" : "NG|Red";
|
||||
#else
|
||||
if (!Evaluate()) return Passed ? "OK|White" : "NOK|White";
|
||||
else return Passed ? "OK|Green" : "NOK|Red";
|
||||
#endif
|
||||
}
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, Evaluate());
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
|
||||
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
public MeterTestRslt()
|
||||
{
|
||||
@@ -101,6 +114,8 @@ namespace Results.Entities
|
||||
{
|
||||
if (src == null) return;
|
||||
|
||||
CompoundMeterId = src.CompoundMeterId;
|
||||
RegReaderType = src.RegReaderType;
|
||||
PulsesMeter = src.PulsesMeter;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
PulsesPerLiter = src.PulsesPerLiter;
|
||||
@@ -112,6 +127,7 @@ namespace Results.Entities
|
||||
TimestampEnd = src.TimestampEnd;
|
||||
TestTime = src.TestTime;
|
||||
Error = src.Error;
|
||||
KorrErrQ = src.KorrErrQ;
|
||||
TestDone = src.TestDone;
|
||||
Passed = src.Passed;
|
||||
}
|
||||
|
||||
+130
-15
@@ -1,8 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
@@ -13,31 +14,48 @@ namespace Results.Entities
|
||||
public virtual Batch Batch { get; set; }
|
||||
public virtual TestData TestData { get; set; }
|
||||
public virtual Components Components { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual int Part { get; set; }
|
||||
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
|
||||
public virtual string MethodClass { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
|
||||
|
||||
/// Main results
|
||||
public virtual bool TestDone { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; }
|
||||
public virtual double ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
|
||||
public virtual double MassStartRaw { get; set; } /// [kg]
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
|
||||
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
|
||||
/// When mass measurement is not available, corrected by a correction table.
|
||||
public virtual double MassStartRaw { get; set; } /// [kg]
|
||||
public virtual double MassStart { get; set; } /// [kg]
|
||||
public virtual double MassEndRaw { get; set; } /// [kg]
|
||||
public virtual double MassEnd { get; set; } /// [kg]
|
||||
public virtual double DensityIn { get; set; } /// [kg/m3]
|
||||
public virtual double DensityOut { get; set; } /// [kg/m3]
|
||||
public virtual double DensityLine { get; set; } /// [kg/m3]
|
||||
public virtual double DensityDiv { get; set; } /// [kg/m3]
|
||||
public virtual double Buoyancy { get; set; }
|
||||
public virtual double FlowMass { get; set; } /// [kg/h] calculated from conventional true value
|
||||
public virtual double FlowVolume { get; set; } /// [m3/h]
|
||||
public virtual double VolumeCTV { get; set; } /// [l] Volume conventional true value
|
||||
public virtual double VolumeMaster { get; set; } /// [l] Volume from the master flow meter
|
||||
public virtual double ErrorMaster { get; set; } /// [%]
|
||||
public virtual double ErrorMaster { get; set; } /// [%] Error of the master flow meter
|
||||
|
||||
public virtual float DiverterStart { get; set; } /// [s] Diverter switch time when test starts
|
||||
public virtual float DivStart10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB)
|
||||
public virtual float DivStart50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB)
|
||||
public virtual float DivStart90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB)
|
||||
|
||||
public virtual float DiverterEnd { get; set; } /// [s] Diverter switch time when test ends
|
||||
public virtual float DivEnd90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB)
|
||||
public virtual float DivEnd50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB)
|
||||
public virtual float DivEnd10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB)
|
||||
|
||||
public virtual int ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc.
|
||||
public virtual sbyte ErrorFlagsMd { get; set; } /// 0=off, 1=info, 2=on (evaluated in MeterTestRslt.Passed)
|
||||
|
||||
/// Main results of heat meters
|
||||
public virtual double RefEnergy { get; set; } /// [J] Joul
|
||||
@@ -91,11 +109,11 @@ namespace Results.Entities
|
||||
public virtual float FlowMean { get; set; } /// [m3/h] mean flow from the reference flowmeter
|
||||
public virtual float FlowStart { get; set; } /// [m3/h] flow at the start of test from the reference flowmeter
|
||||
public virtual float FlowEnd { get; set; } /// [m3/h] flow at the end of test from the reference flowmeter
|
||||
public virtual float FlowMin { get; set; } /// [m3/h] not mapped to DB
|
||||
public virtual float FlowMin { get; set; } /// [m3/h]
|
||||
public virtual float FlowMax { get; set; } /// [m3/h]
|
||||
|
||||
public virtual float Custom1 { get; set; } /// [°C] T ref hi mean
|
||||
public virtual float Custom2 { get; set; } /// [°C] T ref hi start
|
||||
public virtual float Custom2 { get; set; } /// [°C] T ref hi start
|
||||
public virtual float Custom3 { get; set; } /// [°C] T ref hi end
|
||||
public virtual float Custom4 { get; set; } /// [°C] T ref hi min
|
||||
public virtual float Custom5 { get; set; } /// [°C] T ref hi max
|
||||
@@ -113,10 +131,63 @@ namespace Results.Entities
|
||||
public virtual double TargetVolume() { return TestData.TargetVolume; }
|
||||
public virtual double TargetTime() { return TestData.TargetTime; }
|
||||
public virtual string Method() { return TestData.Method; }
|
||||
public virtual double ErrLimLo() { return TestData.ErrLimLo; }
|
||||
public virtual double ErrLimHi() { return TestData.ErrLimHi; }
|
||||
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection")) : true; }
|
||||
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; }
|
||||
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
|
||||
public virtual bool IsDiverter() { return (MethodClass != null) ? (MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) : true; }
|
||||
|
||||
public virtual double ErrLimLo()
|
||||
{
|
||||
if (TestData.ErrLimLo <= TestData.ErrLimHi)
|
||||
{
|
||||
return TestData.ErrLimLo; /// Error limit of a water meter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(TestData.ErrLimLo);
|
||||
double Qp = Math.Abs(TestData.ErrLimHi);
|
||||
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
{
|
||||
default:
|
||||
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
|
||||
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
|
||||
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double ErrLimHi()
|
||||
{
|
||||
if (TestData.ErrLimLo <= TestData.ErrLimHi)
|
||||
{
|
||||
return TestData.ErrLimHi; /// Error limit of a water meter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Metrological class and nominal flow of a heat meter
|
||||
int metrClass = (int)Math.Round(TestData.ErrLimLo);
|
||||
double Qp = Math.Abs(TestData.ErrLimHi);
|
||||
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
|
||||
|
||||
/// Calculate the error limit of a heat meter
|
||||
switch (metrClass)
|
||||
{
|
||||
default:
|
||||
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
|
||||
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
|
||||
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual double Uncertainty() { return TestData.Uncertainty; }
|
||||
public virtual bool Evaluate() { return TestData.Evaluate; }
|
||||
public virtual float TempLimLo() { return TestData.TempLimLo; }
|
||||
public virtual float TempLimHi() { return TestData.TempLimHi; }
|
||||
public virtual bool Evaluate() { return TestData.Evaluate; }
|
||||
public virtual Config.Entities.Publish Publish() { return (Config.Entities.Publish)TestData.Publish; }
|
||||
|
||||
|
||||
@@ -140,20 +211,22 @@ namespace Results.Entities
|
||||
Components = src.Components; /// ???
|
||||
Part = src.Part;
|
||||
RepetitionNr = src.RepetitionNr;
|
||||
TestDone = src.TestDone;
|
||||
MethodClass = src.MethodClass;
|
||||
TestDone = src.TestDone;
|
||||
Remark = src.Remark;
|
||||
StartTime = src.StartTime;
|
||||
EndTime = src.EndTime;
|
||||
FlowSetTime = src.FlowSetTime;
|
||||
TestTime = src.TestTime;
|
||||
PulsesMaster = src.PulsesMaster;
|
||||
ConstMasterRaw = src.ConstMasterRaw;
|
||||
ConstMaster = src.ConstMaster;
|
||||
MassStartRaw = src.MassStartRaw;
|
||||
MassStart = src.MassStart;
|
||||
MassEndRaw = src.MassEndRaw;
|
||||
MassEnd = src.MassEnd;
|
||||
DensityIn = src.DensityIn;
|
||||
DensityOut = src.DensityOut;
|
||||
DensityLine = src.DensityLine;
|
||||
DensityDiv = src.DensityDiv;
|
||||
Buoyancy = src.Buoyancy;
|
||||
FlowMass = src.FlowMass;
|
||||
@@ -161,6 +234,10 @@ namespace Results.Entities
|
||||
VolumeCTV = src.VolumeCTV;
|
||||
VolumeMaster = src.VolumeMaster;
|
||||
ErrorMaster = src.ErrorMaster;
|
||||
DiverterStart = src.DiverterStart;
|
||||
DiverterEnd = src.DiverterEnd;
|
||||
ErrorFlags = src.ErrorFlags;
|
||||
ErrorFlagsMd = src.ErrorFlagsMd;
|
||||
RefEnergy = src.RefEnergy;
|
||||
AmbTempMean = src.AmbTempMean;
|
||||
AmbTempStart = src.AmbTempStart;
|
||||
@@ -224,9 +301,47 @@ namespace Results.Entities
|
||||
Custom10 = src.Custom10;
|
||||
}
|
||||
|
||||
/// <summary> Wrapper </summary>
|
||||
public virtual Config.Entities.ErrorFlagsMode ErrorFlagsMode()
|
||||
{
|
||||
return (Config.Entities.ErrorFlagsMode)ErrorFlagsMd;
|
||||
}
|
||||
|
||||
/// <summary> Wrapper </summary>
|
||||
public virtual string ErrorFlagsStr()
|
||||
{
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlags);
|
||||
#if LANG_PL
|
||||
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
|
||||
#else
|
||||
return eFlags;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string ToString(int i)
|
||||
{
|
||||
return string.Format("TestRslt: Part={0} RepetitionNr={1} TestDone={2} Remark={3} StartTime={4} EndTime={5} FlowSetTime={6} TestTime={7} PulsesMaster={8} ConstMaster={9} MassStartRaw={10} MassStart={11} MassEndRaw={12} MassEnd={13} DensityIn={14} DensityOut={15} DensityDiv={16} Buoyancy={17} FlowMass={18} FlowVolume={19} VolumeCTV={20} VolumeMaster={21} ErrorMaster={22} DiverterStart={85} DiverterEnd={86} ErrorFlags={23} ErrorFlagsMd={24} AmbTempMean={25} AmbTempStart={26} AmbTempEnd={27} AmbTempMin={28} AmbTempMax={29} AmbPressMean={30} AmbPressStart={31} AmbPressEnd={32} AmbPressMin={33} AmbPressMax={34} AmbHumiMean={35} AmbHumiStart={36} AmbHumiEnd={37} AmbHumiMin={38} AmbHumiMax={39} PressUpMean={40} PressUpStart={41} PressUpEnd={42} PressUpMin={43} PressUpMax={44} PressDownMean={45} PressDownStart={46} PressDownEnd={47} PressDownMin={48} PressDownMax={49} PressDeltaMean={50} PressDeltaStart={51} PressDeltaEnd={52} PressDeltaMin={53} PressDeltaMax={54} TempUpMean={55} TempUpStart={56} TempUpEnd={57} TempUpMin={58} TempUpMax={59} TempDownMean={60} TempDownStart={61} TempDownEnd={62} TempDownMin={63} TempDownMax={64} TempDivMean={65} TempDivStart={66} TempDivEnd={67} TempDivMin={68} TempDivMax={69} FlowMean={70} FlowStart={71} FlowEnd={72} FlowMin={73} FlowMax={74} Custom1={75} Custom2={76} Custom3={77} Custom4={78} Custom5={79} Custom6={80} Custom7={81} Custom8={82} Custom9={83} Custom10={84}",
|
||||
Part, RepetitionNr, TestDone, Remark, StartTime, EndTime, FlowSetTime, TestTime,
|
||||
PulsesMaster, ConstMaster, MassStartRaw, MassStart, MassEndRaw, MassEnd,
|
||||
DensityIn, DensityLine, DensityDiv, Buoyancy, FlowMass, FlowVolume,
|
||||
VolumeCTV, VolumeMaster, ErrorMaster, ErrorFlags, ErrorFlagsMd,
|
||||
AmbTempMean, AmbTempStart, AmbTempEnd, AmbTempMin, AmbTempMax,
|
||||
AmbPressMean, AmbPressStart, AmbPressEnd, AmbPressMin, AmbPressMax,
|
||||
AmbHumiMean, AmbHumiStart, AmbHumiEnd, AmbHumiMin, AmbHumiMax,
|
||||
PressUpMean, PressUpStart, PressUpEnd, PressUpMin, PressUpMax,
|
||||
PressDownMean, PressDownStart, PressDownEnd, PressDownMin, PressDownMax,
|
||||
PressDeltaMean, PressDeltaStart, PressDeltaEnd, PressDeltaMin, PressDeltaMax,
|
||||
TempUpMean, TempUpStart, TempUpEnd, TempUpMin, TempUpMax,
|
||||
TempDownMean, TempDownStart, TempDownEnd, TempDownMin, TempDownMax,
|
||||
TempDivMean, TempDivStart, TempDivEnd, TempDivMin, TempDivMax,
|
||||
FlowMean, FlowStart, FlowEnd, FlowMin, FlowMax,
|
||||
Custom1, Custom2, Custom3, Custom4, Custom5, Custom6, Custom7, Custom8, Custom9, Custom10,
|
||||
DiverterStart, DiverterEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+156
-16
@@ -8,7 +8,37 @@ using Config.Entities;
|
||||
|
||||
namespace Results.Entities
|
||||
{
|
||||
public class WaterMeter
|
||||
|
||||
public enum ResultCode
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Bit16 = (1 << 16),
|
||||
Bit17 = (1 << 17),
|
||||
Bit18 = (1 << 18),
|
||||
Bit19 = (1 << 19),
|
||||
RfidErrorCodeMask = (Bit16 | Bit17 | Bit18 | Bit19), /// RFID comm. err. (the first encounetered error is stored)
|
||||
|
||||
Bit20 = (1 << 20),
|
||||
Bit21 = (1 << 21),
|
||||
Bit22 = (1 << 22),
|
||||
Bit23 = (1 << 23),
|
||||
RfidErrorTestIdMask = (Bit20 | Bit21 | Bit22 | Bit23), /// RFID comm. err. (the first encounetered error is stored)
|
||||
|
||||
MissingOptoData = (1 << 24),
|
||||
OptoDataWithZeroFlow = (1 << 25),
|
||||
OptoErrorCodeMask = (MissingOptoData | OptoDataWithZeroFlow), /// Opto comm. err. (the first encounetered error is stored)
|
||||
|
||||
Bit26 = (1 << 26),
|
||||
Bit27 = (1 << 27),
|
||||
Bit28 = (1 << 28),
|
||||
Bit29 = (1 << 29),
|
||||
Bit30 = (1 << 30),
|
||||
Bit31 = (1 << 31),
|
||||
}
|
||||
|
||||
|
||||
public class WaterMeter
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter
|
||||
@@ -18,22 +48,25 @@ namespace Results.Entities
|
||||
public virtual int WMPosition { get; set; }
|
||||
public virtual string EndState { get; set; } /// End state (of the main water meter)
|
||||
public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter
|
||||
public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter
|
||||
public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter or 'sensitivity' of a single meter
|
||||
public virtual double QFall { get; set; } /// [m3/h] detected Q_fall of a composed meter
|
||||
public virtual bool Passed { get; set; }
|
||||
public virtual int ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16
|
||||
public virtual bool Passed { get; set; }
|
||||
public virtual int ResultCode { get; set; }
|
||||
public virtual string ArchivePath { get; set; }
|
||||
public virtual string Remark { get; set; }
|
||||
|
||||
#if IPERL
|
||||
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
|
||||
public virtual double OrigCalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual double Q2Correction { get; set; } /// !!! obsolete
|
||||
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
public virtual double Diff2Hz8Hz { get; set; }
|
||||
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
@@ -55,6 +88,7 @@ namespace Results.Entities
|
||||
public virtual string Producer() { return WaterMeterData.Producer; }
|
||||
public virtual string MetrologicalClass() { return WaterMeterData.MetrologicalClass; }
|
||||
public virtual string ApprovalInfo() { return WaterMeterData.ApprovalInfo; }
|
||||
public virtual bool NewQnames() { return WaterMeterData.NewQnames; }
|
||||
public virtual double Q4_Qmax() { return WaterMeterData.Q4_Qmax; }
|
||||
public virtual double Q3_Qn() { return WaterMeterData.Q3_Qn; }
|
||||
public virtual double Q2_Qt() { return WaterMeterData.Q2_Qt; }
|
||||
@@ -79,9 +113,77 @@ namespace Results.Entities
|
||||
public virtual MeterTestRslt LastMeterTestRslts() { return lastMeterTestRslts; }
|
||||
|
||||
|
||||
public virtual int ErrorFlagsFromTests(out ErrorFlagsMode errorFlagsMode)
|
||||
{
|
||||
int errorFlags = 0;
|
||||
ErrorFlagsMode eFlagsMode = 0; /// = ErrorFlagsMode.Off;
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.Evaluate() && mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
|
||||
if ((int)mtr.TestRslt.ErrorFlagsMode() > (int)eFlagsMode) eFlagsMode = mtr.TestRslt.ErrorFlagsMode();
|
||||
}
|
||||
errorFlagsMode = eFlagsMode; /// Maximum from all tests (=ErrorFlagsMode.On if at least one test is ErrorFlagsMode.On)
|
||||
return errorFlags;
|
||||
}
|
||||
|
||||
public virtual int ErrorFlagsFromTestsAndWM(out ErrorFlagsMode errorFlagsMode)
|
||||
{
|
||||
int eFlagsFromTests = ErrorFlagsFromTests(out errorFlagsMode) | ErrorFlags;
|
||||
return (errorFlagsMode != ErrorFlagsMode.Off) ? (eFlagsFromTests | ErrorFlags) : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert combined errorFlags of all tests to string
|
||||
/// </summary>
|
||||
/// <returns>ErrorFlags string</returns>
|
||||
public virtual string ErrorFlagsStr()
|
||||
{
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
#if LANG_PL
|
||||
return string.IsNullOrEmpty(eFlags) ? "brak" : eFlags;
|
||||
#else
|
||||
return eFlags;
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual string PassedOrErrorFlagsStr()
|
||||
{
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
|
||||
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert failed tests and combined errorFlags of all tests to string
|
||||
/// </summary>
|
||||
/// <returns>ErrorFlagsEx string</returns>
|
||||
public virtual string ErrorFlagsStrEx()
|
||||
{
|
||||
StringBuilder errFlgsStr = new StringBuilder();
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.Evaluate() && mtr.TestDone && !mtr.Passed)
|
||||
{
|
||||
errFlgsStr.Append(mtr.Name());
|
||||
errFlgsStr.Append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
ErrorFlagsMode errorFlagsMode;
|
||||
errFlgsStr.Append(Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode)));
|
||||
|
||||
return errFlgsStr.ToString();
|
||||
}
|
||||
|
||||
public virtual bool PassedFromTests()
|
||||
{
|
||||
ErrorFlagsMode eFlagsMode;
|
||||
int eFlags = ErrorFlagsFromTestsAndWM(out eFlagsMode);
|
||||
|
||||
bool passed = true;
|
||||
if (eFlagsMode == ErrorFlagsMode.On && eFlags != 0) passed = false;
|
||||
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.Evaluate() && (!mtr.Passed || !mtr.TestDone))
|
||||
@@ -90,6 +192,7 @@ namespace Results.Entities
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return passed;
|
||||
}
|
||||
|
||||
@@ -108,16 +211,22 @@ namespace Results.Entities
|
||||
}
|
||||
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
#if PUCHONG_PT200
|
||||
return Passed ? "OK|Green" : "NG|Red";
|
||||
#else
|
||||
return Passed ? "OK|Green" : "NOK|Red";
|
||||
#endif
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
{
|
||||
return Utils.PassedColorStr(Passed, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
|
||||
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// Not mapped to the database
|
||||
///
|
||||
@@ -165,6 +274,21 @@ namespace Results.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool TryGetTestRslt(string testName, out TestRslt testRslt)
|
||||
{
|
||||
MeterTestRslt mtr = GetMeterTestRslt(testName);
|
||||
if (mtr != null)
|
||||
{
|
||||
testRslt = mtr.TestRslt;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testRslt = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual TestData GetTestData(string testName)
|
||||
{
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
@@ -177,6 +301,21 @@ namespace Results.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool TryGetTestData(string testName, out TestData testData)
|
||||
{
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
{
|
||||
if (mtr.TestRslt.TestData.Name == testName)
|
||||
{
|
||||
testData = mtr.TestRslt.TestData;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
testData = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -201,6 +340,7 @@ namespace Results.Entities
|
||||
EndStateAux = src.EndStateAux;
|
||||
QRise = src.QRise;
|
||||
QFall = src.QFall;
|
||||
ErrorFlags = src.ErrorFlags;
|
||||
Passed = src.Passed;
|
||||
ResultCode = src.ResultCode;
|
||||
ArchivePath = src.ArchivePath;
|
||||
@@ -212,8 +352,8 @@ namespace Results.Entities
|
||||
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
|
||||
Q2CorrectionDone = src.Q2CorrectionDone;
|
||||
Q2Correction = src.Q2Correction;
|
||||
Q2CorrRFlow = src.Q2CorrRFlow;
|
||||
Q2CorrLFlow = src.Q2CorrLFlow;
|
||||
Q2CorrRL = src.Q2CorrRL;
|
||||
Q2CorrLR = src.Q2CorrLR;
|
||||
Q2CorrFlowRight = src.Q2CorrFlowRight;
|
||||
Diff2Hz8Hz = src.Diff2Hz8Hz;
|
||||
Hz2CorrectionDone = src.Hz2CorrectionDone;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,7 +17,8 @@ namespace Results.Entities
|
||||
public virtual double DN { get; set; } /// [mm]
|
||||
public virtual double L { get; set; } /// [mm]
|
||||
public virtual Config.Entities.Mounting Mounting { get; set; } /// H / V / S / F
|
||||
|
||||
|
||||
public virtual bool NewQnames { get; set; } /// Yes = Q3... No = Qn...
|
||||
public virtual double Q4_Qmax { get; set; } /// [m3/h]
|
||||
public virtual double Q3_Qn { get; set; } /// [m3/h]
|
||||
public virtual double Q2_Qt { get; set; } /// [m3/h]
|
||||
@@ -40,6 +41,8 @@ namespace Results.Entities
|
||||
public virtual string MetrologicalClassAux { get; set; }
|
||||
public virtual string ApprovalInfoAux { get; set; }
|
||||
|
||||
public virtual Config.Entities.Medium Medium { get; set; }
|
||||
|
||||
public virtual string Text1 { get; set; }
|
||||
public virtual string Text2 { get; set; }
|
||||
public virtual string Text3 { get; set; }
|
||||
@@ -73,6 +76,7 @@ namespace Results.Entities
|
||||
if (L != wmd.L) return false;
|
||||
if (Mounting != wmd.Mounting) return false;
|
||||
|
||||
if (NewQnames != wmd.NewQnames) return false;
|
||||
if (Q4_Qmax != wmd.Q4_Qmax) return false;
|
||||
if (Q3_Qn != wmd.Q3_Qn) return false;
|
||||
if (Q2_Qt != wmd.Q2_Qt) return false;
|
||||
@@ -94,6 +98,8 @@ namespace Results.Entities
|
||||
if (MetrologicalClassAux != wmd.MetrologicalClassAux) return false;
|
||||
if (ApprovalInfoAux != wmd.ApprovalInfoAux) return false;
|
||||
|
||||
if (Medium != wmd.Medium) return false;
|
||||
|
||||
if (Text1 != wmd.Text1) return false;
|
||||
if (Text2 != wmd.Text2) return false;
|
||||
if (Text3 != wmd.Text3) return false;
|
||||
|
||||
@@ -150,17 +150,17 @@ namespace Results.Forms
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
if (TestsArrangement == TestsArrangement.Rows)
|
||||
ListView lview = (TestsArrangement == TestsArrangement.Rows)
|
||||
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
|
||||
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
|
||||
if (lview != null)
|
||||
{
|
||||
ListView lview = GetResultsTestsAreRows(results.WaterMeters[i], i + 1);
|
||||
if (first) { firstListView = lview; first = false; }
|
||||
if (lview != null) flowLayoutPanel.Controls.Add(lview);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListView lview = GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
|
||||
if (first) { firstListView = lview; first = false; }
|
||||
if (lview != null) flowLayoutPanel.Controls.Add(lview);
|
||||
flowLayoutPanel.Controls.Add(lview);
|
||||
if (first)
|
||||
{
|
||||
firstListView = lview;
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ namespace Results.Forms
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static class ListViewExtensions
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct HDITEM
|
||||
{
|
||||
public Mask mask;
|
||||
public int cxy;
|
||||
[MarshalAs(UnmanagedType.LPTStr)]
|
||||
public string pszText;
|
||||
public IntPtr hbm;
|
||||
public int cchTextMax;
|
||||
public Format fmt;
|
||||
public IntPtr lParam;
|
||||
// _WIN32_IE >= 0x0300
|
||||
public int iImage;
|
||||
public int iOrder;
|
||||
// _WIN32_IE >= 0x0500
|
||||
public uint type;
|
||||
public IntPtr pvFilter;
|
||||
// _WIN32_WINNT >= 0x0600
|
||||
public uint state;
|
||||
|
||||
[Flags]
|
||||
public enum Mask
|
||||
{
|
||||
Format = 0x4, // HDI_FORMAT
|
||||
};
|
||||
|
||||
[Flags]
|
||||
public enum Format
|
||||
{
|
||||
SortDown = 0x200, // HDF_SORTDOWN
|
||||
SortUp = 0x400, // HDF_SORTUP
|
||||
};
|
||||
};
|
||||
|
||||
public const int LVM_FIRST = 0x1000;
|
||||
public const int LVM_GETHEADER = LVM_FIRST + 31;
|
||||
|
||||
public const int HDM_FIRST = 0x1200;
|
||||
public const int HDM_GETITEM = HDM_FIRST + 11;
|
||||
public const int HDM_SETITEM = HDM_FIRST + 12;
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam);
|
||||
|
||||
public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order)
|
||||
{
|
||||
IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
|
||||
for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++)
|
||||
{
|
||||
var columnPtr = new IntPtr(columnNumber);
|
||||
var item = new HDITEM
|
||||
{
|
||||
mask = HDITEM.Mask.Format
|
||||
};
|
||||
|
||||
if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
if (order != SortOrder.None && columnNumber == columnIndex)
|
||||
{
|
||||
switch (order)
|
||||
{
|
||||
case SortOrder.Ascending:
|
||||
item.fmt &= ~HDITEM.Format.SortDown;
|
||||
item.fmt |= HDITEM.Format.SortUp;
|
||||
break;
|
||||
|
||||
case SortOrder.Descending:
|
||||
item.fmt &= ~HDITEM.Format.SortUp;
|
||||
item.fmt |= HDITEM.Format.SortDown;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp;
|
||||
}
|
||||
|
||||
if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public class LviIntColumnComparer : IComparer
|
||||
{
|
||||
int column;
|
||||
SortOrder order;
|
||||
|
||||
public LviIntColumnComparer()
|
||||
{
|
||||
column = 0;
|
||||
order = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
public LviIntColumnComparer(int column, SortOrder order)
|
||||
{
|
||||
this.column = column;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
|
||||
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
|
||||
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public class LviTextColumnComparer : IComparer
|
||||
{
|
||||
private int column;
|
||||
SortOrder order;
|
||||
|
||||
public LviTextColumnComparer()
|
||||
{
|
||||
column = 0;
|
||||
order = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
public LviTextColumnComparer(int column, SortOrder order)
|
||||
{
|
||||
this.column = column;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
string txtX = ((ListViewItem)x).SubItems[column].Text;
|
||||
string txtY = ((ListViewItem)y).SubItems[column].Text;
|
||||
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
|
||||
}
|
||||
}
|
||||
}
|
||||
+205
-204
@@ -28,210 +28,211 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.availableTabControl = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.availableByCategoryTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
|
||||
this.removeAllButton = new System.Windows.Forms.Button();
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.selectedResultsLabel = new System.Windows.Forms.Label();
|
||||
this.availableResultsLabel = new System.Windows.Forms.Label();
|
||||
this.availableTabControl.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// availableTabControl
|
||||
//
|
||||
this.availableTabControl.Controls.Add(this.tabPage1);
|
||||
this.availableTabControl.Controls.Add(this.tabPage2);
|
||||
this.availableTabControl.Controls.Add(this.tabPage3);
|
||||
this.availableTabControl.Enabled = false;
|
||||
this.availableTabControl.Location = new System.Drawing.Point(9, 33);
|
||||
this.availableTabControl.Name = "availableTabControl";
|
||||
this.availableTabControl.SelectedIndex = 0;
|
||||
this.availableTabControl.Size = new System.Drawing.Size(206, 453);
|
||||
this.availableTabControl.TabIndex = 59;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.availableByQuantityTreeView);
|
||||
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(198, 427);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "A...Z";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableAlphabeticTreeView
|
||||
//
|
||||
this.availableByQuantityTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByQuantityTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableByQuantityTreeView.Name = "availableAlphabeticTreeView";
|
||||
this.availableByQuantityTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableByQuantityTreeView.TabIndex = 0;
|
||||
this.availableByQuantityTreeView.DoubleClick += new System.EventHandler(this.availableByQuantityTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.availableByCategoryTreeView);
|
||||
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(198, 427);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "by quantity";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableByQuantityTreeView
|
||||
//
|
||||
this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByCategoryTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableByCategoryTreeView.Name = "availableByQuantityTreeView";
|
||||
this.availableByCategoryTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableByCategoryTreeView.TabIndex = 0;
|
||||
this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.availableAlphabeticTreeView);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Size = new System.Drawing.Size(198, 427);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "by category";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableByCategoryTreeView
|
||||
//
|
||||
this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableAlphabeticTreeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.availableAlphabeticTreeView.Name = "availableByCategoryTreeView";
|
||||
this.availableAlphabeticTreeView.Size = new System.Drawing.Size(198, 427);
|
||||
this.availableAlphabeticTreeView.TabIndex = 0;
|
||||
this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
|
||||
//
|
||||
// downButton
|
||||
//
|
||||
this.downButton.Enabled = false;
|
||||
this.downButton.Location = new System.Drawing.Point(221, 351);
|
||||
this.downButton.Name = "downButton";
|
||||
this.downButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.downButton.TabIndex = 58;
|
||||
this.downButton.Text = "Down";
|
||||
this.downButton.UseVisualStyleBackColor = true;
|
||||
this.downButton.Click += new System.EventHandler(this.downButton_Click);
|
||||
//
|
||||
// upButton
|
||||
//
|
||||
this.upButton.Enabled = false;
|
||||
this.upButton.Location = new System.Drawing.Point(221, 315);
|
||||
this.upButton.Name = "upButton";
|
||||
this.upButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.upButton.TabIndex = 57;
|
||||
this.upButton.Text = "Up";
|
||||
this.upButton.UseVisualStyleBackColor = true;
|
||||
this.upButton.Click += new System.EventHandler(this.upButton_Click);
|
||||
//
|
||||
// selectedResultsListViewEx
|
||||
//
|
||||
this.selectedResultsListViewEx.AllowColumnReorder = true;
|
||||
this.selectedResultsListViewEx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectedResultsListViewEx.DoubleClickActivation = false;
|
||||
this.selectedResultsListViewEx.Enabled = false;
|
||||
this.selectedResultsListViewEx.FullRowSelect = true;
|
||||
this.selectedResultsListViewEx.GridLines = true;
|
||||
this.selectedResultsListViewEx.Location = new System.Drawing.Point(322, 33);
|
||||
this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
|
||||
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 453);
|
||||
this.selectedResultsListViewEx.TabIndex = 56;
|
||||
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.selectedResultsListViewEx.DoubleClick += new System.EventHandler(this.selectedResultsListViewEx_DoubleClick);
|
||||
//
|
||||
// removeAllButton
|
||||
//
|
||||
this.removeAllButton.Enabled = false;
|
||||
this.removeAllButton.Location = new System.Drawing.Point(221, 223);
|
||||
this.removeAllButton.Name = "removeAllButton";
|
||||
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
|
||||
this.removeAllButton.TabIndex = 55;
|
||||
this.removeAllButton.Text = "<< R&emove all";
|
||||
this.removeAllButton.UseVisualStyleBackColor = true;
|
||||
this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.Enabled = false;
|
||||
this.removeButton.Location = new System.Drawing.Point(221, 188);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.removeButton.TabIndex = 54;
|
||||
this.removeButton.Text = "< &Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Enabled = false;
|
||||
this.addButton.Location = new System.Drawing.Point(221, 153);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.addButton.TabIndex = 53;
|
||||
this.addButton.Text = "&Add >";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// selectedResultsLabel
|
||||
//
|
||||
this.selectedResultsLabel.AutoSize = true;
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(321, 11);
|
||||
this.selectedResultsLabel.Name = "selectedResultsLabel";
|
||||
this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.selectedResultsLabel.TabIndex = 52;
|
||||
this.selectedResultsLabel.Text = "Selected results:";
|
||||
//
|
||||
// availableResultsLabel
|
||||
//
|
||||
this.availableResultsLabel.AutoSize = true;
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(11, 11);
|
||||
this.availableResultsLabel.Name = "availableResultsLabel";
|
||||
this.availableResultsLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.availableResultsLabel.TabIndex = 51;
|
||||
this.availableResultsLabel.Text = "Available results:";
|
||||
//
|
||||
// ResultsConfigCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.availableTabControl);
|
||||
this.Controls.Add(this.downButton);
|
||||
this.Controls.Add(this.upButton);
|
||||
this.Controls.Add(this.selectedResultsListViewEx);
|
||||
this.Controls.Add(this.removeAllButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.selectedResultsLabel);
|
||||
this.Controls.Add(this.availableResultsLabel);
|
||||
this.Name = "ResultsConfigCtrl";
|
||||
this.Size = new System.Drawing.Size(925, 496);
|
||||
this.Load += new System.EventHandler(this.ResultsConfigCtrl_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ResultsConfigCtrl_KeyPress);
|
||||
this.availableTabControl.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.availableTabControl = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.availableByQuantityTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.availableByCategoryTreeView = new System.Windows.Forms.TreeView();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
|
||||
this.removeAllButton = new System.Windows.Forms.Button();
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.selectedResultsLabel = new System.Windows.Forms.Label();
|
||||
this.availableResultsLabel = new System.Windows.Forms.Label();
|
||||
this.availableTabControl.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// availableTabControl
|
||||
//
|
||||
this.availableTabControl.Controls.Add(this.tabPage1);
|
||||
this.availableTabControl.Controls.Add(this.tabPage2);
|
||||
this.availableTabControl.Controls.Add(this.tabPage3);
|
||||
this.availableTabControl.Enabled = false;
|
||||
this.availableTabControl.Location = new System.Drawing.Point(9, 33);
|
||||
this.availableTabControl.Name = "availableTabControl";
|
||||
this.availableTabControl.SelectedIndex = 0;
|
||||
this.availableTabControl.Size = new System.Drawing.Size(206, 453);
|
||||
this.availableTabControl.TabIndex = 59;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.availableByQuantityTreeView);
|
||||
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(198, 427);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "A...Z";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableByQuantityTreeView
|
||||
//
|
||||
this.availableByQuantityTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByQuantityTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableByQuantityTreeView.Name = "availableByQuantityTreeView";
|
||||
this.availableByQuantityTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableByQuantityTreeView.TabIndex = 0;
|
||||
this.availableByQuantityTreeView.DoubleClick += new System.EventHandler(this.availableByQuantityTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.availableByCategoryTreeView);
|
||||
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(198, 427);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "by quantity";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableByCategoryTreeView
|
||||
//
|
||||
this.availableByCategoryTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableByCategoryTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.availableByCategoryTreeView.Name = "availableByCategoryTreeView";
|
||||
this.availableByCategoryTreeView.Size = new System.Drawing.Size(192, 421);
|
||||
this.availableByCategoryTreeView.TabIndex = 0;
|
||||
this.availableByCategoryTreeView.DoubleClick += new System.EventHandler(this.availableByCategoryTreeView_DoubleClick);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.availableAlphabeticTreeView);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Size = new System.Drawing.Size(198, 427);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "by category";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// availableAlphabeticTreeView
|
||||
//
|
||||
this.availableAlphabeticTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.availableAlphabeticTreeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.availableAlphabeticTreeView.Name = "availableAlphabeticTreeView";
|
||||
this.availableAlphabeticTreeView.Size = new System.Drawing.Size(198, 427);
|
||||
this.availableAlphabeticTreeView.TabIndex = 0;
|
||||
this.availableAlphabeticTreeView.DoubleClick += new System.EventHandler(this.availableAlphabeticTreeView_DoubleClick);
|
||||
//
|
||||
// downButton
|
||||
//
|
||||
this.downButton.Enabled = false;
|
||||
this.downButton.Location = new System.Drawing.Point(221, 351);
|
||||
this.downButton.Name = "downButton";
|
||||
this.downButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.downButton.TabIndex = 58;
|
||||
this.downButton.Text = "Down";
|
||||
this.downButton.UseVisualStyleBackColor = true;
|
||||
this.downButton.Click += new System.EventHandler(this.downButton_Click);
|
||||
//
|
||||
// upButton
|
||||
//
|
||||
this.upButton.Enabled = false;
|
||||
this.upButton.Location = new System.Drawing.Point(221, 315);
|
||||
this.upButton.Name = "upButton";
|
||||
this.upButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.upButton.TabIndex = 57;
|
||||
this.upButton.Text = "Up";
|
||||
this.upButton.UseVisualStyleBackColor = true;
|
||||
this.upButton.Click += new System.EventHandler(this.upButton_Click);
|
||||
//
|
||||
// selectedResultsListViewEx
|
||||
//
|
||||
this.selectedResultsListViewEx.AllowColumnReorder = true;
|
||||
this.selectedResultsListViewEx.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectedResultsListViewEx.DoubleClickActivation = false;
|
||||
this.selectedResultsListViewEx.Enabled = false;
|
||||
this.selectedResultsListViewEx.FullRowSelect = true;
|
||||
this.selectedResultsListViewEx.GridLines = true;
|
||||
this.selectedResultsListViewEx.Location = new System.Drawing.Point(322, 33);
|
||||
this.selectedResultsListViewEx.Name = "selectedResultsListViewEx";
|
||||
this.selectedResultsListViewEx.Size = new System.Drawing.Size(594, 453);
|
||||
this.selectedResultsListViewEx.TabIndex = 56;
|
||||
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.selectedResultsListViewEx.DoubleClick += new System.EventHandler(this.selectedResultsListViewEx_DoubleClick);
|
||||
//
|
||||
// removeAllButton
|
||||
//
|
||||
this.removeAllButton.Enabled = false;
|
||||
this.removeAllButton.Location = new System.Drawing.Point(221, 223);
|
||||
this.removeAllButton.Name = "removeAllButton";
|
||||
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
|
||||
this.removeAllButton.TabIndex = 55;
|
||||
this.removeAllButton.Text = "<< R&emove all";
|
||||
this.removeAllButton.UseVisualStyleBackColor = true;
|
||||
this.removeAllButton.Visible = false;
|
||||
this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.Enabled = false;
|
||||
this.removeButton.Location = new System.Drawing.Point(221, 188);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.removeButton.TabIndex = 54;
|
||||
this.removeButton.Text = "< &Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Enabled = false;
|
||||
this.addButton.Location = new System.Drawing.Point(221, 153);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.addButton.TabIndex = 53;
|
||||
this.addButton.Text = "&Add >";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// selectedResultsLabel
|
||||
//
|
||||
this.selectedResultsLabel.AutoSize = true;
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(321, 11);
|
||||
this.selectedResultsLabel.Name = "selectedResultsLabel";
|
||||
this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.selectedResultsLabel.TabIndex = 52;
|
||||
this.selectedResultsLabel.Text = "Selected results:";
|
||||
//
|
||||
// availableResultsLabel
|
||||
//
|
||||
this.availableResultsLabel.AutoSize = true;
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(11, 11);
|
||||
this.availableResultsLabel.Name = "availableResultsLabel";
|
||||
this.availableResultsLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.availableResultsLabel.TabIndex = 51;
|
||||
this.availableResultsLabel.Text = "Available results:";
|
||||
//
|
||||
// ResultsConfigCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.availableTabControl);
|
||||
this.Controls.Add(this.downButton);
|
||||
this.Controls.Add(this.upButton);
|
||||
this.Controls.Add(this.selectedResultsListViewEx);
|
||||
this.Controls.Add(this.removeAllButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.selectedResultsLabel);
|
||||
this.Controls.Add(this.availableResultsLabel);
|
||||
this.Name = "ResultsConfigCtrl";
|
||||
this.Size = new System.Drawing.Size(925, 496);
|
||||
this.Load += new System.EventHandler(this.ResultsConfigCtrl_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ResultsConfigCtrl_KeyPress);
|
||||
this.availableTabControl.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
||||
+133
-13
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Results
|
||||
Flow_profile_sensitivity_class, /// 46
|
||||
Approval_info, /// 47
|
||||
Certificate, /// 48
|
||||
Pulses_per_liter, /// 49
|
||||
Pulses_per_liter, /// 49 Water meter constant (water meter data, not used in calculations)
|
||||
Text1, /// 50
|
||||
Text2, /// 51
|
||||
Text3, /// 52
|
||||
@@ -68,10 +68,10 @@ namespace Results
|
||||
WM_Position, /// 58
|
||||
End_state, /// 59
|
||||
Pulses, /// 60
|
||||
Pulses__liter, /// 61
|
||||
Reference_pulses, /// 62
|
||||
Pulse__liter, /// 61 Water meter constant (pulses per liter) specific for one test
|
||||
Reference_pulses_ni, /// 62 Reference pulses gated for specific meter (synchro method)
|
||||
Reference_energy, /// 63
|
||||
Test_bench_ID, /// 64
|
||||
Bench_ID, /// 64 Test bench ID (int) obtained from a component implementing IBenchInfo
|
||||
Program_version, /// 65
|
||||
User_name, /// 66
|
||||
User_nr, /// 67
|
||||
@@ -83,14 +83,14 @@ namespace Results
|
||||
Lite_per_pulse_Read, /// 73
|
||||
Result_code, /// 74
|
||||
Remark, /// 75
|
||||
T_Hi_mean, /// 76
|
||||
T_Hi_start, /// 77
|
||||
T_Hi_end, /// 78
|
||||
T_Hi_avg, /// 79
|
||||
T_Lo_mean, /// 80
|
||||
T_Lo_start, /// 81
|
||||
T_Lo_end, /// 82
|
||||
T_Lo_avg, /// 83
|
||||
T_Hi_mean, /// 76
|
||||
T_Hi_start, /// 77
|
||||
T_Hi_end, /// 78
|
||||
T_Hi_avg, /// 79
|
||||
T_Lo_mean, /// 80
|
||||
T_Lo_start, /// 81
|
||||
T_Lo_end, /// 82
|
||||
T_Lo_avg, /// 83
|
||||
P_delta_mean, /// 84
|
||||
P_delta_start, /// 85
|
||||
P_delta_end, /// 86
|
||||
@@ -149,6 +149,126 @@ namespace Results
|
||||
Buoyancy, /// 132
|
||||
Density_correction, /// 133
|
||||
|
||||
ErrorFlags, /// 134
|
||||
E1, /// 135
|
||||
E2, /// 136
|
||||
E3, /// 137
|
||||
E4, /// 138
|
||||
E5, /// 139
|
||||
E6, /// 140
|
||||
E7, /// 141
|
||||
E8, /// 142
|
||||
E9, /// 143
|
||||
E10, /// 144
|
||||
E11, /// 145
|
||||
E12, /// 146
|
||||
E13, /// 147
|
||||
E14, /// 148
|
||||
E15, /// 149
|
||||
E16, /// 150
|
||||
|
||||
Table_row_nr, /// 151
|
||||
Table_column_nr, /// 152
|
||||
WMRemark, /// 153
|
||||
|
||||
User_description, /// 154
|
||||
Legalizator, /// 155
|
||||
|
||||
Passed_meters_count, /// 156
|
||||
Failed_meters_count, /// 157
|
||||
Passed_seals_count, /// 158
|
||||
|
||||
Diverter_start_time, /// 159
|
||||
Diverter_end_time, /// 160
|
||||
Q_sensitivity, /// 161
|
||||
|
||||
Q_ref_min, /// 162
|
||||
Q_ref_max, /// 163
|
||||
Q_ref_start, /// 164
|
||||
Q_ref_end, /// 165
|
||||
|
||||
Amb_temp_start_end, /// 166
|
||||
Amb_press_start_end, /// 167
|
||||
Amb_humi_start_end, /// 168
|
||||
|
||||
ResultOrErrorFlags, /// 169, PL specific result
|
||||
|
||||
T_up_min, /// 170
|
||||
T_up_max, /// 171
|
||||
T_down_min, /// 172
|
||||
T_down_max, /// 173
|
||||
T_div_min, /// 174
|
||||
T_div_max, /// 175
|
||||
P_up_min, /// 176
|
||||
P_up_max, /// 177
|
||||
P_down_min, /// 178
|
||||
P_down_max, /// 179
|
||||
P_delta_min, /// 180
|
||||
P_delta_max, /// 181
|
||||
|
||||
T_rho_0, /// 182
|
||||
Rho_Wa_calc, /// 183
|
||||
|
||||
Formatted_WM_ID, /// 184, Formated WM ID string:
|
||||
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
|
||||
E21, /// 185
|
||||
|
||||
T_line_mean, /// 186
|
||||
T_line_start, /// 187
|
||||
T_line_end, /// 188
|
||||
T_line_avg, /// 189
|
||||
T_line_min, /// 190
|
||||
T_line_max, /// 191
|
||||
|
||||
ErrorFlagsEx, /// 192
|
||||
RhoDistilledWtrAtMeLineTemp, /// 193
|
||||
ConstMaster, /// 194
|
||||
Reference_pulses, /// 195 Reference pulses not gated
|
||||
spare,
|
||||
Separator, /// 197
|
||||
Test_time_ni, /// 198 Test time for a specific meter (gated in case of a synchro method OR a difference of 2 time stamps)
|
||||
PMax_test_time, /// 199 Pressure test time
|
||||
Start_valve_open_time, /// 200
|
||||
Start_valve_close_time, /// 201
|
||||
Qc, /// 202 Flow for a water meter
|
||||
Degree__liter, /// 203 Water meter constant (degree per liter) specific for one test with camera
|
||||
Camera_angle, /// 204
|
||||
Camera_angle_start, /// 205
|
||||
Camera_angle_end, /// 206
|
||||
|
||||
P_delta_mean_per_mtr, /// 207
|
||||
P_delta_mean_from_up_down, /// 208
|
||||
P_delta_mean_from_up_down_per_mtr, /// 209
|
||||
Timestamp_start, /// 210
|
||||
Timestamp_end, /// 211
|
||||
P_PMax_test_mean, /// 212 PMax test pressure mean of (Pup + Pdown)/2
|
||||
|
||||
Medium, /// 213 Woda zimna/ciepla
|
||||
|
||||
Flow_ctv, /// 214
|
||||
Flow_ctv_min, /// 215
|
||||
Flow_ctv_max, /// 216
|
||||
Flow_ctv_start, /// 217
|
||||
Flow_ctv_end, /// 218
|
||||
ConstMasterRaw, /// 219 ConstMaster (like 194) uncorrected
|
||||
Reference_error_corr, /// 220 Reference flow meter error after correction using correction curve
|
||||
|
||||
Proc_description, /// 221 Procedure description (CEVAK, not mapped to DB)
|
||||
Bench_name, /// 222 'Test bench name' (string) obtained from a component implementing IBenchInfo
|
||||
Bench_address1, /// 223 'Address 1' from IBenchInfo
|
||||
Bench_address2, /// 224 'Address 2' from IBenchInfo
|
||||
Bench_address3, /// 225 'Address 3' from IBenchInfo
|
||||
Bench_address4, /// 226 'Address 4' from IBenchInfo
|
||||
Bench_address5, /// 227 'Address 5' from IBenchInfo
|
||||
|
||||
Max_test_index, /// 228 MaxPruefindex % 100
|
||||
VolumeCTV, /// 229
|
||||
|
||||
/// iPerl
|
||||
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
|
||||
OrigCalibFactorLNA, /// 231
|
||||
CalibFactorLNA, /// 232
|
||||
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Results.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
public class ItemSpec
|
||||
{
|
||||
///
|
||||
/// Public fields
|
||||
///
|
||||
public readonly string Name; /// Name-s of all items must be unique
|
||||
public readonly string ClmnHeaderText; /// Text printed in the column header
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintDlgt(MeterTestRslt meterTestRslt);
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintCompoundDlgt(MeterTestRslt mainMtrTestResult,
|
||||
MeterTestRslt auxMtrTestResult,
|
||||
MeterTestRslt compoundMtrTestResult);
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
public delegate string PrintHeatMeterDlgt(MeterTestRslt volumeTestResult,
|
||||
MeterTestRslt energyTestResult);
|
||||
|
||||
private readonly PrintDlgt printDlgt;
|
||||
private readonly PrintCompoundDlgt printCompoundDlgt;
|
||||
private readonly PrintHeatMeterDlgt printHeatMeterDlgt;
|
||||
|
||||
public bool CanPrintSingle { get { return (printDlgt != null); } }
|
||||
public bool CanPrintCompoundMeter { get { return (printCompoundDlgt != null); } }
|
||||
public bool CanPrintHeatMeter { get { return (printHeatMeterDlgt != null); } }
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string Print(MeterTestRslt meterTestRslt)
|
||||
{
|
||||
string str = null;
|
||||
if (printDlgt != null) str = printDlgt(meterTestRslt);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintCombined(MeterTestRslt mainMtrTestResult,
|
||||
MeterTestRslt auxMtrTestResult,
|
||||
MeterTestRslt compoundMtrTestResult)
|
||||
{
|
||||
string str = null;
|
||||
if (printCompoundDlgt != null) str = printCompoundDlgt(mainMtrTestResult, auxMtrTestResult, compoundMtrTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
/// <summary> Safe wrapper which replaces null-s by empty strings </summary>
|
||||
public string PrintHeatMeter(MeterTestRslt volumeTestResult,
|
||||
MeterTestRslt energyTestResult)
|
||||
{
|
||||
string str = null;
|
||||
if (printHeatMeterDlgt != null) str = printHeatMeterDlgt(volumeTestResult, energyTestResult);
|
||||
return (str == null) ? string.Empty : str;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Public constructor
|
||||
///
|
||||
public ItemSpec(string name, string clmnHeaderText, PrintDlgt printDlgt, PrintCompoundDlgt printCombinedDlgt, PrintHeatMeterDlgt printHeatMeterDlgt)
|
||||
{
|
||||
Name = name;
|
||||
ClmnHeaderText = clmnHeaderText;
|
||||
this.printDlgt = printDlgt;
|
||||
this.printCompoundDlgt = printCombinedDlgt;
|
||||
this.printHeatMeterDlgt = printHeatMeterDlgt;
|
||||
}
|
||||
|
||||
|
||||
/// Static list of all available items
|
||||
public static readonly IList<ItemSpec> AllItems;
|
||||
|
||||
/// Static constructor that initializes the list of all items
|
||||
static ItemSpec()
|
||||
{
|
||||
AllItems = new List<ItemSpec>();
|
||||
|
||||
/// Common
|
||||
|
||||
//AllItems.Add(new ResultItemSpec("Bench ID", "Bench ID", x => x.BenchID, (x, y, z) => x.BenchID));
|
||||
AllItems.Add(new ItemSpec("Test name", Strings.Test, x => x.Name(), (x, y, z) => z.Name(), (x, z) => z.Name()));
|
||||
AllItems.Add(new ItemSpec("Procedure name", Strings.Procedure, x => x.ProcedureName(), (x, y, z) => z.ProcedureName(), (x, z) => z.ProcedureName()));
|
||||
AllItems.Add(new ItemSpec("Batch number", Strings.Batch_nr, x => x.BatchNr().ToString(), (x, y, z) => z.BatchNr().ToString(), (x, z) => z.BatchNr().ToString()));
|
||||
AllItems.Add(new ItemSpec("Test method", Strings.Test_method, x => x.Method(), (x, y, z) => z.Method(), (x, z) => z.Method()));
|
||||
AllItems.Add(new ItemSpec("Density", Strings.Density, x => x.DensityOut().ToString("F1"), (x, y, z) => z.DensityOut().ToString("F1"), (x, z) => z.DensityOut().ToString("F1"))); /// [kg/m3]
|
||||
|
||||
/// Target values
|
||||
AllItems.Add(new ItemSpec("Q from", Strings.Q_from + " [m3/h]", x => x.Qfrom().ToString("F3"), (x, y, z) => z.Qfrom().ToString("F3"), (x, z) => z.Qfrom().ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Q to", Strings.Q_to + " [m3/h]", x => x.Qto().ToString("F3"), (x, y, z) => z.Qto().ToString("F3"), (x, z) => z.Qto().ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Test volume", Strings.Test_vol + " [l]", x => x.TargetVolume().ToString("F1"), (x, y, z) => z.TargetVolume().ToString("F1"), (x, z) => z.TargetVolume().ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Error limit Lo", Strings.ErrLimLo + " [%]", x => x.ErrLimLo().ToString("F1"), (x, y, z) => z.ErrLimLo().ToString("F1"), (x, z) => z.ErrLimLo().ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Error limit Hi", Strings.ErrLimHi + " [%]", x => x.ErrLimHi().ToString("F1"), (x, y, z) => z.ErrLimHi().ToString("F1"), (x, z) => z.ErrLimHi().ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Uncertainty", Strings.Uncertainty + " [%]", x => x.Uncertainty().ToString("F2"), (x, y, z) => z.Uncertainty().ToString("F2"), (x, z) => z.Uncertainty().ToString("F2")));
|
||||
|
||||
/// Test results
|
||||
AllItems.Add(new ItemSpec("Test start time", Strings.T_start, x => x.StartTime().ToShortTimeString(), (x, y, z) => z.StartTime().ToShortTimeString(), (x, z) => z.StartTime().ToShortTimeString()));
|
||||
AllItems.Add(new ItemSpec("Test end time", Strings.T_end, x => x.EndTime().ToShortTimeString(), (x, y, z) => z.EndTime().ToShortTimeString(), (x, z) => z.EndTime().ToShortTimeString()));
|
||||
AllItems.Add(new ItemSpec("Test time", Strings.T_s, x => x.TestTime.ToString("F2"), (x, y, z) => z.TestTime.ToString("F2"), (x, z) => z.TestTime.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("Flow", Strings.Flow + " [m3/h]", x => Utils.DoubleToStr(x.FlowVolume(), 4), (x, y, z) => Utils.DoubleToStr(z.FlowVolume(), 4), (x, z) => Utils.DoubleToStr(x.FlowVolume(), 4)));
|
||||
AllItems.Add(new ItemSpec("T in", Strings.T_in + " [°C]", x => x.TestRslt.TempUpMean.ToString("F2"), (x, y, z) => z.TestRslt.TempUpMean.ToString("F2"), (x, z) => z.TestRslt.TempUpMean.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("T out", Strings.T_out + " [°C]", x => x.TestRslt.TempDownMean.ToString("F2"), (x, y, z) => z.TestRslt.TempDownMean.ToString("F2"), (x, z) => z.TestRslt.TempDownMean.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("T div", Strings.T_div + " [°C]", x => x.TestRslt.TempDivMean.ToString("F2"), (x, y, z) => z.TestRslt.TempDivMean.ToString("F2"), (x, z) => z.TestRslt.TempDivMean.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("P up", Strings.P_up + " [kPa]", x => (100 * x.TestRslt.PressUpMean).ToString("F3"), (x, y, z) => z.TestRslt.PressUpMean.ToString("F3"), (x, z) => z.TestRslt.PressUpMean.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P up start", Strings.P_up_start + " [kPa]", x => (100 * x.TestRslt.PressUpStart).ToString("F3"), (x, y, z) => z.TestRslt.PressUpStart.ToString("F3"), (x, z) => z.TestRslt.PressUpStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P up end", Strings.P_up_end + " [kPa]", x => (100 * x.TestRslt.PressUpEnd).ToString("F3"), (x, y, z) => z.TestRslt.PressUpEnd.ToString("F3"), (x, z) => z.TestRslt.PressUpEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P down", Strings.P_dn + " [kPa]", x => (100 * x.TestRslt.PressDownMean).ToString("F3"), (x, y, z) => z.TestRslt.PressDownMean.ToString("F3"), (x, z) => z.TestRslt.PressDownMean.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P down start", Strings.P_dn_start + " [kPa]", x => (100 * x.TestRslt.PressDownStart).ToString("F3"), (x, y, z) => z.TestRslt.PressDownStart.ToString("F3"), (x, z) => z.TestRslt.PressDownStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P down end", Strings.P_dn_end + " [kPa]", x => (100 * x.TestRslt.PressDownEnd).ToString("F3"), (x, y, z) => z.TestRslt.PressDownEnd.ToString("F3"), (x, z) => z.TestRslt.PressDownEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P delta", Strings.P_delta + " [kPa]", x => (100 * x.TestRslt.PressDeltaMean).ToString("F3"), (x, y, z) => z.TestRslt.PressDeltaMean.ToString("F3"), (x, z) => z.TestRslt.PressDeltaMean.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P delta start", Strings.P_delta_start + " [kPa]", x => (100 * x.TestRslt.PressDeltaStart).ToString("F3"), (x, y, z) => z.TestRslt.PressDeltaStart.ToString("F3"), (x, z) => z.TestRslt.PressDeltaStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("P delta end", Strings.P_delta_end + " [kPa]", x => (100 * x.TestRslt.PressDeltaEnd).ToString("F3"), (x, y, z) => z.TestRslt.PressDeltaEnd.ToString("F3"), (x, z) => z.TestRslt.PressDeltaEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Reference error", Strings.ErrRef + " [%]", x => x.TestRslt.ErrorMaster.ToString("F3"), (x, y, z) => z.TestRslt.ErrorMaster.ToString("F3"), (x, z) => z.TestRslt.ErrorMaster.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Ambient temperature", Strings.T_amb + " [°C]", x => x.TestRslt.AmbTempMean.ToString("F1"), (x, y, z) => z.TestRslt.AmbTempMean.ToString("F1"), (x, z) => z.TestRslt.AmbTempMean.ToString("F1")));
|
||||
AllItems.Add(new ItemSpec("Ambient pressure", Strings.P_amb + " [mbar]", x => (1000 * x.TestRslt.AmbPressMean).ToString("F0"), (x, y, z) => (1000 * z.TestRslt.AmbPressMean).ToString("F0"), (x, z) => (1000 * z.TestRslt.AmbPressMean).ToString("F0")));
|
||||
AllItems.Add(new ItemSpec("Ambient humidity", Strings.H_amb + " [%]", x => x.TestRslt.AmbHumiMean.ToString("F1"), (x, y, z) => z.TestRslt.AmbHumiMean.ToString("F1"), (x, z) => z.TestRslt.AmbHumiMean.ToString("F1")));
|
||||
|
||||
/// Single and combined meter results
|
||||
AllItems.Add(new ItemSpec("Start volume", Strings.Start_volume + " [l]", x => x.VolumeStart.ToString("F3"), (x, y, z) => z.VolumeStart.ToString("F3"), (x, z) => z.VolumeStart.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("End volume", Strings.End_volume + " [l]", x => x.VolumeEnd.ToString("F3"), (x, y, z) => z.VolumeEnd.ToString("F3"), (x, z) => z.VolumeEnd.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Volume", Strings.Volume + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => z.VolumeMeter.ToString("F3"), (x, z) => x.VolumeMeter.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Reference volume", Strings.VolRef + " [l]", x => x.VolumeRef.ToString("F3"), (x, y, z) => z.VolumeRef.ToString("F3"), (x, z) => x.VolumeRef.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Error", Strings.Error + " [%]", x => x.Error.ToString("F2"), (x, y, z) => z.Error.ToString("F2"), null));
|
||||
AllItems.Add(new ItemSpec("Passed", Strings.Result, x => x.PassedColorStr(), (x, y, z) => z.PassedColorStr(), null));
|
||||
AllItems.Add(new ItemSpec("Volume Error", "Volume Error" + " [%]", null, null, (x, z) => x.Error.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("Volume Passed", "Volume Passed", null, null, (x, z) => x.PassedColorStr()));
|
||||
AllItems.Add(new ItemSpec("Energy Error", "Energy Error" + " [%]", null, null, (x, z) => z.Error.ToString("F2")));
|
||||
AllItems.Add(new ItemSpec("Energy Passed", "Energy Passed", null, null, (x, z) => z.PassedColorStr()));
|
||||
|
||||
/// Water meter info
|
||||
AllItems.Add(new ItemSpec("Watermeter type", Strings.WM_Type, x => x.WaterMeterData().ProductName, (x, y, z) => z.WaterMeterData().ProductName, (x, z) => z.WaterMeterData().ProductName));
|
||||
AllItems.Add(new ItemSpec("Producer", Strings.Producer, x => x.WaterMeterData().Producer, (x, y, z) => z.WaterMeterData().Producer, (x, z) => z.WaterMeterData().Producer));
|
||||
AllItems.Add(new ItemSpec("Metrological class", Strings.MClass, x => x.WaterMeterData().MetrologicalClass, (x, y, z) => z.WaterMeterData().MetrologicalClass, (x, z) => z.WaterMeterData().MetrologicalClass));
|
||||
AllItems.Add(new ItemSpec("Approval info", Strings.Approval, x => x.WaterMeterData().ApprovalInfo, (x, y, z) => z.WaterMeterData().ApprovalInfo, (x, z) => z.WaterMeterData().ApprovalInfo));
|
||||
AllItems.Add(new ItemSpec("Q4", "Q4 [m3/h]", x => x.WaterMeterData().Q4_Qmax.ToString(), (x, y, z) => z.WaterMeterData().Q4_Qmax.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Q3", "Q3 [m3/h]", x => x.WaterMeterData().Q3_Qn.ToString(), (x, y, z) => z.WaterMeterData().Q3_Qn.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Q2", "Q2 [m3/h]", x => x.WaterMeterData().Q2_Qt.ToString(), (x, y, z) => z.WaterMeterData().Q2_Qt.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Q1", "Q1 [m3/h]", x => x.WaterMeterData().Q1_Qmin.ToString(), (x, y, z) => z.WaterMeterData().Q1_Qmin.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qmax", "Qmax [m3/h]", x => x.WaterMeterData().Q4_Qmax.ToString(), (x, y, z) => z.WaterMeterData().Q4_Qmax.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qn", "Qn [m3/h]", x => x.WaterMeterData().Q3_Qn.ToString(), (x, y, z) => z.WaterMeterData().Q3_Qn.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qt", "Qt [m3/h]", x => x.WaterMeterData().Q2_Qt.ToString(), (x, y, z) => z.WaterMeterData().Q2_Qt.ToString(), null));
|
||||
AllItems.Add(new ItemSpec("Qmin", "Qmin [m3/h]", x => x.WaterMeterData().Q1_Qmin.ToString(), (x, y, z) => z.WaterMeterData().Q1_Qmin.ToString(), null));
|
||||
|
||||
/// Water meters results
|
||||
AllItems.Add(new ItemSpec("Serial Nr", Strings.sn, x => x.WaterMeter.SerialNr, (x, y, z) => z.WaterMeter.SerialNr, (x, z) => z.WaterMeter.SerialNr));
|
||||
AllItems.Add(new ItemSpec("Purchase order", Strings.PO, x => x.WaterMeter.PurchaseOrder, (x, y, z) => z.WaterMeter.PurchaseOrder, (x, z) => z.WaterMeter.PurchaseOrder));
|
||||
AllItems.Add(new ItemSpec("Year of production", Strings.Year, x => x.WaterMeter.YearOfProduction.ToString(), (x, y, z) => z.WaterMeter.YearOfProduction.ToString(), (x, z) => z.WaterMeter.YearOfProduction.ToString()));
|
||||
AllItems.Add(new ItemSpec("WM Position", Strings.Pos, x => x.WaterMeter.WMPosition.ToString(), (x, y, z) => z.WaterMeter.WMPosition.ToString(), (x, z) => z.WaterMeter.WMPosition.ToString()));
|
||||
|
||||
/// Water meters results (single)
|
||||
AllItems.Add(new ItemSpec("End state", Strings.End_state, x => x.EndState(), null, null));
|
||||
AllItems.Add(new ItemSpec("Pulses", Strings.Pulses, x => x.PulsesMeter.ToString(), null, null));
|
||||
AllItems.Add(new ItemSpec("Pulses/liter", Strings.PulsesLiter, x => x.PulsesPerLiter.ToString(), null, null));
|
||||
AllItems.Add(new ItemSpec("Reference pulses", Strings.RefPulses, x => x.PulsesMaster.ToString(), null, null));
|
||||
|
||||
/// Water meters results (combined)
|
||||
AllItems.Add(new ItemSpec("Q rise", Strings.Q_rise + " [m3/h]", null, (x, y, z) => (z.QRise() == 0) ? "-" : Utils.DoubleToStr(z.QRise(), 4), null));
|
||||
AllItems.Add(new ItemSpec("Q fall", Strings.Q_fall + " [m3/h]", null, (x, y, z) => (z.QFall() == 0) ? "-" : Utils.DoubleToStr(z.QFall(), 4), null));
|
||||
AllItems.Add(new ItemSpec("Error large WM", Strings.Err_main + " [%]", null, (x, y, z) => x.Error.ToString("F2"), null));
|
||||
AllItems.Add(new ItemSpec("Error small WM", Strings.Err_aux + " [%]", null, (x, y, z) => y.Error.ToString("F2"), null));
|
||||
AllItems.Add(new ItemSpec("Serial Nr large WM", Strings.sn_main, null, (x, y, z) => x.SerialNr(), null));
|
||||
AllItems.Add(new ItemSpec("Serial Nr small WM", Strings.sn_aux, null, (x, y, z) => y.SerialNr(), null));
|
||||
AllItems.Add(new ItemSpec("End state large WM", Strings.EndState_main, null, (x, y, z) => x.EndState(), null));
|
||||
AllItems.Add(new ItemSpec("End state small WM", Strings.EndState_aux, null, (x, y, z) => y.EndState(), null));
|
||||
AllItems.Add(new ItemSpec("Start volume main", Strings.Start_volume_main + " [l]",x => x.VolumeMeter.ToString("F3"), (x, y, z) => x.VolumeStart.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("End volume main", Strings.End_volume_main + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => x.VolumeEnd.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("Volume main", Strings.Volume_main + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => x.VolumeMeter.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("Start volume aux", Strings.Start_volume_aux + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => y.VolumeStart.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("End volume aux", Strings.End_volume_aux + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => y.VolumeEnd.ToString("F3"), null));
|
||||
AllItems.Add(new ItemSpec("Volume aux", Strings.Volume_aux + " [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => y.VolumeMeter.ToString("F3"), null));
|
||||
|
||||
/// Batch info
|
||||
AllItems.Add(new ItemSpec("Batch number", Strings.Batch_nr, x => x.Batch().BatchNr.ToString(), (x, y, z) => x.Batch().BatchNr.ToString(), (x, z) => x.Batch().BatchNr.ToString()));
|
||||
AllItems.Add(new ItemSpec("Test bench ID", Strings.Bench, x => x.Batch().TestBenchId.ToString(), (x, y, z) => x.Batch().TestBenchId.ToString(), (x, z) => x.Batch().TestBenchId.ToString()));
|
||||
AllItems.Add(new ItemSpec("Program version", Strings.Ver, x => x.Batch().ProgramVersion, (x, y, z) => x.Batch().ProgramVersion, (x, z) => x.Batch().ProgramVersion));
|
||||
AllItems.Add(new ItemSpec("User name", Strings.User, x => x.Batch().UserName, (x, y, z) => x.Batch().UserName, (x, z) => x.Batch().UserName));
|
||||
AllItems.Add(new ItemSpec("User nr.", Strings.User_nr, x => x.Batch().UserNumber.ToString(), (x, y, z) => x.Batch().UserNumber.ToString(), (x, z) => x.Batch().UserNumber.ToString()));
|
||||
AllItems.Add(new ItemSpec("Procedure name", Strings.Procedure, x => x.Batch().ProcedureName, (x, y, z) => x.Batch().ProcedureName, (x, z) => x.Batch().ProcedureName));
|
||||
AllItems.Add(new ItemSpec("Watermeters", Strings.WMs, x => x.Batch().WatermetersStr, (x, y, z) => x.Batch().WatermetersStr, (x, z) => x.Batch().WatermetersStr));
|
||||
AllItems.Add(new ItemSpec("Protocol title", Strings.Protocol, x => x.Batch().ProtocolTitle, (x, y, z) => x.Batch().ProtocolTitle, (x, z) => x.Batch().ProtocolTitle));
|
||||
AllItems.Add(new ItemSpec("Batch start time", Strings.Start, x => x.Batch().StartTime.ToShortTimeString(), (x, y, z) => x.Batch().StartTime.ToShortTimeString(), (x, z) => x.Batch().StartTime.ToShortTimeString()));
|
||||
AllItems.Add(new ItemSpec("Batch end time", Strings.End, x => x.Batch().EndTime.ToShortTimeString(), (x, y, z) => x.Batch().EndTime.ToShortTimeString(), (x, z) => x.Batch().EndTime.ToShortTimeString()));
|
||||
|
||||
/// Heat meters results
|
||||
AllItems.Add(new ItemSpec("Energy", Strings.Energy, null, null, (x, z) => z.VolumeMeter.ToString()));
|
||||
AllItems.Add(new ItemSpec("Reference energy", Strings.Energy_ref, null, null, (x, z) => z.VolumeRef.ToString()));
|
||||
AllItems.Add(new ItemSpec("Temp hi me", "T hi me", null, null, (x, z) => z.TestRslt.Custom1.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp hi st", "T hi st", null, null, (x, z) => z.TestRslt.Custom2.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp hi en", "T hi en", null, null, (x, z) => z.TestRslt.Custom3.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp hi av", "T hi av", null, null, (x, z) => ((z.TestRslt.Custom2 + z.TestRslt.Custom3) / 2).ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo me", "T lo me", null, null, (x, z) => z.TestRslt.Custom6.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo st", "T lo st", null, null, (x, z) => z.TestRslt.Custom7.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo en", "T lo en", null, null, (x, z) => z.TestRslt.Custom8.ToString("F3")));
|
||||
AllItems.Add(new ItemSpec("Temp lo av", "T lo av", null, null, (x, z) => ((z.TestRslt.Custom7 + z.TestRslt.Custom8) / 2).ToString("F3")));
|
||||
|
||||
AllItems.Add(new ItemSpec("Start mass", Strings.Start_mass + " [kg]", x => x.TestRslt.MassStart.ToString("F4"), (x, y, z) => z.TestRslt.MassStart.ToString("F4"), (x, z) => z.TestRslt.MassStart.ToString("F4")));
|
||||
AllItems.Add(new ItemSpec("End mass", Strings.End_mass + " [kg]", x => x.TestRslt.MassEnd.ToString("F4"), (x, y, z) => z.TestRslt.MassEnd.ToString("F4"), (x, z) => z.TestRslt.MassEnd.ToString("F4")));
|
||||
}
|
||||
|
||||
public static ItemSpec GetItem(string name)
|
||||
{
|
||||
foreach (var item in AllItems) if (item.Name.Equals(name)) return item;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string[] ToStrArray(IList<ItemSpec> items)
|
||||
{
|
||||
int count = (items != null) ? items.Count : 0;
|
||||
string[] result = new string[count];
|
||||
for (int i = 0; i < count; i++) result[i] = items[i].Name;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IList<ItemSpec> FromStrArray(string[] strArray)
|
||||
{
|
||||
IList<ItemSpec> result = new List<ItemSpec>();
|
||||
if (strArray != null)
|
||||
{
|
||||
for (int i = 0; i < strArray.Length; i++)
|
||||
{
|
||||
ItemSpec item = GetItem(strArray[i]);
|
||||
if (item != null) result.Add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,10 @@ namespace Results.Mappings
|
||||
Map(x => x.Error);
|
||||
Map(x => x.TestDone);
|
||||
Map(x => x.Passed);
|
||||
|
||||
References(x => x.WaterMeter);
|
||||
#if ORACLE_DB
|
||||
Map(x => x.LastError);
|
||||
#endif
|
||||
References(x => x.WaterMeter);
|
||||
References(x => x.TestRslt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -32,7 +32,7 @@ namespace Results.Mappings
|
||||
Map(x => x.MassEndRaw);
|
||||
Map(x => x.MassEnd);
|
||||
Map(x => x.DensityIn);
|
||||
Map(x => x.DensityOut);
|
||||
Map(x => x.DensityLine).Column("DensityOut");
|
||||
Map(x => x.DensityDiv);
|
||||
Map(x => x.Buoyancy);
|
||||
Map(x => x.FlowMass);
|
||||
@@ -40,6 +40,10 @@ namespace Results.Mappings
|
||||
Map(x => x.VolumeCTV);
|
||||
Map(x => x.VolumeMaster);
|
||||
Map(x => x.ErrorMaster);
|
||||
Map(x => x.DiverterStart);
|
||||
Map(x => x.DiverterEnd);
|
||||
Map(x => x.ErrorFlags);
|
||||
Map(x => x.ErrorFlagsMd);
|
||||
#if HEAT_METERS
|
||||
Map(x => x.RefEnergy);
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -18,6 +18,9 @@ namespace Results.Mappings
|
||||
Map(x => x.L);
|
||||
Map(x => x.Mounting);
|
||||
|
||||
#if MUNICH && LANG_DE
|
||||
Map(x => x.NewQnames);
|
||||
#endif
|
||||
Map(x => x.Q4_Qmax);
|
||||
Map(x => x.Q3_Qn);
|
||||
Map(x => x.Q2_Qt);
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Results.Mappings
|
||||
Map(x => x.EndStateAux);
|
||||
Map(x => x.QRise);
|
||||
Map(x => x.QFall);
|
||||
Map(x => x.ErrorFlags);
|
||||
Map(x => x.Passed);
|
||||
Map(x => x.ResultCode);
|
||||
Map(x => x.ArchivePath);
|
||||
@@ -30,18 +31,24 @@ namespace Results.Mappings
|
||||
Map(x => x.SerialNrEx);
|
||||
Map(x => x.OrigCalibFactor);
|
||||
Map(x => x.CalibFactor);
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.OrigCalibFactorLNA);
|
||||
Map(x => x.CalibFactorLNA);
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.Q2CorrectionDone);
|
||||
Map(x => x.Q2Correction);
|
||||
Map(x => x.Q2CorrRFlow);
|
||||
Map(x => x.Q2CorrLFlow);
|
||||
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
|
||||
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Diff2Hz8Hz);
|
||||
Map(x => x.Hz2CorrectionDone);
|
||||
Map(x => x.Hz2Correction);
|
||||
Map(x => x.FWVersion);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
#if ORACLE_DB
|
||||
Map(x => x.Pruefindex);
|
||||
Map(x => x.HydrPruefung);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
References(x => x.Batch);
|
||||
HasMany(x => x.MeterTestRslts)
|
||||
.Cascade.All();
|
||||
|
||||
@@ -1,446 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.Cevak
|
||||
{
|
||||
enum DocumentSection
|
||||
{
|
||||
FirstPage,
|
||||
OtherPages,
|
||||
Appendix1,
|
||||
Appendix2,
|
||||
Count,
|
||||
}
|
||||
|
||||
public class PrintDocumentCevak : PrintDocument
|
||||
{
|
||||
const string FontFamilyName = "Arial"; //"Times New Roman";
|
||||
|
||||
const int SpacingOne = 18;
|
||||
const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
|
||||
readonly int topMargin;
|
||||
readonly int bottomMargin;
|
||||
readonly int leftMargin;
|
||||
readonly int TitleX;
|
||||
readonly int TitleY; /// Depends on the size of the header
|
||||
readonly int HdrTop; /// = TitleY + 60
|
||||
readonly int BodyTop; /// = HdrTop + 160
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
int printHeight;
|
||||
int printWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font font;
|
||||
Font boldFont;
|
||||
Font titleFont;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
string testBenchName;
|
||||
string address1;
|
||||
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
readonly IList<Results.ItemSpec> rsltItems;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
///
|
||||
DocumentSection documentSection;
|
||||
|
||||
int nrWMsOnFirstPage;
|
||||
int nrWMsOnNextPage;
|
||||
int nextWMNr; /// nr. of watermeter to be printed as the first one on the next page
|
||||
int nrPages;
|
||||
int pageNr; /// Page number to be printed at the bottom of the page
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public PrintDocumentCevak(Results.Entities.Batch batch,
|
||||
PageOrientation pageOrientation,
|
||||
int topMargin, int bottomMargin, int leftMargin,
|
||||
string testBenchName, string address1)
|
||||
{
|
||||
this.batch = batch;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
|
||||
|
||||
this.topMargin = topMargin;
|
||||
this.bottomMargin = bottomMargin;
|
||||
this.leftMargin = leftMargin;
|
||||
|
||||
this.testBenchName = testBenchName;
|
||||
this.address1 = address1;
|
||||
|
||||
TitleX = leftMargin;
|
||||
TitleY = topMargin; /// Depends on the size of the header
|
||||
HdrTop = TitleY + 60;
|
||||
BodyTop = HdrTop + 250;
|
||||
|
||||
rsltItems = Results.ItemSpec.FromStrArray(new string[] {
|
||||
"Test name",
|
||||
"Volume",
|
||||
"Reference volume",
|
||||
"Test time",
|
||||
"Flow",
|
||||
"Error",
|
||||
"Passed",
|
||||
//"Reference error", // ?
|
||||
});
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
if (DefaultPageSettings.Landscape)
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
|
||||
}
|
||||
else
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always) testsCount++;
|
||||
}
|
||||
|
||||
if (batch.WaterMeters[0].Compound()) testsCount /= 3;
|
||||
|
||||
int wmSectionHeight = (testsCount + 4) * SpacingOne;
|
||||
|
||||
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;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
documentSection = DocumentSection.FirstPage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
|
||||
if (font == null) { font = new Font(FontFamilyName, 10, FontStyle.Regular); }
|
||||
if (boldFont == null) { boldFont = new Font(FontFamilyName, 10, FontStyle.Bold); }
|
||||
if (titleFont == null) { titleFont = new Font(FontFamilyName, 18, FontStyle.Bold); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
|
||||
if (documentSection != DocumentSection.OtherPages)
|
||||
{
|
||||
///----------
|
||||
/// Header
|
||||
///----------
|
||||
if (documentSection == DocumentSection.FirstPage)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, 40);
|
||||
e.Graphics.DrawString(batch.ProtocolTitle, titleFont, Brushes.Black, printArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintAt(e, TitleX, TitleY, batch.ProtocolTitle);
|
||||
}
|
||||
|
||||
string[] leftColumn = new string[]
|
||||
{
|
||||
"Protokol č.: ",
|
||||
"Zákazník: ",
|
||||
"Datum a čas: ",
|
||||
"Procedura: ",
|
||||
"Popis procedury: ",
|
||||
"Typ vodoměru: ",
|
||||
"Zkoušející: ",
|
||||
"Název zkušební stanice: ",
|
||||
"Zkušební SW, č. verze: ",
|
||||
"Metodika: ", /// BenchAdresa 1
|
||||
//"Okolní teplota: ", // Disabled, see email dated 25.11.2016
|
||||
//"Okolní tlak: ",
|
||||
//"Relativní vlhkost: ",
|
||||
};
|
||||
|
||||
string[] rightColumn = new string[]
|
||||
{
|
||||
batch.BatchNr.ToString(),
|
||||
batch.WaterMeters[0].PurchaseOrder,
|
||||
//batch.EndTime.ToShortDateString() + " " + batch.EndTime.ToShortTimeString(),
|
||||
string.Format("{0}.{1}.{2} {3}:{4}", batch.EndTime.Year.ToString("D4"),
|
||||
batch.EndTime.Month.ToString("D2"),
|
||||
batch.EndTime.Day.ToString("D2"),
|
||||
batch.EndTime.Hour.ToString("D2"),
|
||||
batch.EndTime.Minute.ToString("D2")),
|
||||
string.IsNullOrEmpty(batch.ProcedureName) ? "" : batch.ProcedureName,
|
||||
string.IsNullOrEmpty(batch.ProcedureDescription) ? "" : batch.ProcedureDescription,
|
||||
string.IsNullOrEmpty(batch.WatermetersStr) ? "" : batch.WatermetersStr,
|
||||
string.IsNullOrEmpty(batch.UserName) ? "" : batch.UserName,
|
||||
string.IsNullOrEmpty(testBenchName) ? "" : testBenchName,
|
||||
string.Format("Test Bench Framework ver.{0}", batch.ProgramVersion),
|
||||
string.IsNullOrEmpty(address1) ? "" : address1,
|
||||
//batch.AmbientTempAve().ToString("F1") + " °C", // Disabled, see email dated 25.11.2016
|
||||
//Config.Units.ConvertTo(Config.Unit.mbar, batch.AmbientPressAve()).ToString("F0") + " mbar",
|
||||
//batch.AmbientHumiAve().ToString("F0") + " %",
|
||||
};
|
||||
|
||||
/// Determine max. left column width in characters
|
||||
int maxLen = 0;
|
||||
foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length;
|
||||
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
PrintAt(e, leftMargin, HdrTop + SpacingOne * i, leftColumn[i]);
|
||||
PrintAt(e, 300, HdrTop + SpacingOne * i, rightColumn[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (documentSection == DocumentSection.FirstPage || documentSection == DocumentSection.OtherPages)
|
||||
{
|
||||
///--------
|
||||
/// Body
|
||||
///--------
|
||||
|
||||
/// This variable represents the top coordinate of the area where WM results are printed
|
||||
/// and it is updated (increased by) the value returned by PrintWM() - the section size.
|
||||
int nextWmTop = (pageNr == 1) ? BodyTop : TitleY;
|
||||
|
||||
int nrWMsOnPage = (pageNr == 1) ? nrWMsOnFirstPage : nrWMsOnNextPage;
|
||||
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
e.HasMorePages = true;
|
||||
if (nextWMNr < batch.WaterMeters.Count)
|
||||
{
|
||||
documentSection = DocumentSection.OtherPages;
|
||||
}
|
||||
else
|
||||
{
|
||||
documentSection = DocumentSection.Appendix1;
|
||||
}
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
string footerText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
|
||||
int footerWidth = (int)e.Graphics.MeasureString(footerText, font).Width;
|
||||
PrintAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - SpacingOne, footerText);
|
||||
}
|
||||
else
|
||||
{
|
||||
///-------------------------------
|
||||
/// List of passed water meters
|
||||
///-------------------------------
|
||||
|
||||
int nextWmTop = BodyTop;
|
||||
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (wm.Passed)
|
||||
{
|
||||
PrintAt(e, leftMargin, nextWmTop, string.Format("Vodoměr {0}: s/n {1}", wm.WMPosition, wm.SerialNr));
|
||||
nextWmTop += SpacingOne;
|
||||
}
|
||||
}
|
||||
|
||||
if (documentSection == DocumentSection.Appendix1)
|
||||
{
|
||||
documentSection = DocumentSection.Appendix2;
|
||||
e.HasMorePages = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.HasMorePages = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wm">Water meter</param>
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[rsltItems.Count + 1];
|
||||
columnPos[0] = (float)leftMargin;
|
||||
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(rsltItems[i].ClmnHeaderText, font).Width;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
itemText = rsltItems[i].Print(mtr);
|
||||
}
|
||||
else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
|
||||
itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[rsltItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("Vodoměr {0}", printedWMNr);
|
||||
PrintAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, font).Width, top,
|
||||
string.Format(" s/n = {0}", wm.SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + 25;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
PrintAt(e, (int)columnPos[i], top + 27, rsltItems[i].ClmnHeaderText);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 27 + SpacingOne;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
testsCount++;
|
||||
for (int i = 0; i < rsltItems.Count; i++)
|
||||
{
|
||||
string itemText;
|
||||
|
||||
if (!wm.Compound())
|
||||
{
|
||||
/// Single water meter
|
||||
itemText = rsltItems[i].Print(mtr);
|
||||
}
|
||||
else if (mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
itemText = rsltItems[i].PrintCombined(mainMtr, auxMtr, mtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
itemText = texts[0];
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 30 + SpacingOne * (testsCount + 1);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (testsCount + 4) * SpacingOne;
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
|
||||
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintBoldAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintBoldAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 667, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,9 @@ namespace Results.Output.Printers.Enhanced
|
||||
readonly int SpacingOneAndHalf;
|
||||
readonly int SpacingOne4Header;
|
||||
readonly int SpacingOneAndHalf4Header;
|
||||
|
||||
|
||||
readonly int SpacingOne4Footer;
|
||||
|
||||
int CommonTop; /// = TitleY + 60
|
||||
int BodyTop; /// = HdrTop + 160
|
||||
///
|
||||
@@ -37,9 +39,12 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font font;
|
||||
Font headerFont;
|
||||
Font titleFont;
|
||||
Font titleFont;
|
||||
Font headerFont;
|
||||
Font font;
|
||||
Font footerFont;
|
||||
|
||||
TableStyle style;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
@@ -70,11 +75,12 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public EnhancedPrintDocument(Results.Entities.Batch batch, EnhancedPrinterCfg cfg)
|
||||
public EnhancedPrintDocument(Results.Entities.Batch batch, EnhancedPrinterCfg cfg, string documentName)
|
||||
{
|
||||
this.batch = batch;
|
||||
|
||||
this.batch = batch;
|
||||
this.cfg = cfg;
|
||||
DocumentName = documentName;
|
||||
|
||||
topMargin = cfg.TopMargin;
|
||||
bottomMargin = cfg.BottomMargin;
|
||||
leftMargin = cfg.LeftMargin;
|
||||
@@ -85,11 +91,25 @@ namespace Results.Output.Printers.Enhanced
|
||||
footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
|
||||
|
||||
/// Initialize fonts
|
||||
titleFont = new Font(cfg.TitFntFml, cfg.TitFntSz, (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font(cfg.HdrFntFml, cfg.HdrFntSz, (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font(cfg.BodyFntFml, cfg.BodyFntSz, (FontStyle)cfg.BodyFntSty);
|
||||
titleFont = new Font((cfg.TitFntFml != null ? cfg.TitFntFml : "Arial"), (cfg.TitFntSz > 0 ? cfg.TitFntSz : 10), (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font((cfg.HdrFntFml != null ? cfg.HdrFntFml : "Arial"), (cfg.HdrFntSz > 0 ? cfg.HdrFntSz : 10), (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font((cfg.BodyFntFml != null ? cfg.BodyFntFml : "Arial"), (cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10), (FontStyle)cfg.BodyFntSty);
|
||||
footerFont = new Font((cfg.FooterFntFml != null ? cfg.FooterFntFml : "Arial"), (cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10), (FontStyle)cfg.FooterFntSty);
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
/// Table style of one water meter table where tests are rows
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
TopHeadersCount = 1,
|
||||
HorizLines = TableLines.FirstSecondAndLast,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
///
|
||||
if (DefaultPageSettings.Landscape)
|
||||
@@ -103,38 +123,15 @@ namespace Results.Output.Printers.Enhanced
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
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;
|
||||
/// 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;
|
||||
|
||||
/// Calculate the tests count
|
||||
int testsCount = 0;
|
||||
if (batch.WaterMeters.Count > 0)
|
||||
{
|
||||
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always && mtr.IsPilotRslt()) testsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/// Prepare document outline
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
CommonTop = TitleY + titleHeight + SpacingOne4Header;
|
||||
|
||||
commonHeight = commonItems.Count * SpacingOne;
|
||||
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
|
||||
|
||||
int wmSectionHeight = (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
|
||||
|
||||
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;
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
@@ -160,18 +157,44 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
if (File.Exists("C:\\TBF\\header.png"))
|
||||
{
|
||||
Image img = Image.FromFile("C:\\TBF\\header.png");
|
||||
e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 827, 1169));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cfg.Template))
|
||||
{
|
||||
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
|
||||
if (File.Exists(templatePath))
|
||||
{
|
||||
if (cfg.PageOrientation == PageOrientation.Portrait)
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 827, 1169), new Rectangle(0, 0, 827, 1169));
|
||||
else
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 1169, 827), new Rectangle(0, 0, 1169, 827));
|
||||
}
|
||||
}
|
||||
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
///----------
|
||||
///----------
|
||||
/// Prepare document outline
|
||||
///----------
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
CommonTop = TitleY + titleHeight + 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;
|
||||
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;
|
||||
|
||||
|
||||
///----------
|
||||
/// Title
|
||||
///----------
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight);
|
||||
@@ -216,7 +239,10 @@ namespace Results.Output.Printers.Enhanced
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
|
||||
if (!cfg.GoodOnly || batch.WaterMeters[wmNr].Passed)
|
||||
{
|
||||
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
|
||||
}
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
@@ -225,8 +251,8 @@ namespace Results.Output.Printers.Enhanced
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
int footerWidth = (int)e.Graphics.MeasureString(footer, font).Width;
|
||||
PrintAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
|
||||
int footerWidth = (int)e.Graphics.MeasureString(footer, footerFont).Width;
|
||||
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;
|
||||
@@ -241,85 +267,28 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[testItems.Count + 1];
|
||||
columnPos[0] = (float)leftMargin;
|
||||
/// 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))
|
||||
{
|
||||
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
|
||||
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
|
||||
}
|
||||
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(testItems[i].Caption, headerFont).Width;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
string itemText = testItems[i].Print(wm, mtr.Name());
|
||||
Table table = Table.Create_TestsAreRows(wm, testItems, style);
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[testItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
PrintHeaderAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
|
||||
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + SpacingOneAndHalf4Header;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
PrintHeaderAt(e, (int)columnPos[i], top + (int)(1.6 * SpacingOne4Header), testItems[i].Caption);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + (int)(2.8 * SpacingOne4Header);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
{
|
||||
testsCount++;
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
string itemText = testItems[i].Print(wm, mtr.Name());
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
itemText = texts[0];
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 2 * SpacingOne4Header + SpacingOne * testsCount, itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 2 * SpacingOneAndHalf4Header + SpacingOne * testsCount;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
|
||||
if (table.IsEmpty())
|
||||
{
|
||||
return top;
|
||||
}
|
||||
else
|
||||
{
|
||||
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -327,8 +296,6 @@ namespace Results.Output.Printers.Enhanced
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
|
||||
@@ -340,12 +307,21 @@ namespace Results.Output.Printers.Enhanced
|
||||
{
|
||||
PrintHeaderAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
|
||||
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrintFooterAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintFooterAt(e, p.X, p.Y, text);
|
||||
}
|
||||
void PrintFooterAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Footer);
|
||||
e.Graphics.DrawString(text, this.footerFont, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Results.Output.Printers.Enhanced
|
||||
{
|
||||
public class EnhancedPrinterCfg
|
||||
{
|
||||
public Config.Entities.PageOrientation PageOrientation;
|
||||
public int TopMargin;
|
||||
public string Template;
|
||||
public int TopMargin;
|
||||
public int BottomMargin;
|
||||
public int LeftMargin;
|
||||
public string TitFntFml;
|
||||
@@ -23,11 +20,15 @@ namespace Results.Output.Printers.Enhanced
|
||||
public string BodyFntFml;
|
||||
public int BodyFntSz;
|
||||
public int BodyFntSty;
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
public string FooterFntFml;
|
||||
public int FooterFntSz;
|
||||
public int FooterFntSty;
|
||||
public bool GoodOnly;
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
public string[] CommonItems;
|
||||
public string Header; /// =Title
|
||||
public string[] CommonItems;
|
||||
public string[] TestItems;
|
||||
public string Header; /// =Title
|
||||
public string Footer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace Results.Output.Printers.Munich
|
||||
{
|
||||
public class MunichPrintDocument : PrintDocument
|
||||
{
|
||||
const string FontFamilyName = "Arial"; //"Times New Roman";
|
||||
const string FontFamilyName = "Arial"; ///"Times New Roman";
|
||||
|
||||
const int SpacingOne = 18;
|
||||
const int SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
const int SpacingOneAndHalf = 24; /// was 27 before
|
||||
const int TitleX = 240;
|
||||
const int TitleY = 180; /// Depends on the size of the header
|
||||
const int FirstLineNr = 14; /// Depends on the size of the header
|
||||
@@ -38,10 +38,11 @@ namespace Results.Output.Printers.Munich
|
||||
readonly int resultsCount;
|
||||
readonly bool compound; /// true when MetersKind is MetersKind.Combined
|
||||
|
||||
readonly int secondTableOffset; /// Calculated in the constructor
|
||||
|
||||
/// Top coordinate of the table
|
||||
int top;
|
||||
int nrPages;
|
||||
int pageNr;
|
||||
int firstTblTop;
|
||||
int secondTblTop;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
@@ -85,7 +86,8 @@ namespace Results.Output.Printers.Munich
|
||||
int resultsCount = wm.MeterTestRslts.Count;
|
||||
if (compound) resultsCount /= 3;
|
||||
|
||||
secondTableOffset = (resultsCount + 2) * SpacingOneAndHalf;
|
||||
pageNr = 1;
|
||||
nrPages = (compound ? (resultsCount > 7) : (resultsCount > 9)) ? 2 : 1;
|
||||
|
||||
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
|
||||
}
|
||||
@@ -138,219 +140,279 @@ namespace Results.Output.Printers.Munich
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 50);
|
||||
e.Graphics.DrawString(wm.Batch.ProtocolTitle, this.fontTitle, Brushes.Black, printArea);
|
||||
|
||||
int lineNr = FirstLineNr;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, docVersion);
|
||||
lineNr++;
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
|
||||
PrintBoldAt(e, Tab2, lineNr * SpacingOne, wm.BenchId().ToString());
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :");
|
||||
PrintBoldAt(e, Tab4, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zählertyp :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, zaehlertyp);
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Eichjahr :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.YearOfProduction.ToString());
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Prüfvorlage :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, pruefvorlage);
|
||||
lineNr += 2;
|
||||
|
||||
if (compound)
|
||||
if (pageNr == 1)
|
||||
{
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler");
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler");
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, 667, 50);
|
||||
e.Graphics.DrawString(wm.Batch.ProtocolTitle, this.fontTitle, Brushes.Black, printArea);
|
||||
|
||||
///
|
||||
/// Common
|
||||
///
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, docVersion);
|
||||
lineNr++;
|
||||
}
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Producer());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ProducerAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.SerialNr);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.SerialNrAux);
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qn :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Q3_Qn().ToString());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Qn :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.Q3_Qn_Aux().ToString());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.ApprovalInfo());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ApprovalInfoAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.MetrologicalClass());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.MetrologicalClassAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.EndState);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.EndStateAux);
|
||||
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
|
||||
PrintBoldAt(e, Tab2, lineNr * SpacingOne, wm.BenchId().ToString());
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :");
|
||||
PrintBoldAt(e, Tab4, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zählertyp :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, zaehlertyp);
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Eichjahr :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.YearOfProduction.ToString());
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Prüfvorlage :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, pruefvorlage);
|
||||
lineNr += 2;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Umschaltpunkte :");
|
||||
|
||||
if (compound)
|
||||
{
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler");
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler");
|
||||
lineNr++;
|
||||
}
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Producer());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ProducerAux());
|
||||
}
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qsteig");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QRise).ToString("F1") + " l/h");
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.SerialNr);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.SerialNrAux);
|
||||
}
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qfall");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QFall).ToString("F1") + " l/h");
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, wm.NewQnames() ? "Q3 :" : "Qn :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Q3_Qn().ToString());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, wm.NewQnames() ? "Q3 :" : "Qn :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.Q3_Qn_Aux().ToString());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.ApprovalInfo());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Zulassungszeichen :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ApprovalInfoAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.MetrologicalClass());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Metr. klasse :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.MetrologicalClassAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.EndState);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Stand :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.EndStateAux);
|
||||
|
||||
lineNr += 2;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Umschaltpunkte :");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qsteig");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QRise).ToString("F1") + " l/h");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Qfall");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, (1000.0 * wm.QFall).ToString("F1") + " l/h");
|
||||
}
|
||||
|
||||
lineNr += 2;
|
||||
firstTblTop = SpacingOne * lineNr;
|
||||
|
||||
///
|
||||
/// Table 1
|
||||
///
|
||||
PrintTableOne(e, firstTblTop);
|
||||
DrawTableFrame(e, resultsCount + 1, firstTblTop);
|
||||
}
|
||||
|
||||
lineNr += 2;
|
||||
top = SpacingOne * lineNr;
|
||||
|
||||
PrintTable(e);
|
||||
DrawTable(e);
|
||||
if (pageNr == nrPages)
|
||||
{
|
||||
if (pageNr == 1)
|
||||
{
|
||||
secondTblTop = firstTblTop + (resultsCount + 2) * SpacingOneAndHalf;
|
||||
lineNr += ((resultsCount + 2) * SpacingOneAndHalf * 2) / SpacingOne;
|
||||
}
|
||||
else
|
||||
{
|
||||
lineNr -= 3;
|
||||
|
||||
lineNr += (secondTableOffset * 2) / SpacingOne;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Temperatur");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbTempMean().ToString("F1") + " \x00b0C");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Feuchtigkeit");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbHumiMean().ToString("F0") + " %");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Luftdruck");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, Config.Units.ConvertTo(Config.Unit.mbar, wm.Batch.AmbPressMean()).ToString("F0") + " mbar");
|
||||
if (compound)
|
||||
{
|
||||
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Hauptzahler");
|
||||
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Nebenzahler");
|
||||
lineNr++;
|
||||
}
|
||||
|
||||
lineNr++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr ++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Datum");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, "Unterschrift");
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Producer());
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Hersteller :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.ProducerAux());
|
||||
}
|
||||
lineNr++;
|
||||
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.SerialNr);
|
||||
if (compound)
|
||||
{
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Seriennummer :");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, wm.SerialNrAux);
|
||||
}
|
||||
lineNr += ((resultsCount + 2) * SpacingOneAndHalf) / SpacingOne + 2;
|
||||
|
||||
secondTblTop = TitleY + (compound ? 5 : 4) * SpacingOne;
|
||||
}
|
||||
|
||||
///
|
||||
/// Table 2
|
||||
///
|
||||
PrintTableTwo(e, secondTblTop);
|
||||
DrawTableFrame(e, resultsCount + 1, secondTblTop);
|
||||
|
||||
///
|
||||
/// Footer
|
||||
///
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Temperatur");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbTempMean().ToString("F1") + " \x00b0C");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Feuchtigkeit");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, wm.Batch.AmbHumiMean().ToString("F0") + " %");
|
||||
lineNr++;
|
||||
PrintAt(e, Tab1, lineNr * SpacingOne, "Luftdruck");
|
||||
PrintAt(e, Tab2, lineNr * SpacingOne, Config.Units.ConvertTo(Config.Unit.mbar, wm.Batch.AmbPressMean()).ToString("F0") + " mbar");
|
||||
|
||||
lineNr++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, wm.Batch.EndTime.Date.ToString("d"));
|
||||
lineNr++;
|
||||
PrintAt(e, Tab3, lineNr * SpacingOne, "Datum");
|
||||
PrintAt(e, Tab4, lineNr * SpacingOne, "Unterschrift");
|
||||
}
|
||||
|
||||
e.HasMorePages = (pageNr != nrPages);
|
||||
pageNr++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print table texts.
|
||||
/// </summary>
|
||||
void PrintTable(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
void PrintTableOne(System.Drawing.Printing.PrintPageEventArgs e, int tblTop)
|
||||
{
|
||||
PrintAt(e, FromTest(-1, -1), "Prüflauf");
|
||||
PrintAt(e, FromTest(-1, 0), "Q [l/h]");
|
||||
PrintAt(e, FromTest(-1, 1), "Prüf-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 2), compound ? "HZ-Vol.[l]" : "Z-Vol.[l]");
|
||||
PrintAt(e, FromTest(-1, 3), compound ? "NZ-Vol.[l]" : "-");
|
||||
PrintAt(e, FromTest(-1, 4), "Fehler [%]");
|
||||
PrintAt(e, FromTest(-1, 5), "Ergebnis");
|
||||
PrintAt(e, GetTabItemPos(0, 0, tblTop), "Prüflauf");
|
||||
PrintAt(e, GetTabItemPos(0, 1, tblTop), "Q [l/h]");
|
||||
PrintAt(e, GetTabItemPos(0, 2, tblTop), "Prüf-Vol.[l]");
|
||||
PrintAt(e, GetTabItemPos(0, 3, tblTop), compound ? "HZ-Vol.[l]" : "Z-Vol.[l]");
|
||||
PrintAt(e, GetTabItemPos(0, 4, tblTop), compound ? "NZ-Vol.[l]" : "-");
|
||||
PrintAt(e, GetTabItemPos(0, 5, tblTop), "Fehler [%]");
|
||||
PrintAt(e, GetTabItemPos(0, 6, tblTop), "Ergebnis");
|
||||
|
||||
PrintAt(e, FromTest(-1, 6), "Q [l/h]");
|
||||
PrintAt(e, FromTest(-1, 7), "Temperatur");
|
||||
PrintAt(e, FromTest(-1, 8), "Dichte");
|
||||
PrintAt(e, FromTest(-1, 9), "Prüfzeit");
|
||||
PrintAt(e, FromTest(-1, 10), "Druck Eing.");
|
||||
PrintAt(e, FromTest(-1, 11), "Druck Ausg.");
|
||||
|
||||
int rowCnt = 0;
|
||||
int rowCnt = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (!compound || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
Point p = FromTest(rowCnt, -1);
|
||||
PrintAt(e, p.X, p.Y, mtr.Name());
|
||||
PrintAt(e, p.X, p.Y + (resultsCount + 2) * SpacingOneAndHalf, mtr.Name());
|
||||
|
||||
PrintAt(e, FromTest(rowCnt, 0), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(rowCnt, 1), mtr.TestRslt.VolumeCTV.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 0, tblTop), mtr.Name());
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 1, tblTop), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 2, tblTop), mtr.TestRslt.VolumeCTV.ToString("F2"));
|
||||
if (compound)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mainMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
|
||||
|
||||
PrintAt(e, FromTest(rowCnt, 2), mainMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 3), auxMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 4), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 5), mtr.Passed ? "iO" : "NiO");
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 3, tblTop), mainMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 4, tblTop), auxMtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 5, tblTop), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 6, tblTop), mtr.Passed ? "iO" : "NiO");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintAt(e, FromTest(rowCnt, 2), mtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 3), "-");
|
||||
PrintAt(e, FromTest(rowCnt, 4), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 5), mtr.Passed ? "iO" : "NiO");
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 3, tblTop), mtr.VolumeMeter.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 4, tblTop), "-");
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 5, tblTop), mtr.Error.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 6, tblTop), mtr.Passed ? "iO" : "NiO");
|
||||
}
|
||||
PrintAt(e, FromTest(rowCnt, 6), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, FromTest(rowCnt, 7), mtr.TestRslt.TempDownMean.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 8), mtr.TestRslt.DensityDiv.ToString("F2"));
|
||||
PrintAt(e, FromTest(rowCnt, 9), mtr.TestTime.ToString("F1"));
|
||||
PrintAt(e, FromTest(rowCnt, 10), Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"));
|
||||
PrintAt(e, FromTest(rowCnt, 11), Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3"));
|
||||
|
||||
rowCnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PrintTableTwo(System.Drawing.Printing.PrintPageEventArgs e, int tblTop)
|
||||
{
|
||||
PrintAt(e, GetTabItemPos(0, 1, tblTop), "Q [l/h]");
|
||||
PrintAt(e, GetTabItemPos(0, 2, tblTop), "Temperatur");
|
||||
PrintAt(e, GetTabItemPos(0, 3, tblTop), "Dichte");
|
||||
PrintAt(e, GetTabItemPos(0, 4, tblTop), "Prüfzeit");
|
||||
PrintAt(e, GetTabItemPos(0, 5, tblTop), "Druck Eing.");
|
||||
PrintAt(e, GetTabItemPos(0, 6, tblTop), "Druck Ausg.");
|
||||
|
||||
int rowCnt = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (!compound || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound)
|
||||
{
|
||||
Point p = GetTabItemPos(rowCnt, 0, tblTop);
|
||||
PrintAt(e, p.X, p.Y, mtr.Name());
|
||||
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 1, tblTop), mtr.TestRslt.FlowMass.ToString("F1"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 2, tblTop), mtr.TestRslt.TempDownMean.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 3, tblTop), mtr.TestRslt.DensityDiv.ToString("F2"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 4, tblTop), mtr.TestTime.ToString("F1"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 5, tblTop), Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"));
|
||||
PrintAt(e, GetTabItemPos(rowCnt, 6, tblTop), Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3"));
|
||||
|
||||
rowCnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw table lines.
|
||||
/// </summary>
|
||||
void DrawTable(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
void DrawTableFrame(System.Drawing.Printing.PrintPageEventArgs e, int rowsCount, int tblTop)
|
||||
{
|
||||
int mid = top + SpacingOneAndHalf;
|
||||
int bot = top + (resultsCount + 1) * SpacingOneAndHalf;
|
||||
|
||||
int top2 = top + secondTableOffset;
|
||||
int mid2 = mid + secondTableOffset;
|
||||
int bot2 = bot + secondTableOffset;
|
||||
int t = tblTop;
|
||||
int m = tblTop + SpacingOneAndHalf;
|
||||
int b = tblTop + rowsCount * SpacingOneAndHalf;
|
||||
|
||||
// Horizontal lines
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, top), new Point(747, top));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, mid), new Point(747, mid));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, bot), new Point(747, bot));
|
||||
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, top2), new Point(747, top2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, mid2), new Point(747, mid2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, bot2), new Point(747, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, t), new Point(747, t));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, m), new Point(747, m));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(80, b), new Point(747, b));
|
||||
|
||||
// Vertical lines
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point( 80, top), new Point( 80, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(267, top), new Point(267, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(347, top), new Point(347, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(427, top), new Point(427, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(507, top), new Point(507, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(587, top), new Point(587, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(667, top), new Point(667, bot));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(747, top), new Point(747, bot));
|
||||
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point( 80, top2), new Point( 80, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(267, top2), new Point(267, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(347, top2), new Point(347, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(427, top2), new Point(427, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(507, top2), new Point(507, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(587, top2), new Point(587, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(667, top2), new Point(667, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(747, top2), new Point(747, bot2));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point( 80, t), new Point( 80, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(267, t), new Point(267, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(347, t), new Point(347, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(427, t), new Point(427, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(507, t), new Point(507, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(587, t), new Point(587, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(667, t), new Point(667, b));
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, BorderW), new Point(747, t), new Point(747, b));
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
@@ -373,16 +435,16 @@ namespace Results.Output.Printers.Munich
|
||||
e.Graphics.DrawString(text, this.boldFont, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
Point FromTest(int testNr, int parNr)
|
||||
/// <summary>
|
||||
/// Get text position form a number of the test and a number of the parameter.
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="column">Table column (0-based)</param>
|
||||
/// <returns></returns>
|
||||
Point GetTabItemPos(int row, int column, int tblTop)
|
||||
{
|
||||
const int NrParamsInOneTableRow = 6;
|
||||
|
||||
int x = 267 + (parNr % NrParamsInOneTableRow) * 80 + MarginLeft;
|
||||
int y = top + SpacingOneAndHalf + MarginTop + testNr * SpacingOneAndHalf
|
||||
+ ((parNr >= NrParamsInOneTableRow) ? secondTableOffset : 0);
|
||||
|
||||
if (parNr < 0) x = 80 + MarginLeft; /// When parNr == -1 return the left column x coordinate
|
||||
|
||||
int x = MarginLeft + ((column == 0) ? 80 : 187) + column * 80; /// leftmost column is wider
|
||||
int y = MarginTop + tblTop + (row * SpacingOneAndHalf) - 2;
|
||||
return new Point(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,351 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.OnePagePerMeter
|
||||
{
|
||||
public class EnhancedPrintDocument : PrintDocument
|
||||
{
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight;
|
||||
readonly int printWidth;
|
||||
|
||||
readonly int topMargin;
|
||||
readonly int bottomMargin;
|
||||
readonly int leftMargin;
|
||||
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;
|
||||
|
||||
int CommonTop; /// = TitleY + 60
|
||||
int BodyTop; /// = HdrTop + 160
|
||||
///
|
||||
int titleHeight;
|
||||
int commonHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font font;
|
||||
Font headerFont;
|
||||
Font titleFont;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
EnhancedPrinterCfg cfg;
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
IList<WMeterRsltItemSpec> commonItems;
|
||||
IList<WMeterRsltItemSpec> testItems;
|
||||
string footer;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
///
|
||||
int nrWMsOnFirstPage;
|
||||
int nrWMsOnNextPage;
|
||||
int nextWMNr; /// nr. of watermeter to be printed as the first one on the next page
|
||||
int nrPages;
|
||||
int pageNr; /// Page number to be printed at the bottom of the page
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public EnhancedPrintDocument(Results.Entities.Batch batch, EnhancedPrinterCfg cfg)
|
||||
{
|
||||
this.batch = batch;
|
||||
|
||||
this.cfg = cfg;
|
||||
topMargin = cfg.TopMargin;
|
||||
bottomMargin = cfg.BottomMargin;
|
||||
leftMargin = cfg.LeftMargin;
|
||||
|
||||
header = string.IsNullOrEmpty(cfg.Header) ? string.Empty : cfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems);
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems); /// TestID info will be overwritten later on
|
||||
footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
|
||||
|
||||
/// Initialize fonts
|
||||
titleFont = new Font(cfg.TitFntFml, cfg.TitFntSz, (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font(cfg.HdrFntFml, cfg.HdrFntSz, (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font(cfg.BodyFntFml, cfg.BodyFntSz, (FontStyle)cfg.BodyFntSty);
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
///
|
||||
if (DefaultPageSettings.Landscape)
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
|
||||
}
|
||||
else
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/// Calculate the tests count
|
||||
int testsCount = 0;
|
||||
if (batch.WaterMeters.Count > 0)
|
||||
{
|
||||
foreach (var mtr in batch.WaterMeters[0].MeterTestRslts)
|
||||
{
|
||||
if (mtr.Publish() == Config.Entities.Publish.Always && mtr.IsPilotRslt()) testsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/// Prepare document outline
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
CommonTop = TitleY + titleHeight + SpacingOne4Header;
|
||||
|
||||
commonHeight = commonItems.Count * SpacingOne;
|
||||
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
|
||||
|
||||
int wmSectionHeight = (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
|
||||
|
||||
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;
|
||||
|
||||
pageNr = 1;
|
||||
nextWMNr = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
if (File.Exists("C:\\TBF\\header.png"))
|
||||
{
|
||||
Image img = Image.FromFile("C:\\TBF\\header.png");
|
||||
e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, 827, 1169));
|
||||
}
|
||||
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
///----------
|
||||
/// Title
|
||||
///----------
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight);
|
||||
e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea);
|
||||
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
string[] leftColumn = new string[commonItems.Count];
|
||||
string[] rightColumn = new string[commonItems.Count];
|
||||
|
||||
int cnt = 0;
|
||||
foreach (var v in commonItems)
|
||||
{
|
||||
leftColumn[cnt] = v.Caption;
|
||||
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/// Determine max. left column width in characters
|
||||
int maxLen = 0;
|
||||
foreach (var s in leftColumn) if (s.Length > maxLen) maxLen = s.Length;
|
||||
|
||||
/// 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]);
|
||||
}
|
||||
}
|
||||
|
||||
///--------
|
||||
/// Body
|
||||
///--------
|
||||
|
||||
/// This variable represents the top coordinate of the area where WM results are printed
|
||||
/// and it is updated (increased by) the value returned by PrintXyzWM() - the section size.
|
||||
int nextWmTop = (pageNr == 1) ? BodyTop : TitleY;
|
||||
|
||||
int nrWMsOnPage = (pageNr == 1) ? nrWMsOnFirstPage : nrWMsOnNextPage;
|
||||
|
||||
for (int wmNr = nextWMNr; wmNr < Math.Min(nextWMNr + nrWMsOnPage, batch.WaterMeters.Count); wmNr++) /// wmNr is 0-based
|
||||
{
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
nextWmTop += PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop);
|
||||
}
|
||||
|
||||
nextWMNr += nrWMsOnPage;
|
||||
e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
int footerWidth = (int)e.Graphics.MeasureString(footer, font).Width;
|
||||
PrintAt(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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wm">Water meter</param>
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
int PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
/// Determin column widths
|
||||
float[] columnPos = new float[testItems.Count + 1];
|
||||
columnPos[0] = (float)leftMargin;
|
||||
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
float columnWidth = e.Graphics.MeasureString(testItems[i].Caption, headerFont).Width;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
string itemText = testItems[i].Print(wm, mtr.Name());
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[testItems.Count] - 20;
|
||||
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
PrintHeaderAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
|
||||
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + SpacingOneAndHalf4Header;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
PrintHeaderAt(e, (int)columnPos[i], top + (int)(1.6 * SpacingOne4Header), testItems[i].Caption);
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + (int)(2.8 * SpacingOne4Header);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
int testsCount = 0;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
|
||||
{
|
||||
testsCount++;
|
||||
for (int i = 0; i < testItems.Count; i++)
|
||||
{
|
||||
string itemText = testItems[i].Print(wm, mtr.Name());
|
||||
|
||||
/// Strip color information
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
itemText = texts[0];
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
/// TODO: How to print colors?
|
||||
}
|
||||
|
||||
PrintAt(e, (int)columnPos[i], top + 2 * SpacingOne4Header + SpacingOne * testsCount, itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = top + 2 * SpacingOneAndHalf4Header + SpacingOne * testsCount;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(tableLeftX, horY), new Point(tableRightX, horY));
|
||||
|
||||
return (testsCount + 1) * SpacingOne + 3 * SpacingOne4Header;
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
{
|
||||
PrintHeaderAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
|
||||
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Results.Output.Printers.OnePagePerMeter
|
||||
{
|
||||
public class EnhancedPrinterCfg
|
||||
{
|
||||
public Config.Entities.PageOrientation PageOrientation;
|
||||
public int TopMargin;
|
||||
public int BottomMargin;
|
||||
public int LeftMargin;
|
||||
public string TitFntFml;
|
||||
public int TitFntSz;
|
||||
public int TitFntSty;
|
||||
public string HdrFntFml;
|
||||
public int HdrFntSz;
|
||||
public int HdrFntSty;
|
||||
public string BodyFntFml;
|
||||
public int BodyFntSz;
|
||||
public int BodyFntSty;
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
public string[] CommonItems;
|
||||
public string[] TestItems;
|
||||
public string Header; /// =Title
|
||||
public string Footer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.OnePerMeter
|
||||
{
|
||||
public class OnePerMeterPrintDocument : PrintersCommon
|
||||
{
|
||||
const float GapBetweenTableColumns = 10;
|
||||
const float GapBetweenCommonColumns = 10;
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight;
|
||||
readonly int printWidth;
|
||||
|
||||
readonly int topMargin;
|
||||
readonly int bottomMargin;
|
||||
readonly int leftMargin;
|
||||
readonly int TitleX;
|
||||
readonly int TitleY; /// Depends on the size of the header
|
||||
|
||||
readonly int spacingOne;
|
||||
readonly int spacingOne4Header;
|
||||
|
||||
float titleHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font titleFont;
|
||||
Font headerFont;
|
||||
Font font;
|
||||
Font footerFont;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
OnePerMeterPrinterCfg cfg;
|
||||
Results.Entities.WaterMeter wm;
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
IList<WMeterRsltItemSpec> commonItems1;
|
||||
IList<WMeterRsltItemSpec> commonItems2;
|
||||
IList<WMeterRsltItemSpec> commonItems3;
|
||||
IList<WMeterRsltItemSpec> testItems;
|
||||
IList<WMeterRsltItemSpec> testItems2;
|
||||
IList<WMeterRsltItemSpec> belowItems1;
|
||||
IList<WMeterRsltItemSpec> belowItems2;
|
||||
IList<WMeterRsltItemSpec> belowItems3;
|
||||
string footer;
|
||||
|
||||
int nrPages;
|
||||
int pageNr; /// Page number to be printed at the bottom of the page
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public OnePerMeterPrintDocument(Results.Entities.Batch batch, OnePerMeterPrinterCfg cfg, Results.Entities.WaterMeter wm, string documentName)
|
||||
{
|
||||
this.batch = batch;
|
||||
this.cfg = cfg;
|
||||
this.wm = wm;
|
||||
DocumentName = documentName;
|
||||
|
||||
topMargin = cfg.TopMargin;
|
||||
bottomMargin = cfg.BottomMargin;
|
||||
leftMargin = cfg.LeftMargin;
|
||||
|
||||
header = string.IsNullOrEmpty(cfg.Header) ? string.Empty : cfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems1);
|
||||
commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2);
|
||||
commonItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3);
|
||||
testItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems); /// TestID info will be overwritten later on
|
||||
testItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.TestItems2); /// TestID info will be overwritten later on
|
||||
belowItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1);
|
||||
belowItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2);
|
||||
belowItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3);
|
||||
footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
|
||||
|
||||
/// Initialize fonts
|
||||
titleFont = new Font((cfg.TitFntFml != null ? cfg.TitFntFml : "Arial"), (cfg.TitFntSz > 0 ? cfg.TitFntSz : 10), (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font((cfg.HdrFntFml != null ? cfg.HdrFntFml : "Arial"), (cfg.HdrFntSz > 0 ? cfg.HdrFntSz : 10), (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font((cfg.BodyFntFml != null ? cfg.BodyFntFml : "Arial"), (cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10), (FontStyle)cfg.BodyFntSty);
|
||||
footerFont = new Font((cfg.FooterFntFml != null ? cfg.FooterFntFml : "Arial"), (cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10), (FontStyle)cfg.FooterFntSty);
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
///
|
||||
if (DefaultPageSettings.Landscape)
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
|
||||
}
|
||||
else
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
|
||||
spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
|
||||
|
||||
/// Prepare document outline
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
|
||||
pageNr = 1;
|
||||
nrPages = (testItems2.Count != 0) ? 2 : 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
if (!string.IsNullOrEmpty(cfg.Template))
|
||||
{
|
||||
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
|
||||
if (File.Exists(templatePath))
|
||||
{
|
||||
if (cfg.PageOrientation == PageOrientation.Portrait)
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 827, 1169), new Rectangle(0, 0, 827, 1169));
|
||||
else
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 1169, 827), new Rectangle(0, 0, 1169, 827));
|
||||
}
|
||||
}
|
||||
|
||||
float tableTop = cfg.TopMargin;
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
/// First page
|
||||
|
||||
///
|
||||
/// Print water meter picture
|
||||
///
|
||||
if (cfg.ImgWid != 0 && cfg.ImgHgh != 0 && cfg.ImgFullPathName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(cfg.ImgFullPathName), cfg.ImgWid, cfg.ImgHgh),
|
||||
new Rectangle(cfg.ImgLeft, cfg.ImgTop, cfg.ImgWid, cfg.ImgHgh));
|
||||
}
|
||||
catch (Exception) { } /// Cope with situations when file is missing or is not correct
|
||||
}
|
||||
|
||||
///
|
||||
/// Title
|
||||
///
|
||||
RectangleF printArea = new RectangleF(TitleX, TitleY, printWidth, titleHeight);
|
||||
e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea);
|
||||
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
float commonTop = TitleY + titleHeight;
|
||||
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
commonTop += spacingOne4Header; /// Space above common part
|
||||
float leftMarginCommon1 = leftMargin + printWidth * 0.01f * cfg.ColW0Pct;
|
||||
float leftMarginCommon2 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct);
|
||||
float leftMarginCommon3 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct + cfg.ColW2Pct);
|
||||
|
||||
Alignment[] horizAlgn = new Alignment[] { Alignment.Left, Alignment.Left };
|
||||
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
||||
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
||||
|
||||
Table table1 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in commonItems1)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
float bodyTop1 = table1.Draw(e, leftMarginCommon1, commonTop);
|
||||
|
||||
|
||||
table1 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in commonItems2)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
float bodyTop2 = table1.Draw(e, leftMarginCommon2, commonTop);
|
||||
|
||||
|
||||
table1 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in commonItems3)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table1.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
float bodyTop3 = table1.Draw(e, leftMarginCommon3, commonTop);
|
||||
|
||||
float bodyTop12 = (bodyTop1 > bodyTop2) ? bodyTop1 : bodyTop2;
|
||||
tableTop = (bodyTop12 > bodyTop3) ? bodyTop12 : bodyTop3; /// Max. of all three bodyTop-s
|
||||
tableTop += spacingOne4Header; /// Space between the common part and the table
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Draw table (on the 1st, as well as on the 2nd page)
|
||||
///
|
||||
float belowTop;
|
||||
TableStyle style;
|
||||
Table table;
|
||||
switch (cfg.Form)
|
||||
{
|
||||
default:
|
||||
case TableForm.Rows:
|
||||
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
TopHeadersCount = 1,
|
||||
HorizLines = TableLines.All,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
table = Table.Create_TestsAreRows(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||
break;
|
||||
|
||||
case TableForm.Columns:
|
||||
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
LeftHeadersCount = 1,
|
||||
HorizLines = TableLines.FirstSecondAndLast,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
table = Table.Create_TestsAreColumns(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||
break;
|
||||
|
||||
case TableForm.ColumnsPL:
|
||||
|
||||
style = new TableStyle
|
||||
{
|
||||
Font = font,
|
||||
HeaderFont = headerFont,
|
||||
MarginX = 5,
|
||||
MarginY = 3,
|
||||
LineWidth = 1,
|
||||
TopHeadersCount = 1,
|
||||
HorizLines = TableLines.FirstSecondAndLast,
|
||||
VertLines = TableLines.All
|
||||
};
|
||||
table = Table.Create_TestsAreColumnsPL(wm, (pageNr == 1) ? testItems : testItems2, style);
|
||||
break;
|
||||
}
|
||||
|
||||
SizeF size = table.Measure(e);
|
||||
float tableLeft = (float)leftMargin + ((float)printWidth - size.Width) / 2;
|
||||
belowTop = table.Draw(e, tableLeft, tableTop);
|
||||
|
||||
if (pageNr == nrPages)
|
||||
{
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
belowTop += spacingOne4Header; /// Space between the table and the bottom common part
|
||||
float leftMarginBelow1 = leftMargin + printWidth * 0.01f * cfg.BelowW0Pct;
|
||||
float leftMarginBelow2 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct);
|
||||
float leftMarginBelow3 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct + cfg.BelowW2Pct);
|
||||
|
||||
Alignment[] horizAlgn = new Alignment[] { Alignment.Left, Alignment.Left };
|
||||
VertAlignment[] vertAlgn = new VertAlignment[] { VertAlignment.Top, VertAlignment.Top };
|
||||
TableStyle commonTableStyle = new TableStyle { Font = font, MarginX = 5, MarginY = 3 };
|
||||
|
||||
Table table2 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in belowItems1)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
table2.Draw(e, leftMarginBelow1, belowTop);
|
||||
|
||||
|
||||
table2 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in belowItems2)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
table2.Draw(e, leftMarginBelow2, belowTop);
|
||||
|
||||
|
||||
table2 = new Table(2) { Style = commonTableStyle };
|
||||
foreach (var item in belowItems3)
|
||||
{
|
||||
string[] row = new string[] { item.Caption, item.Print(wm).Split(new char[] { '|' })[0] };
|
||||
table2.AddRow(row, horizAlgn, vertAlgn);
|
||||
}
|
||||
table2.Draw(e, leftMarginBelow3, belowTop);
|
||||
|
||||
|
||||
///
|
||||
/// Footer on the last page
|
||||
///
|
||||
float footerWidth = e.Graphics.MeasureString(footer, footerFont).Width;
|
||||
PrintAt(e, footer, footerFont, leftMargin, topMargin + printHeight - 2 * spacingOne, 0, 0, Alignment.Left, VertAlignment.Top);
|
||||
}
|
||||
|
||||
///
|
||||
/// Page number on each page
|
||||
///
|
||||
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr, nrPages);
|
||||
float pageNrWidth = e.Graphics.MeasureString(pageNrText, font).Width;
|
||||
PrintAt(e, pageNrText, font, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, 0, 0, Alignment.Left, VertAlignment.Top);
|
||||
|
||||
e.HasMorePages = !(pageNr == nrPages);
|
||||
|
||||
pageNr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.OnePerMeter
|
||||
{
|
||||
public class OnePerMeterPrinterCfg
|
||||
{
|
||||
public Config.Entities.PageOrientation PageOrientation;
|
||||
public string Template;
|
||||
public int TopMargin;
|
||||
public int BottomMargin;
|
||||
public int LeftMargin;
|
||||
public string TitFntFml;
|
||||
public int TitFntSz;
|
||||
public int TitFntSty;
|
||||
public string HdrFntFml;
|
||||
public int HdrFntSz;
|
||||
public int HdrFntSty;
|
||||
public string BodyFntFml;
|
||||
public int BodyFntSz;
|
||||
public int BodyFntSty;
|
||||
public string FooterFntFml;
|
||||
public int FooterFntSz;
|
||||
public int FooterFntSty;
|
||||
public bool GoodOnly;
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
public string Header; /// =Title
|
||||
public int ColW0Pct;
|
||||
public int ColW1Pct;
|
||||
public int ColW2Pct;
|
||||
public string[] CommonItems1;
|
||||
public string[] CommonItems2;
|
||||
public string[] CommonItems3;
|
||||
public Config.Entities.TableForm Form;
|
||||
public string[] TestItems;
|
||||
public Config.Entities.TableForm Form2;
|
||||
public string[] TestItems2;
|
||||
public int BelowW0Pct;
|
||||
public int BelowW1Pct;
|
||||
public int BelowW2Pct;
|
||||
public string[] BelowItems1;
|
||||
public string[] BelowItems2;
|
||||
public string[] BelowItems3;
|
||||
public string Footer;
|
||||
public bool TestsAreRows;
|
||||
public string ImgFullPathName;
|
||||
public int ImgLeft;
|
||||
public int ImgTop;
|
||||
public int ImgWid;
|
||||
public int ImgHgh;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Output.Printers
|
||||
{
|
||||
public class PrintersCommon : PrintDocument
|
||||
{
|
||||
static Font lastFont = null;
|
||||
static float lastSpacing = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Measure the size of a paragraph of text, lines are separated by '~'.
|
||||
/// </summary>
|
||||
/// <param name="e">PrintPageEventArgs</param>
|
||||
/// <param name="text">Text, lines are separated by '~'</param>
|
||||
/// <param name="font">Font</param>
|
||||
/// <returns>Size of the paragraph of text</returns>
|
||||
public static SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e, string text, Font font)
|
||||
{
|
||||
if (font != lastFont)
|
||||
{
|
||||
lastFont = font;
|
||||
lastSpacing = e.Graphics.MeasureString("Abcgq", font).Height;
|
||||
}
|
||||
|
||||
string[] lines = text.Split(new char[] { '~' });
|
||||
float width = 0;
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float lineWid = e.Graphics.MeasureString(line, font).Width;
|
||||
if (lineWid > width) width = lineWid;
|
||||
}
|
||||
|
||||
return new SizeF(width, 0.8f * lines.Length * lastSpacing + 0.2f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print a paragraph of text, lines are separated by '~'.
|
||||
/// </summary>
|
||||
/// <param name="e">PrintPageEventArgs</param>
|
||||
/// <param name="text">Text, lines are separated by '~'</param>
|
||||
/// <param name="font">Font</param>
|
||||
/// <param name="x">Position x</param>
|
||||
/// <param name="y">Position y</param>
|
||||
/// <param name="width">Width (required when alignment=Alignment.Center or alignment=Aligmenr.Right</param>
|
||||
/// <param name="height">Height, 0 = no vertical centering</param>
|
||||
/// <param name="horizAlignment">Horizontal alignment</param>
|
||||
/// <param name="vertAlignment">Vertical alignment</param>
|
||||
public static void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, string text, Font font,
|
||||
float x, float y, float width, float height,
|
||||
Alignment horizAlignment, VertAlignment vertAlignment)
|
||||
{
|
||||
SizeF size = PrintersCommon.Measure(e, text, font);
|
||||
|
||||
string[] lines = text.Split(new char[] { '~' });
|
||||
|
||||
if (height <= size.Height) vertAlignment = VertAlignment.Top;
|
||||
float y0;
|
||||
switch (vertAlignment)
|
||||
{
|
||||
default:
|
||||
case VertAlignment.Top: y0 = y; break;
|
||||
case VertAlignment.Middle: y0 = y + (height - size.Height) / 2; break;
|
||||
case VertAlignment.Bottom: y0 = y + (height - size.Height); break;
|
||||
}
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float x0;
|
||||
switch (horizAlignment)
|
||||
{
|
||||
default:
|
||||
case Alignment.Left: x0 = x; break;
|
||||
case Alignment.Center: x0 = x + (width - e.Graphics.MeasureString(line, font).Width) / 2; break;
|
||||
case Alignment.Right: x0 = x + width - e.Graphics.MeasureString(line, font).Width; break;
|
||||
}
|
||||
e.Graphics.DrawString(line, font, Brushes.Black, new PointF(x0, y0));
|
||||
y0 += 0.8f * lastSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Output.Printers
|
||||
{
|
||||
public enum TableLines
|
||||
{
|
||||
None,
|
||||
FirstAndLast,
|
||||
FirstSecondAndLast,
|
||||
All,
|
||||
}
|
||||
|
||||
public class TableStyle
|
||||
{
|
||||
public float MarginX;
|
||||
public float MarginY;
|
||||
public Font Font;
|
||||
public Font HeaderFont;
|
||||
public int TopHeadersCount;
|
||||
public int LeftHeadersCount;
|
||||
public float LineWidth;
|
||||
public TableLines HorizLines;
|
||||
public TableLines VertLines;
|
||||
}
|
||||
|
||||
public class Table
|
||||
{
|
||||
public readonly int ColumnsCount;
|
||||
public int RowsCount { get { return Rows.Count; } }
|
||||
|
||||
public readonly IList<string[]> Rows;
|
||||
public readonly IList<Alignment[]> HorizAlignments;
|
||||
public readonly IList<VertAlignment[]> VertAlignments;
|
||||
public TableStyle Style;
|
||||
|
||||
|
||||
public Table(int columnsCount)
|
||||
{
|
||||
ColumnsCount = columnsCount;
|
||||
|
||||
Rows = new List<string[]>();
|
||||
HorizAlignments = new List<Alignment[]>();
|
||||
VertAlignments = new List<VertAlignment[]>();
|
||||
Style = new TableStyle();
|
||||
}
|
||||
|
||||
|
||||
public void AddRow(string[] texts, Alignment[] horizAlignment, VertAlignment[] vertAlignemnt)
|
||||
{
|
||||
Rows.Add(texts);
|
||||
HorizAlignments.Add(horizAlignment);
|
||||
VertAlignments.Add(vertAlignemnt);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when table has either rows or columns count == 0
|
||||
/// </summary>
|
||||
/// <returns>true when empty</returns>
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return (Rows == null || RowsCount == 0 || Rows[0] == null || Rows[0].Length == 0);
|
||||
}
|
||||
|
||||
|
||||
public SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
SizeF retVal = new SizeF(0, 0);
|
||||
|
||||
if (IsEmpty()) return retVal; /// Empty table => zero Size
|
||||
|
||||
float[] columnWidth = new float[ColumnsCount];
|
||||
float[] rowHeight = new float[RowsCount];
|
||||
|
||||
///
|
||||
/// Measure table column widths and header height
|
||||
///
|
||||
for (int colIx = 0; colIx < ColumnsCount; colIx++)
|
||||
{
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] == null)
|
||||
{
|
||||
/// Separator row -> do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
|
||||
SizeF size = PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
|
||||
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasLineToTheLeft = (Style.VertLines == TableLines.All)
|
||||
|| ((Style.VertLines == TableLines.FirstAndLast) && (colIx == 0))
|
||||
|| ((Style.VertLines == TableLines.FirstSecondAndLast) && (colIx <= 1));
|
||||
|
||||
retVal.Width += columnWidth[colIx] + (hasLineToTheLeft ? (Style.LineWidth + Style.MarginX) : 0) + Style.MarginX;
|
||||
}
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] == null)
|
||||
{
|
||||
/// Separator row -> do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
bool hasLineAbove = (Style.HorizLines == TableLines.All)
|
||||
|| ((Style.HorizLines == TableLines.FirstAndLast) && (rowIx == 0))
|
||||
|| ((Style.HorizLines == TableLines.FirstSecondAndLast) && (rowIx <= 1))
|
||||
|| ((rowIx >= 1) && (Rows[rowIx - 1] == null));
|
||||
|
||||
retVal.Height += rowHeight[rowIx] + (hasLineAbove ? (Style.LineWidth + Style.MarginY) : 0) + Style.MarginY;
|
||||
}
|
||||
}
|
||||
|
||||
if (Style.VertLines == TableLines.None) retVal.Width -= Style.MarginX;
|
||||
if (Style.HorizLines == TableLines.None) retVal.Height -= Style.MarginY;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
public float Draw(System.Drawing.Printing.PrintPageEventArgs e, float left, float top)
|
||||
{
|
||||
if (IsEmpty()) return top; /// Empty table
|
||||
|
||||
int tblColumnsCount = Rows[0].Length;
|
||||
|
||||
float[] columnWidth = new float[tblColumnsCount];
|
||||
float[] columnPos = new float[tblColumnsCount];
|
||||
float[] vertLinePos = new float[tblColumnsCount + 1];
|
||||
|
||||
float[] rowHeight = new float[RowsCount];
|
||||
float[] rowPos = new float[RowsCount];
|
||||
float[] horizLinePos = new float[RowsCount + 1];
|
||||
|
||||
///
|
||||
/// Measure table column widths and header height
|
||||
///
|
||||
vertLinePos[0] = left;
|
||||
horizLinePos[0] = top;
|
||||
for (int colIx = 0; colIx < tblColumnsCount; colIx++)
|
||||
{
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] != null)
|
||||
{
|
||||
/// In not a separator line
|
||||
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
|
||||
SizeF size = PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
|
||||
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
|
||||
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Separator line -> do nothing
|
||||
rowHeight[rowIx] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasLineToTheLeft = (Style.VertLines == TableLines.All)
|
||||
|| ((Style.VertLines == TableLines.FirstAndLast) && (colIx == 0))
|
||||
|| ((Style.VertLines == TableLines.FirstSecondAndLast) && (colIx <= 1));
|
||||
|
||||
columnPos[colIx] = vertLinePos[colIx] + (hasLineToTheLeft ? (Style.LineWidth + Style.MarginX) : 0);
|
||||
vertLinePos[colIx + 1] = columnPos[colIx] + columnWidth[colIx] + Style.MarginX;
|
||||
}
|
||||
for (int rowIx = 0; rowIx < RowsCount; rowIx++)
|
||||
{
|
||||
if (Rows[rowIx] != null)
|
||||
{
|
||||
/// In not a separator line
|
||||
bool hasLineAbove = (Style.HorizLines == TableLines.All)
|
||||
|| ((Style.HorizLines == TableLines.FirstAndLast) && (rowIx == 0))
|
||||
|| ((Style.HorizLines == TableLines.FirstSecondAndLast) && (rowIx <= 1))
|
||||
|| ((rowIx >= 1) && (Rows[rowIx - 1] == null));
|
||||
|
||||
rowPos[rowIx] = horizLinePos[rowIx] + (hasLineAbove ? Style.MarginY : 0);
|
||||
horizLinePos[rowIx + 1] = rowPos[rowIx] + rowHeight[rowIx] + Style.LineWidth + Style.MarginY;
|
||||
}
|
||||
else if (rowIx > 0)
|
||||
{
|
||||
/// Separator line
|
||||
rowPos[rowIx] = rowPos[rowIx - 1];
|
||||
horizLinePos[rowIx + 1] = horizLinePos[rowIx];
|
||||
}
|
||||
}
|
||||
|
||||
/// Horizontal lines
|
||||
float tableLeftX = left;
|
||||
float tableRightX = vertLinePos[tblColumnsCount] + Style.LineWidth;
|
||||
if (Style.HorizLines != TableLines.None)
|
||||
{
|
||||
for (int rowIx = 0; rowIx <= RowsCount; rowIx++)
|
||||
{
|
||||
if (Style.HorizLines == TableLines.All || rowIx == 0
|
||||
|| rowIx == RowsCount
|
||||
|| (Style.HorizLines == TableLines.FirstSecondAndLast && rowIx == 1)
|
||||
|| ((rowIx >= 1) && (Rows[rowIx - 1] == null)))
|
||||
{
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, Style.LineWidth), new PointF(tableLeftX, horizLinePos[rowIx] + Style.LineWidth / 2), new PointF(tableRightX, horizLinePos[rowIx] + Style.LineWidth / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Vertical lines
|
||||
float tableTopY = top;
|
||||
float tableBottomY = horizLinePos[RowsCount] + Style.LineWidth;
|
||||
if (Style.VertLines != TableLines.None)
|
||||
{
|
||||
for (int colIx = 0; colIx <= tblColumnsCount; colIx++)
|
||||
{
|
||||
if (Style.VertLines == TableLines.All || colIx == 0 || colIx == ColumnsCount || (Style.VertLines == TableLines.FirstSecondAndLast && colIx == 1))
|
||||
{
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, Style.LineWidth), new PointF(vertLinePos[colIx] + Style.LineWidth / 2, tableTopY), new PointF(vertLinePos[colIx] + Style.LineWidth / 2, tableBottomY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Draw table body
|
||||
///
|
||||
for (int rowIndex = 0; rowIndex < RowsCount; rowIndex++)
|
||||
{
|
||||
string[] oneTableRow = Rows[rowIndex];
|
||||
if (oneTableRow != null)
|
||||
{
|
||||
Alignment[] horizAlignment = HorizAlignments[(RowsCount > rowIndex) ? rowIndex : 0];
|
||||
VertAlignment[] vertAlignment = VertAlignments[(RowsCount > rowIndex) ? rowIndex : 0];
|
||||
for (int colIndex = 0; colIndex < tblColumnsCount; colIndex++)
|
||||
{
|
||||
bool isHeader = (colIndex < Style.LeftHeadersCount) || (rowIndex < Style.TopHeadersCount);
|
||||
PrintersCommon.PrintAt(e, oneTableRow[colIndex],
|
||||
isHeader ? Style.HeaderFont : Style.Font,
|
||||
columnPos[colIndex],
|
||||
rowPos[rowIndex],
|
||||
columnWidth[colIndex],
|
||||
rowHeight[rowIndex],
|
||||
horizAlignment[colIndex],
|
||||
vertAlignment[colIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tableBottomY;
|
||||
}
|
||||
|
||||
|
||||
public static Table Create_TestsAreRows(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, TableStyle style)
|
||||
{
|
||||
/// Top row contains column captions
|
||||
|
||||
Table table = new Table(items.Count);
|
||||
table.Style = style;
|
||||
|
||||
string[] tableHeader = new string[table.ColumnsCount];
|
||||
Alignment[] horizAlignment = new Alignment[table.ColumnsCount];
|
||||
VertAlignment[] vertAlignment = new VertAlignment[table.ColumnsCount];
|
||||
for (int i = 0; i < table.ColumnsCount; i++)
|
||||
{
|
||||
tableHeader[i] = items[i].Caption;
|
||||
horizAlignment[i] = Alignment.Center;
|
||||
vertAlignment[i] = VertAlignment.Middle;
|
||||
}
|
||||
table.AddRow(tableHeader, horizAlignment, vertAlignment);
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
string[] oneTableRow = new string[table.ColumnsCount];
|
||||
horizAlignment = new Alignment[table.ColumnsCount];
|
||||
vertAlignment = new VertAlignment[table.ColumnsCount];
|
||||
|
||||
for (int i = 0; i < table.ColumnsCount; i++)
|
||||
{
|
||||
WMeterRsltItemSpec.TableColumnNr = i + 1;
|
||||
oneTableRow[i] = items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
horizAlignment[i] = items[i].Alignment;
|
||||
vertAlignment[i] = VertAlignment.Middle;
|
||||
}
|
||||
|
||||
table.AddRow(oneTableRow, horizAlignment, vertAlignment);
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
}
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
public static Table Create_TestsAreColumns(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, TableStyle style)
|
||||
{
|
||||
/// Left column contains row captions
|
||||
|
||||
///
|
||||
/// Calculate columns count
|
||||
///
|
||||
int columnsCount = 1; /// Left column contains item caption
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
columnsCount++; /// One additional column for each test to be published
|
||||
}
|
||||
}
|
||||
|
||||
Table table = new Table(columnsCount);
|
||||
table.Style = style;
|
||||
|
||||
///
|
||||
/// Table content
|
||||
///
|
||||
WMeterRsltItemSpec.TableRowNr = 1;
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string[] oneTableRow = new string[columnsCount];
|
||||
Alignment[] horizAlignment = new Alignment[columnsCount];
|
||||
VertAlignment[] vertAlignment = new VertAlignment[columnsCount];
|
||||
|
||||
oneTableRow[0] = items[i].Caption;
|
||||
horizAlignment[0] = Alignment.Center;
|
||||
vertAlignment[0] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
/// Strip color information
|
||||
oneTableRow[WMeterRsltItemSpec.TableColumnNr] =
|
||||
items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
horizAlignment[WMeterRsltItemSpec.TableColumnNr] = items[i].Alignment;
|
||||
vertAlignment[WMeterRsltItemSpec.TableColumnNr] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr++;
|
||||
}
|
||||
}
|
||||
|
||||
table.AddRow(oneTableRow, horizAlignment, vertAlignment);
|
||||
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
public static Table Create_TestsAreColumnsPL(Results.Entities.WaterMeter wm, IList<WMeterRsltItemSpec> items, TableStyle style)
|
||||
{
|
||||
/// Left column contains row captions
|
||||
|
||||
///
|
||||
/// Calculate columns count
|
||||
///
|
||||
int columnsCount = 2; /// Left two columns contain item caption and units
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
columnsCount++; /// One additional column for each test to be published
|
||||
}
|
||||
}
|
||||
|
||||
Table table = new Table(columnsCount);
|
||||
table.Style = style;
|
||||
|
||||
///
|
||||
/// Table content
|
||||
///
|
||||
WMeterRsltItemSpec.TableRowNr = 1;
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
if (items[i].Uid == (int)ItemID.Separator)
|
||||
{
|
||||
table.AddRow(null, null, null); /// 'separator' row
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] oneTableRow = new string[columnsCount];
|
||||
Alignment[] horizAlignment = new Alignment[columnsCount];
|
||||
VertAlignment[] vertAlignment = new VertAlignment[columnsCount];
|
||||
|
||||
oneTableRow[0] = items[i].Caption;
|
||||
horizAlignment[0] = Alignment.Center;
|
||||
vertAlignment[0] = VertAlignment.Middle;
|
||||
|
||||
oneTableRow[1] = (i == 0) ? "Jednostka" : items[i].Units.ToDescription();
|
||||
horizAlignment[1] = Alignment.Center;
|
||||
vertAlignment[1] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr = 1;
|
||||
foreach (var mtr in wm.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
|
||||
{
|
||||
int colIx = WMeterRsltItemSpec.TableColumnNr + 1;
|
||||
|
||||
/// Strip color information
|
||||
oneTableRow[colIx] = items[i].Print(wm, mtr.Name()).Split(new char[] { '|' })[0];
|
||||
horizAlignment[colIx] = items[i].Alignment;
|
||||
vertAlignment[colIx] = VertAlignment.Middle;
|
||||
|
||||
WMeterRsltItemSpec.TableColumnNr++;
|
||||
}
|
||||
}
|
||||
|
||||
table.AddRow(oneTableRow, horizAlignment, vertAlignment);
|
||||
}
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,504 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using Results;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.Zapiska
|
||||
{
|
||||
public class ZapiskaPrintDocument : PrintDocument
|
||||
{
|
||||
const float GapBetweenTableColumns = 10.0f;
|
||||
const float GapBetweenCommonColumns = 10.0f;
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight; /// in 0.254 mm = 0.01 in
|
||||
readonly int printWidth; /// in 0.254 mm = 0.01 in
|
||||
|
||||
readonly int topMargin; /// in 0.254 mm = 0.01 in
|
||||
readonly int bottomMargin; /// in 0.254 mm = 0.01 in
|
||||
readonly int leftMargin; /// in 0.254 mm = 0.01 in
|
||||
|
||||
readonly float leftMarginCommon1;
|
||||
readonly float leftMarginCommon2;
|
||||
readonly float leftMarginCommon3;
|
||||
readonly float leftMarginBelow1;
|
||||
readonly float leftMarginBelow2;
|
||||
readonly float leftMarginBelow3;
|
||||
|
||||
readonly float spacingOne;
|
||||
readonly float spacingOne4Header;
|
||||
|
||||
float commonTop; /// = TitleY + 60
|
||||
float bodyTop; /// = HdrTop + 160
|
||||
///
|
||||
float titleHeight;
|
||||
float commonHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Property variable for the Font the user wishes to use
|
||||
/// </summary>
|
||||
Font titleFont;
|
||||
Font headerFont;
|
||||
Font font;
|
||||
Font footerFont;
|
||||
|
||||
///
|
||||
/// Data to print
|
||||
///
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
ZapiskaPrinterCfg cfg;
|
||||
|
||||
///
|
||||
/// Items to print
|
||||
///
|
||||
string header;
|
||||
IList<WMeterRsltItemSpec> commonItems1;
|
||||
IList<WMeterRsltItemSpec> commonItems2;
|
||||
IList<WMeterRsltItemSpec> commonItems3;
|
||||
IList<WMeterRsltItemSpec> selectedItems;
|
||||
IList<WMeterRsltItemSpec> belowItems1;
|
||||
IList<WMeterRsltItemSpec> belowItems2;
|
||||
IList<WMeterRsltItemSpec> belowItems3;
|
||||
string footer;
|
||||
|
||||
///
|
||||
/// Layout and status
|
||||
///
|
||||
int tablesOnFirstPage;
|
||||
int tablesOnNextPage;
|
||||
int nrPages;
|
||||
int pageNr; /// Page number to be printed at the bottom of the page
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="textToPrint">Text to be printed</param>
|
||||
public ZapiskaPrintDocument(Results.Entities.Batch batch, ZapiskaPrinterCfg cfg, string documentName)
|
||||
{
|
||||
this.batch = batch;
|
||||
DocumentName = documentName;
|
||||
|
||||
this.cfg = cfg;
|
||||
topMargin = cfg.TopMargin;
|
||||
bottomMargin = cfg.BottomMargin;
|
||||
leftMargin = cfg.LeftMargin;
|
||||
|
||||
header = string.IsNullOrEmpty(cfg.Header) ? string.Empty : cfg.Header.Replace("~", Environment.NewLine);
|
||||
commonItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems1);
|
||||
commonItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems2);
|
||||
commonItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.CommonItems3);
|
||||
selectedItems = Results.WMeterRsltItemSpec.FromStrArray(cfg.SelectedItems);
|
||||
belowItems1 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems1);
|
||||
belowItems2 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems2);
|
||||
belowItems3 = Results.WMeterRsltItemSpec.FromStrArray(cfg.BelowItems3);
|
||||
footer = string.IsNullOrEmpty(cfg.Footer) ? string.Empty : cfg.Footer.Replace("~", Environment.NewLine);
|
||||
|
||||
/// Initialize fonts
|
||||
titleFont = new Font((cfg.TitFntFml != null ? cfg.TitFntFml : "Arial"), (cfg.TitFntSz > 0 ? cfg.TitFntSz : 10), (FontStyle)cfg.TitFntSty);
|
||||
headerFont = new Font((cfg.HdrFntFml != null ? cfg.HdrFntFml : "Arial"), (cfg.HdrFntSz > 0 ? cfg.HdrFntSz : 10), (FontStyle)cfg.HdrFntSty);
|
||||
font = new Font((cfg.BodyFntFml != null ? cfg.BodyFntFml : "Arial"), (cfg.BodyFntSz > 0 ? cfg.BodyFntSz : 10), (FontStyle)cfg.BodyFntSty);
|
||||
footerFont = new Font((cfg.FooterFntFml != null ? cfg.FooterFntFml : "Arial"), (cfg.FooterFntSz > 0 ? cfg.FooterFntSz : 10), (FontStyle)cfg.FooterFntSty);
|
||||
|
||||
/// Set print area size and margins (in dots using 100 dpi)
|
||||
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
|
||||
///
|
||||
if (DefaultPageSettings.Landscape)
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Width - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Height - leftMargin - leftMargin;
|
||||
}
|
||||
else
|
||||
{
|
||||
printHeight = base.DefaultPageSettings.PaperSize.Height - topMargin - bottomMargin;
|
||||
printWidth = base.DefaultPageSettings.PaperSize.Width - leftMargin - leftMargin;
|
||||
}
|
||||
|
||||
leftMarginCommon1 = leftMargin + printWidth * 0.01f * cfg.ColW0Pct;
|
||||
leftMarginCommon2 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct);
|
||||
leftMarginCommon3 = leftMargin + printWidth * 0.01f * (cfg.ColW0Pct + cfg.ColW1Pct + cfg.ColW2Pct);
|
||||
|
||||
leftMarginBelow1 = leftMargin + printWidth * 0.01f * cfg.BelowW0Pct;
|
||||
leftMarginBelow2 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct);
|
||||
leftMarginBelow3 = leftMargin + printWidth * 0.01f * (cfg.BelowW0Pct + cfg.BelowW1Pct + cfg.BelowW2Pct);
|
||||
|
||||
spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
|
||||
spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
|
||||
|
||||
pageNr = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default onbeginPrint method of the PrintDocument Object
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks></remarks>
|
||||
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
|
||||
{
|
||||
base.OnBeginPrint(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override the default OnPrintPage method of the PrintDocument.
|
||||
/// </summary>
|
||||
/// <param name=e></param>
|
||||
/// <remarks>This provides the print logic for our document</remarks>
|
||||
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
/// Run base code
|
||||
base.OnPrintPage(e);
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cfg.Template))
|
||||
{
|
||||
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
|
||||
if (File.Exists(templatePath))
|
||||
{
|
||||
if (cfg.PageOrientation == PageOrientation.Portrait)
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 827, 1169), new Rectangle(0, 0, 827, 1169));
|
||||
else
|
||||
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), 1169, 827), new Rectangle(0, 0, 1169, 827));
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the table rows count
|
||||
int tableRowsCount = 0;
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
{
|
||||
if (!cfg.GoodOnly || wm.Passed) tableRowsCount++;
|
||||
}
|
||||
|
||||
/// Prepare document outline
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
commonTop = cfg.TopMargin + titleHeight + spacingOne4Header;
|
||||
|
||||
int commonCount = Math.Max(commonItems1.Count, Math.Max(commonItems2.Count, commonItems3.Count));
|
||||
commonHeight = commonCount * spacingOne;
|
||||
bodyTop = commonTop + commonHeight + spacingOne4Header;
|
||||
|
||||
float wmSectionHeight = (tableRowsCount + 1) * spacingOne + 3 * spacingOne4Header;
|
||||
|
||||
tablesOnFirstPage = (int)Math.Floor((printHeight - bodyTop + (float)cfg.TopMargin - 2 * spacingOne) / wmSectionHeight);
|
||||
tablesOnNextPage = Math.Max(1, (int)Math.Floor((printHeight - 2 * spacingOne) / wmSectionHeight)); /// Min. 1, prevent division by zero
|
||||
|
||||
if (tablesOnFirstPage >= 1)
|
||||
nrPages = 1;
|
||||
else
|
||||
nrPages = 2;
|
||||
}
|
||||
|
||||
/// Use the StringFormat class for the text layout of our document
|
||||
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
|
||||
|
||||
if (pageNr == 1)
|
||||
{
|
||||
///----------
|
||||
/// Title
|
||||
///----------
|
||||
float titleWid = e.Graphics.MeasureString(header, titleFont).Width;
|
||||
RectangleF printArea = new RectangleF(cfg.LeftMargin + Math.Max(0, (printWidth - titleWid)) / 2, cfg.TopMargin,
|
||||
titleWid, titleHeight);
|
||||
e.Graphics.DrawString(header, titleFont, Brushes.Black, printArea);
|
||||
|
||||
///----------------
|
||||
/// Common items
|
||||
///----------------
|
||||
for (int n = 1; n <= 3; n++)
|
||||
{
|
||||
IList<WMeterRsltItemSpec> commonItems;
|
||||
float lMargin;
|
||||
switch (n)
|
||||
{
|
||||
default:
|
||||
case 1: commonItems = commonItems1; lMargin = leftMarginCommon1; break;
|
||||
case 2: commonItems = commonItems2; lMargin = leftMarginCommon2; break;
|
||||
case 3: commonItems = commonItems3; lMargin = leftMarginCommon3; break;
|
||||
}
|
||||
|
||||
if (commonItems.Count == 0) continue; /// Common part is empty
|
||||
|
||||
string[] leftColumn = new string[commonItems.Count];
|
||||
string[] rightColumn = new string[commonItems.Count];
|
||||
|
||||
int cnt = 0;
|
||||
foreach (var v in commonItems)
|
||||
{
|
||||
leftColumn[cnt] = v.Caption;
|
||||
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/// Determine left column width
|
||||
float leftColWidth = 0;
|
||||
foreach (var paragraph in leftColumn)
|
||||
{
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float itemWidth = Measure(e, paragraph, this.font).Width;
|
||||
if (itemWidth > leftColWidth)
|
||||
{
|
||||
leftColWidth = itemWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
PrintAt(e, lMargin, commonTop + spacingOne * i, leftColWidth, leftColumn[i], this.font, commonItems[i].Alignment);
|
||||
PrintAt(e, lMargin + leftColWidth + GapBetweenCommonColumns, commonTop + spacingOne * i, 0, rightColumn[i], this.font, Alignment.Left);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///--------
|
||||
/// Body
|
||||
///--------
|
||||
|
||||
/// This variable represents the top coordinate of the area where WM results are printed
|
||||
/// and it is updated (increased by) the value returned by PrintXyzWM() - the section size.
|
||||
float nextTableTop = (pageNr == 1) ? bodyTop : cfg.TopMargin;
|
||||
|
||||
if (tablesOnFirstPage > 0 || pageNr == 2)
|
||||
{
|
||||
nextTableTop += PrintWMs(e, batch.WaterMeters, nextTableTop);
|
||||
}
|
||||
|
||||
e.HasMorePages = (nrPages > 1) && (pageNr == 1);
|
||||
|
||||
///----------------
|
||||
/// Below items
|
||||
///----------------
|
||||
for (int n = 1; n <= 3; n++)
|
||||
{
|
||||
IList<WMeterRsltItemSpec> belowItems;
|
||||
float lMargin;
|
||||
switch (n)
|
||||
{
|
||||
default:
|
||||
case 1: belowItems = belowItems1; lMargin = leftMarginBelow1; break;
|
||||
case 2: belowItems = belowItems2; lMargin = leftMarginBelow2; break;
|
||||
case 3: belowItems = belowItems3; lMargin = leftMarginBelow3; break;
|
||||
}
|
||||
|
||||
if (belowItems.Count == 0) continue; /// Below part is empty
|
||||
|
||||
string[] leftColumn = new string[belowItems.Count];
|
||||
string[] rightColumn = new string[belowItems.Count];
|
||||
|
||||
int cnt = 0;
|
||||
foreach (var v in belowItems)
|
||||
{
|
||||
leftColumn[cnt] = v.Caption;
|
||||
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
/// Determine left column width
|
||||
float leftColWidth = 0;
|
||||
foreach (var paragraph in leftColumn)
|
||||
{
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float itemWidth = e.Graphics.MeasureString(paragraph, font).Width + 1;
|
||||
if (itemWidth > leftColWidth) leftColWidth = itemWidth;
|
||||
}
|
||||
}
|
||||
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
PrintAt(e, lMargin, nextTableTop + spacingOne * i, leftColWidth, leftColumn[i], this.font, belowItems[i].Alignment);
|
||||
PrintAt(e, lMargin + leftColWidth + GapBetweenCommonColumns, nextTableTop + spacingOne * i, 0, rightColumn[i], this.font, Alignment.Left);
|
||||
}
|
||||
}
|
||||
|
||||
///----------
|
||||
/// Footer
|
||||
///----------
|
||||
float footerWidth = Measure(e, footer, footerFont).Width;
|
||||
PrintAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * spacingOne, 0, footer, footerFont, Alignment.Left);
|
||||
|
||||
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
|
||||
float pageNrWidth = e.Graphics.MeasureString(pageNrText, font).Width;
|
||||
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, 0, pageNrText, font, Alignment.Left);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Print one water meter results
|
||||
/// </summary>
|
||||
/// <param name="wm">Water meter</param>
|
||||
/// <param name="printedWMNr">Number of the water meter printed</param>
|
||||
/// <param name="top">Top coordinate of watermeter data</param>
|
||||
/// <returns>The height of the printed section</returns>
|
||||
float PrintWMs(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
IList<Results.Entities.WaterMeter> wms, float top)
|
||||
{
|
||||
///
|
||||
/// Prepare table content
|
||||
///
|
||||
int tableColumnsCount = selectedItems.Count;
|
||||
///
|
||||
string[] tableHeader = new string[tableColumnsCount];
|
||||
IList<string[]> tableRows = new List<string[]>();
|
||||
Alignment[] itemAlignment = new Alignment[tableColumnsCount];
|
||||
///
|
||||
for (int i = 0; i < tableColumnsCount; i++)
|
||||
{
|
||||
tableHeader[i] = selectedItems[i].Caption;
|
||||
itemAlignment[i] = selectedItems[i].Alignment;
|
||||
}
|
||||
///
|
||||
WMeterRsltItemSpec.TableRowNr = 0;
|
||||
foreach (var wm in wms)
|
||||
{
|
||||
if (!cfg.GoodOnly || wm.Passed)
|
||||
{
|
||||
string[] oneTableRow = new string[tableColumnsCount];
|
||||
WMeterRsltItemSpec.TableRowNr++;
|
||||
|
||||
for (int i = 0; i < tableColumnsCount; i++)
|
||||
{
|
||||
WMeterRsltItemSpec.TableColumnNr = i + 1;
|
||||
oneTableRow[i] = selectedItems[i].Print(wm).Split(new char[] { '|' })[0]; /// Strip color information
|
||||
}
|
||||
|
||||
tableRows.Add(oneTableRow);
|
||||
}
|
||||
}
|
||||
|
||||
return DrawTable(e, leftMargin, top, tableHeader, tableRows, itemAlignment);
|
||||
}
|
||||
|
||||
|
||||
float DrawTable(System.Drawing.Printing.PrintPageEventArgs e, float left, float top, string[] header, IList<string[]> rows, Alignment[] alignment)
|
||||
{
|
||||
int tblColumnsCount = header.Length;
|
||||
|
||||
float[] columnWidth = new float[tblColumnsCount];
|
||||
float[] columnPos = new float[tblColumnsCount + 1];
|
||||
columnPos[0] = left;
|
||||
|
||||
///
|
||||
/// Measure table column widths and header height
|
||||
///
|
||||
float headerHeight = 0;
|
||||
for (int i = 0; i < tblColumnsCount; i++)
|
||||
{
|
||||
SizeF size = Measure(e, header[i], headerFont);
|
||||
columnWidth[i] = size.Width;
|
||||
if (size.Height > headerHeight) headerHeight = size.Height;
|
||||
|
||||
foreach (var tableRow in rows)
|
||||
{
|
||||
float width = Measure(e, tableRow[i], font).Width + 1;
|
||||
if (width > columnWidth[i]) columnWidth[i] = width;
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth[i] + GapBetweenTableColumns;
|
||||
}
|
||||
|
||||
float tableLeftX = columnPos[0];
|
||||
float tableRightX = columnPos[tblColumnsCount] - GapBetweenTableColumns;
|
||||
|
||||
/// Horizontal line
|
||||
float horY = top + 1.5f * spacingOne4Header;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new PointF(tableLeftX, horY), new PointF(tableRightX, horY));
|
||||
|
||||
///
|
||||
/// Draw table header
|
||||
///
|
||||
for (int i = 0; i < tblColumnsCount; i++)
|
||||
{
|
||||
PrintAt(e, columnPos[i],
|
||||
top + 1.7f * spacingOne4Header,
|
||||
columnWidth[i],
|
||||
header[i],
|
||||
headerFont,
|
||||
Alignment.Center);
|
||||
}
|
||||
/// Horizontal line
|
||||
horY = top + 2.1f * spacingOne4Header + headerHeight;
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new PointF(tableLeftX, horY), new PointF(tableRightX, horY));
|
||||
|
||||
///
|
||||
/// Draw table body
|
||||
///
|
||||
int rowsCount = 0;
|
||||
foreach (var oneTableRow in rows)
|
||||
{
|
||||
for (int i = 0; i < tblColumnsCount; i++)
|
||||
{
|
||||
PrintAt(e, columnPos[i],
|
||||
horY + 0.2f * spacingOne4Header + spacingOne * rowsCount,
|
||||
columnWidth[i],
|
||||
oneTableRow[i],
|
||||
font,
|
||||
alignment[i]);
|
||||
}
|
||||
rowsCount++;
|
||||
}
|
||||
|
||||
/// Horizontal line
|
||||
horY = horY + spacingOne * rowsCount + (3 * spacingOne4Header / 10);
|
||||
e.Graphics.DrawLine(new Pen(Color.Black, 2), new PointF(tableLeftX, horY), new PointF(tableRightX, horY));
|
||||
|
||||
return horY - top + spacingOne;
|
||||
}
|
||||
|
||||
|
||||
static Font lastFont = null;
|
||||
static float lastSpacing = 0;
|
||||
|
||||
SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e, string paragraph, Font font)
|
||||
{
|
||||
if (font != lastFont)
|
||||
{
|
||||
lastFont = font;
|
||||
lastSpacing = e.Graphics.MeasureString("Abcgq", font).Height;
|
||||
}
|
||||
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
float width = 0;
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float lineWid = e.Graphics.MeasureString(line, font).Width;
|
||||
if (lineWid > width) width = lineWid;
|
||||
}
|
||||
|
||||
return new SizeF(width, 0.8f * lines.Length * lastSpacing + 0.2f);
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, float x, float y, float width, string paragraph, Font font, Alignment alignment)
|
||||
{
|
||||
SizeF size = Measure(e, paragraph, font);
|
||||
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
float xx;
|
||||
switch (alignment)
|
||||
{
|
||||
default:
|
||||
case Alignment.Left: xx = x; break;
|
||||
case Alignment.Center: xx = x + (width - e.Graphics.MeasureString(line, font).Width) / 2; break;
|
||||
case Alignment.Right: xx = x + width - e.Graphics.MeasureString(line, font).Width; break;
|
||||
}
|
||||
e.Graphics.DrawString(line, font, Brushes.Black, new PointF(xx, y));
|
||||
y += 0.8f * lastSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.Zapiska
|
||||
{
|
||||
public class ZapiskaPrinterCfg
|
||||
{
|
||||
public Config.Entities.PageOrientation PageOrientation;
|
||||
public string Template;
|
||||
public int TopMargin;
|
||||
public int BottomMargin;
|
||||
public int LeftMargin;
|
||||
public string TitFntFml;
|
||||
public int TitFntSz;
|
||||
public int TitFntSty;
|
||||
public string HdrFntFml;
|
||||
public int HdrFntSz;
|
||||
public int HdrFntSty;
|
||||
public string BodyFntFml;
|
||||
public int BodyFntSz;
|
||||
public int BodyFntSty;
|
||||
public string FooterFntFml;
|
||||
public int FooterFntSz;
|
||||
public int FooterFntSty;
|
||||
public bool SupressPrinting; /// Bypass printing when true
|
||||
public bool GoodOnly;
|
||||
public System.Globalization.CultureInfo CultureInfo;
|
||||
|
||||
public string Header; /// =Title
|
||||
public int ColW0Pct;
|
||||
public int ColW1Pct;
|
||||
public int ColW2Pct;
|
||||
public string[] CommonItems1;
|
||||
public string[] CommonItems2;
|
||||
public string[] CommonItems3;
|
||||
public string[] SelectedItems;
|
||||
public int BelowW0Pct;
|
||||
public int BelowW1Pct;
|
||||
public int BelowW2Pct;
|
||||
public string[] BelowItems1;
|
||||
public string[] BelowItems2;
|
||||
public string[] BelowItems3;
|
||||
public string Footer;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Results")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2017 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 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.14.619.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.619.0")]
|
||||
[assembly: AssemblyVersion("2.18.1041.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1041.0")]
|
||||
|
||||
Generated
+339
-6
@@ -69,6 +69,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Address.
|
||||
/// </summary>
|
||||
internal static string Address {
|
||||
get {
|
||||
return ResourceManager.GetString("Address", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Alignment.
|
||||
/// </summary>
|
||||
@@ -123,6 +132,24 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bench ID.
|
||||
/// </summary>
|
||||
internal static string Bench_ID {
|
||||
get {
|
||||
return ResourceManager.GetString("Bench_ID", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bench name.
|
||||
/// </summary>
|
||||
internal static string Bench_name {
|
||||
get {
|
||||
return ResourceManager.GetString("Bench_name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel.
|
||||
/// </summary>
|
||||
@@ -330,6 +357,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error flags.
|
||||
/// </summary>
|
||||
internal static string Error_flags {
|
||||
get {
|
||||
return ResourceManager.GetString("Error_flags", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to E rel. ref..
|
||||
/// </summary>
|
||||
@@ -339,6 +375,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed meters count.
|
||||
/// </summary>
|
||||
internal static string Failed_meters_count {
|
||||
get {
|
||||
return ResourceManager.GetString("Failed_meters_count", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to fall.
|
||||
/// </summary>
|
||||
@@ -402,6 +447,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Legalizator.
|
||||
/// </summary>
|
||||
internal static string Legalizator {
|
||||
get {
|
||||
return ResourceManager.GetString("Legalizator", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to main.
|
||||
/// </summary>
|
||||
@@ -564,6 +618,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Passed meters count.
|
||||
/// </summary>
|
||||
internal static string Passed_meters_count {
|
||||
get {
|
||||
return ResourceManager.GetString("Passed_meters_count", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to PO.
|
||||
/// </summary>
|
||||
@@ -600,6 +663,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Procedure description.
|
||||
/// </summary>
|
||||
internal static string Procedure_description {
|
||||
get {
|
||||
return ResourceManager.GetString("Procedure_description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Producer.
|
||||
/// </summary>
|
||||
@@ -762,6 +834,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to sensitivity.
|
||||
/// </summary>
|
||||
internal static string sensitivity {
|
||||
get {
|
||||
return ResourceManager.GetString("sensitivity", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Single.
|
||||
/// </summary>
|
||||
@@ -978,6 +1059,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Relative error of a meter in previous test/in production.
|
||||
/// </summary>
|
||||
internal static string Tooltip_E_rel_last {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_E_rel_last", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Relative error of the master meter.
|
||||
/// </summary>
|
||||
@@ -1032,6 +1122,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pressure difference measured by delta P meter - maximum during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_P_de_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_P_de_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pressure difference measured by delta P meter - mean.
|
||||
/// </summary>
|
||||
@@ -1041,6 +1140,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pressure difference measured by delta P meter - minimum during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_P_de_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_P_de_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pressure difference measured by delta P meter - at the start of the test.
|
||||
/// </summary>
|
||||
@@ -1077,6 +1185,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum pressure at the outlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_P_dw_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_P_dw_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean pressure at the outlet.
|
||||
/// </summary>
|
||||
@@ -1086,6 +1203,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Minimum pressure at the outlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_P_dw_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_P_dw_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pressure at the outlet at start of the test.
|
||||
/// </summary>
|
||||
@@ -1122,6 +1248,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum pressure at the inlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_P_up_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_P_up_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean pressure at the inlet.
|
||||
/// </summary>
|
||||
@@ -1131,6 +1266,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Minimum pressure at the inlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_P_up_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_P_up_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pressure at the inlet at start of the test.
|
||||
/// </summary>
|
||||
@@ -1140,6 +1284,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow obtained from the master meter - end.
|
||||
/// </summary>
|
||||
internal static string Tooltip_Q_end {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_Q_end", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow calculated from conventional true mass and time.
|
||||
/// </summary>
|
||||
@@ -1149,6 +1302,24 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow obtained from the master meter - max.
|
||||
/// </summary>
|
||||
internal static string Tooltip_Q_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_Q_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow obtained from the master meter - min.
|
||||
/// </summary>
|
||||
internal static string Tooltip_Q_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_Q_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow obtained from the master meter - actual.
|
||||
/// </summary>
|
||||
@@ -1168,7 +1339,16 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow calculated from conventional true volume and the time.
|
||||
/// Looks up a localized string similar to Flow obtained from the master meter - start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_Q_start {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_Q_start", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flow measured by the reference flow meter.
|
||||
/// </summary>
|
||||
internal static string Tooltip_Q_v_r {
|
||||
get {
|
||||
@@ -1176,6 +1356,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Calculated density of water from table or formula at water density calibration temperature (r).
|
||||
/// </summary>
|
||||
internal static string Tooltip_Rho_Wa_calc {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_Rho_Wa_calc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Serial number of the meter.
|
||||
/// </summary>
|
||||
@@ -1239,6 +1428,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum temperature at the diverter during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_di_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_di_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean temperature at diverter.
|
||||
/// </summary>
|
||||
@@ -1249,7 +1447,16 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the diverter at start of the test – first 4 measurements from the start.
|
||||
/// Looks up a localized string similar to Minimum temperature at the diverter during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_di_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_di_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the diverter at start of the test – first 4 measurements after the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_di_st {
|
||||
get {
|
||||
@@ -1284,6 +1491,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum temperature at the outlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_dw_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_dw_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean temperature at outlet.
|
||||
/// </summary>
|
||||
@@ -1294,7 +1510,16 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the outlet at start of the test – first 4 measurements from the start.
|
||||
/// Looks up a localized string similar to Minimum temperature at the outlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_dw_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_dw_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the outlet at start of the test – first 4 measurements after the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_dw_st {
|
||||
get {
|
||||
@@ -1302,6 +1527,78 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Actual temperature in the line.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_ac {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_ac", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Average temperature in the line during a test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_avg {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_avg", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature in the line at end of the test – last 4 measurement before the end.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_en {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_en", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum temperature in the line during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean temperature in the line during a test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_me {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_me", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Minimum temperature in the line during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature in the line at start of the test – first 4 measurements after the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_ln_st {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_ln_st", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature of water sample at water density calibration.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_rho_0 {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_rho_0", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Actual temperature at the inlet.
|
||||
/// </summary>
|
||||
@@ -1312,7 +1609,7 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Average temperature at the inlet.
|
||||
/// Looks up a localized string similar to Average temperature at the inlet during a test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_up_avg {
|
||||
get {
|
||||
@@ -1330,7 +1627,16 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean temperature at inlet.
|
||||
/// Looks up a localized string similar to Maximum temperature at the inlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_up_max {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_up_max", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Mean temperature at inlet during a test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_up_me {
|
||||
get {
|
||||
@@ -1339,7 +1645,16 @@ namespace Results.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the inlet at start of the test – first 4 measurements from the start.
|
||||
/// Looks up a localized string similar to Minimum temperature at the inlet during the test.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_up_min {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_T_up_min", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Temperature at the inlet at start of the test – first 4 measurements after the start.
|
||||
/// </summary>
|
||||
internal static string Tooltip_T_up_st {
|
||||
get {
|
||||
@@ -1374,6 +1689,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unit.
|
||||
/// </summary>
|
||||
internal static string Unit {
|
||||
get {
|
||||
return ResourceManager.GetString("Unit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Units.
|
||||
/// </summary>
|
||||
@@ -1401,6 +1725,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User description.
|
||||
/// </summary>
|
||||
internal static string User_description {
|
||||
get {
|
||||
return ResourceManager.GetString("User_description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User nr..
|
||||
/// </summary>
|
||||
|
||||
@@ -210,4 +210,46 @@
|
||||
<data name="to" xml:space="preserve">
|
||||
<value>do</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Jednotka</value>
|
||||
</data>
|
||||
<data name="Approval" xml:space="preserve">
|
||||
<value>Schválení</value>
|
||||
</data>
|
||||
<data name="Bench" xml:space="preserve">
|
||||
<value>Stanice</value>
|
||||
</data>
|
||||
<data name="Density" xml:space="preserve">
|
||||
<value>Hustota</value>
|
||||
</data>
|
||||
<data name="Density_correction" xml:space="preserve">
|
||||
<value>Korekce hustoty</value>
|
||||
</data>
|
||||
<data name="End" xml:space="preserve">
|
||||
<value>Konec</value>
|
||||
</data>
|
||||
<data name="Procedure" xml:space="preserve">
|
||||
<value>Procedura</value>
|
||||
</data>
|
||||
<data name="Procedure_description" xml:space="preserve">
|
||||
<value>Popis procedury</value>
|
||||
</data>
|
||||
<data name="Start" xml:space="preserve">
|
||||
<value>Začátek</value>
|
||||
</data>
|
||||
<data name="User" xml:space="preserve">
|
||||
<value>Uživatel</value>
|
||||
</data>
|
||||
<data name="User_description" xml:space="preserve">
|
||||
<value>Popis uživatele</value>
|
||||
</data>
|
||||
<data name="Bench_ID" xml:space="preserve">
|
||||
<value>ID stanice</value>
|
||||
</data>
|
||||
<data name="Bench_name" xml:space="preserve">
|
||||
<value>Jméno stanice</value>
|
||||
</data>
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Adresa</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -438,4 +438,7 @@
|
||||
<data name="to" xml:space="preserve">
|
||||
<value>do</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Jednostka</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -514,7 +514,7 @@
|
||||
<value>Flow obtained from the master meter - mean</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_v_r" xml:space="preserve">
|
||||
<value>Flow calculated from conventional true volume and the time</value>
|
||||
<value>Flow measured by the reference flow meter</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_ac" xml:space="preserve">
|
||||
<value>Actual temperature at the diverter</value>
|
||||
@@ -529,7 +529,7 @@
|
||||
<value>Mean temperature at diverter</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_st" xml:space="preserve">
|
||||
<value>Temperature at the diverter at start of the test – first 4 measurements from the start</value>
|
||||
<value>Temperature at the diverter at start of the test – first 4 measurements after the start</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_ac" xml:space="preserve">
|
||||
<value>Actual temperature at the outlet</value>
|
||||
@@ -544,22 +544,22 @@
|
||||
<value>Mean temperature at outlet</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_st" xml:space="preserve">
|
||||
<value>Temperature at the outlet at start of the test – first 4 measurements from the start</value>
|
||||
<value>Temperature at the outlet at start of the test – first 4 measurements after the start</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_ac" xml:space="preserve">
|
||||
<value>Actual temperature at the inlet</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_avg" xml:space="preserve">
|
||||
<value>Average temperature at the inlet</value>
|
||||
<value>Average temperature at the inlet during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_en" xml:space="preserve">
|
||||
<value>Temperature at the inlet at end of the test – last 4 measurement before the end</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_me" xml:space="preserve">
|
||||
<value>Mean temperature at inlet</value>
|
||||
<value>Mean temperature at inlet during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_st" xml:space="preserve">
|
||||
<value>Temperature at the inlet at start of the test – first 4 measurements from the start</value>
|
||||
<value>Temperature at the inlet at start of the test – first 4 measurements after the start</value>
|
||||
</data>
|
||||
<data name="aux" xml:space="preserve">
|
||||
<value>aux.</value>
|
||||
@@ -627,4 +627,115 @@
|
||||
<data name="Density_correction" xml:space="preserve">
|
||||
<value>Density correction</value>
|
||||
</data>
|
||||
<data name="Error_flags" xml:space="preserve">
|
||||
<value>Error flags</value>
|
||||
</data>
|
||||
<data name="Legalizator" xml:space="preserve">
|
||||
<value>Legalizator</value>
|
||||
</data>
|
||||
<data name="User_description" xml:space="preserve">
|
||||
<value>User description</value>
|
||||
</data>
|
||||
<data name="Failed_meters_count" xml:space="preserve">
|
||||
<value>Failed meters count</value>
|
||||
</data>
|
||||
<data name="Passed_meters_count" xml:space="preserve">
|
||||
<value>Passed meters count</value>
|
||||
</data>
|
||||
<data name="sensitivity" xml:space="preserve">
|
||||
<value>sensitivity</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_end" xml:space="preserve">
|
||||
<value>Flow obtained from the master meter - end</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_max" xml:space="preserve">
|
||||
<value>Flow obtained from the master meter - max</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_min" xml:space="preserve">
|
||||
<value>Flow obtained from the master meter - min</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_start" xml:space="preserve">
|
||||
<value>Flow obtained from the master meter - start</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_max" xml:space="preserve">
|
||||
<value>Maximum pressure at the outlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_min" xml:space="preserve">
|
||||
<value>Minimum pressure at the outlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_max" xml:space="preserve">
|
||||
<value>Maximum pressure at the inlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_min" xml:space="preserve">
|
||||
<value>Minimum pressure at the inlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_max" xml:space="preserve">
|
||||
<value>Maximum temperature at the diverter during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_min" xml:space="preserve">
|
||||
<value>Minimum temperature at the diverter during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_max" xml:space="preserve">
|
||||
<value>Maximum temperature at the outlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_min" xml:space="preserve">
|
||||
<value>Minimum temperature at the outlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_max" xml:space="preserve">
|
||||
<value>Maximum temperature at the inlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_min" xml:space="preserve">
|
||||
<value>Minimum temperature at the inlet during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_max" xml:space="preserve">
|
||||
<value>Pressure difference measured by delta P meter - maximum during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_min" xml:space="preserve">
|
||||
<value>Pressure difference measured by delta P meter - minimum during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_Rho_Wa_calc" xml:space="preserve">
|
||||
<value>Calculated density of water from table or formula at water density calibration temperature (r)</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_rho_0" xml:space="preserve">
|
||||
<value>Temperature of water sample at water density calibration</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_ac" xml:space="preserve">
|
||||
<value>Actual temperature in the line</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_avg" xml:space="preserve">
|
||||
<value>Average temperature in the line during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_en" xml:space="preserve">
|
||||
<value>Temperature in the line at end of the test – last 4 measurement before the end</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_max" xml:space="preserve">
|
||||
<value>Maximum temperature in the line during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_me" xml:space="preserve">
|
||||
<value>Mean temperature in the line during a test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_min" xml:space="preserve">
|
||||
<value>Minimum temperature in the line during the test</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_st" xml:space="preserve">
|
||||
<value>Temperature in the line at start of the test – first 4 measurements after the start</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Unit</value>
|
||||
</data>
|
||||
<data name="Procedure_description" xml:space="preserve">
|
||||
<value>Procedure description</value>
|
||||
</data>
|
||||
<data name="Bench_ID" xml:space="preserve">
|
||||
<value>Bench ID</value>
|
||||
</data>
|
||||
<data name="Bench_name" xml:space="preserve">
|
||||
<value>Bench name</value>
|
||||
</data>
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Address</value>
|
||||
</data>
|
||||
<data name="Tooltip_E_rel_last" xml:space="preserve">
|
||||
<value>Relative error of a meter in previous test/in production</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -429,4 +429,13 @@
|
||||
<data name="VName_Vol" xml:space="preserve">
|
||||
<value>Объем</value>
|
||||
</data>
|
||||
<data name="No" xml:space="preserve">
|
||||
<value>Нет</value>
|
||||
</data>
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Да</value>
|
||||
</data>
|
||||
<data name="Water_Meter" xml:space="preserve">
|
||||
<value>Счетчик воды</value>
|
||||
</data>
|
||||
</root>
|
||||
+15
-8
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -77,6 +77,9 @@
|
||||
<Compile Include="Forms\ListViewEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ListViewExtensions.cs" />
|
||||
<Compile Include="Forms\LviIntColumnComparer.cs" />
|
||||
<Compile Include="Forms\LviTextColumnComparer.cs" />
|
||||
<Compile Include="Forms\ResultsConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@@ -97,22 +100,26 @@
|
||||
<Compile Include="Mappings\TestRsltMap.cs" />
|
||||
<Compile Include="Mappings\WaterMeterDataMap.cs" />
|
||||
<Compile Include="Mappings\WaterMeterMap.cs" />
|
||||
<Compile Include="Output\Printers\Cevak\PrintDocumentCevak.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Enhanced\EnhancedPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Enhanced\EnhancedPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\PrintersCommon.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Munich\MunichPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\OnePagePerMeter\EnhancedPrintDocument.cs">
|
||||
<Compile Include="Output\Printers\OnePerMeter\OnePerMeterPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\OnePagePerMeter\EnhancedPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\OnePerMeter\OnePerMeterPrinterCfg.cs" />
|
||||
<Compile Include="Output\Printers\Table.cs" />
|
||||
<Compile Include="Output\Printers\Zapiska\ZapiskaPrintDocument.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Output\Printers\Zapiska\ZapiskaPrinterCfg.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ItemSpec.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
+30
-39
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -31,49 +31,40 @@ namespace Results
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts float number to a string with the specified number of significant digits
|
||||
/// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31).
|
||||
/// </summary>
|
||||
/// <param name="value">Float value to be converted to a string</param>
|
||||
/// <param name="validDigits">Number of significant digits: 4, 3, or 2 (otherwise a full precision number is printed)</param>
|
||||
/// <returns>String representation of the float number</returns>
|
||||
public static string DoubleToStr(double value, int validDigits)
|
||||
/// <param name="errorFlags">Input</param>
|
||||
/// <returns>Output string</returns>
|
||||
public static string ErrorFlagsStr(int errorFlags)
|
||||
{
|
||||
if (-float.Epsilon <= value && value <= float.Epsilon)
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
else if (validDigits == 4)
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
|
||||
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
|
||||
else if (value >= 9.995 || value < -9.995) return value.ToString("F2");
|
||||
else if (value >= 0.9995 || value < -0.9995) return value.ToString("F3");
|
||||
else if (value >= 0.09995 || value < -0.09995) return value.ToString("F4");
|
||||
else if (value >= 0.009995 || value < -0.009995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
if ((errorFlags & (1 << i)) != 0)
|
||||
{
|
||||
sb.Append("E");
|
||||
sb.Append(i + 1);
|
||||
sb.Append(" ");
|
||||
}
|
||||
}
|
||||
else if (validDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return value.ToString("F0");
|
||||
else if (value >= 9.95 || value < -9.95) return value.ToString("F1");
|
||||
else if (value >= 0.995 || value < -0.995) return value.ToString("F2");
|
||||
else if (value >= 0.0995 || value < -0.0995) return value.ToString("F3");
|
||||
else if (value >= 0.00995 || value < -0.00995) return value.ToString("F4");
|
||||
else if (value >= 0.000995 || value < -0.000995) return value.ToString("F5");
|
||||
else return value.ToString("F6");
|
||||
}
|
||||
else if (validDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return value.ToString("F0");
|
||||
else if (value >= 0.95 || value < -0.95) return value.ToString("F1");
|
||||
else if (value >= 0.095 || value < -0.095) return value.ToString("F2");
|
||||
else if (value >= 0.0095 || value < -0.0095) return value.ToString("F3");
|
||||
else if (value >= 0.00095 || value < -0.00095) return value.ToString("F4");
|
||||
else return value.ToString("F5");
|
||||
}
|
||||
else return value.ToString();
|
||||
return sb.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
public static string PassedColorStr(bool passed, bool useRedGreenColor)
|
||||
{
|
||||
#if PUCHONG_200
|
||||
return (useRedGreenColor) ? (passed ? "OK|Green" : "NG|Red") : (passed ? "OK|White" : "NG|White");
|
||||
#elif BAHRAIN_50 || DUBAJ_50
|
||||
return (useRedGreenColor) ? (passed ? "PASSED|Green" : "FAILED|Red") : (passed ? "PASSED|White" : "FAILED|White");
|
||||
#elif LANG_PL
|
||||
return (useRedGreenColor) ? (passed ? "+|Green" : "-|Red") : (passed ? "+|White" : "-|White");
|
||||
#elif LANG_RU
|
||||
return (useRedGreenColor) ? (passed ? "годен|Green" : "негоден|Red") : (passed ? "годен|White" : "негоден|White");
|
||||
#else
|
||||
return (useRedGreenColor) ? (passed ? "OK|Green" : "NOK|Red") : (passed ? "OK|White" : "NOK|White");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+407
-188
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,6 +7,7 @@ using Config;
|
||||
using Config.Entities;
|
||||
using Results.Entities;
|
||||
using Results.Resources;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Results
|
||||
{
|
||||
@@ -42,6 +43,11 @@ namespace Results
|
||||
return item2;
|
||||
}
|
||||
|
||||
|
||||
public static double RealDensity;
|
||||
public static double AtTemperature;
|
||||
|
||||
|
||||
///
|
||||
/// Function to pick a MeterTestResult field and convert it into a string
|
||||
///
|
||||
@@ -56,31 +62,33 @@ namespace Results
|
||||
}
|
||||
public string Print(WaterMeter waterMeterResult, string testId)
|
||||
{
|
||||
string str = printDlgt(waterMeterResult, testId, Units, Format, Precision);
|
||||
if (str == null) str = string.Empty;
|
||||
try
|
||||
{
|
||||
string str = printDlgt(waterMeterResult, testId, Units, Format, Precision);
|
||||
if (str == null) str = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(Format))
|
||||
{
|
||||
str = string.Format(Format, str);
|
||||
int len = str.Length;
|
||||
if (Width == 0 || len >= Width)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
else if (Alignment == Config.Entities.Alignment.Left)
|
||||
{
|
||||
return str + new string(' ', Width - len);
|
||||
}
|
||||
else if (Alignment == Config.Entities.Alignment.Right)
|
||||
{
|
||||
return new string(' ', Width - len) + str;
|
||||
}
|
||||
else // Alignment.Center or Alignment.Justified
|
||||
{
|
||||
int nrSpaces = Width - len;
|
||||
return new string(' ', nrSpaces / 2) + str + new string(' ', nrSpaces - (nrSpaces / 2));
|
||||
}
|
||||
}
|
||||
|
||||
int len = str.Length;
|
||||
if (Width == 0 || len >= Width)
|
||||
catch (Exception)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
else if (Alignment == Config.Entities.Alignment.Left)
|
||||
{
|
||||
return str + new string(' ', Width - len);
|
||||
}
|
||||
else if (Alignment == Config.Entities.Alignment.Right)
|
||||
{
|
||||
return new string(' ', Width - len) + str;
|
||||
}
|
||||
else // Alignment.Center or Alignment.Justified
|
||||
{
|
||||
int nrSpaces = Width - len;
|
||||
return new string(' ', nrSpaces / 2) + str + new string(' ', nrSpaces - (nrSpaces / 2));
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +104,10 @@ namespace Results
|
||||
Quantity = quantity;
|
||||
Category = category;
|
||||
this.printDlgt = printDlgt;
|
||||
|
||||
Format = string.Empty;
|
||||
Precision = string.Empty;
|
||||
TestID = string.Empty;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -110,244 +122,438 @@ namespace Results
|
||||
Quantity = quantity;
|
||||
Category = category;
|
||||
this.printDlgt = printDlgt;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get precision string
|
||||
/// </summary>
|
||||
/// <param name="p1">Parameter</param>
|
||||
/// <param name="p2">Default value when p1 is empty</param>
|
||||
/// <returns>Precision</returns>
|
||||
static string GetPr(string p1, string p2)
|
||||
{
|
||||
return string.IsNullOrEmpty(p1) ? p2 : p1;
|
||||
}
|
||||
Format = string.Empty;
|
||||
Precision = string.Empty;
|
||||
TestID = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
/// Static list of all available items
|
||||
public static readonly IList<WMeterRsltItemSpec> AllItems;
|
||||
|
||||
/// Static constructor that initializes the list of all items
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="WMeterRsltItemSpec"/> class.
|
||||
/// </summary>
|
||||
/// Static constructor that initializes the list of all items
|
||||
static WMeterRsltItemSpec()
|
||||
{
|
||||
AllItems = new List<WMeterRsltItemSpec>();
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.String, "String", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => f));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.String, "String", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => f));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Separator, "Separator", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => string.Empty));
|
||||
|
||||
/// Common
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test, Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.ProcedureName()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.BatchNr().ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + " *", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.ProcedureName())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Proc_description, Strings.Procedure_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProcedureDescription)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.BatchNr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())));
|
||||
|
||||
///
|
||||
/// Volume
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TargetVolume()).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeRef).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeMeter).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeStart).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeStart).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeStart).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeEnd).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeEnd).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).VolumeEnd).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).TargetVolume())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.VolumeCTV, string.Format("{0} CTV ()", Strings.VName_Vol), Quantity.Volume, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).VolumeCTV)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
|
||||
|
||||
///
|
||||
/// Mass
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start_raw, string.Format("{0} ST raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).MassStartRaw).ToString(GetPr(p, "F4"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start, string.Format("{0} ST ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).MassStart).ToString(GetPr(p, "F4"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end_raw, string.Format("{0} EN raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).MassEndRaw).ToString(GetPr(p, "F4"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end, string.Format("{0} EN ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).MassEnd).ToString(GetPr(p, "F4"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass, string.Format("{0} ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).MassEnd - w.GetTestRslt(t).MassStart).ToString(GetPr(p, "F4"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start_raw, string.Format("{0} ST raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).MassStartRaw)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_start, string.Format("{0} ST ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).MassStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end_raw, string.Format("{0} EN raw ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).MassEndRaw)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass_end, string.Format("{0} EN ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).MassEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mass, string.Format("{0} ()", Strings.VName_Mass), Quantity.Mass, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).MassEnd - w.GetTestRslt(t).MassStart)));
|
||||
|
||||
///
|
||||
/// Density
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).DensityOut.ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density_correction, Strings.Density_correction + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => w.Batch.DensityCorr.ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).DensityLine)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Density_correction, Strings.Density_correction + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.Batch.DensityCorr))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Rho_Wa_calc, string.Format("{0} of sample", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", RealDensity)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RhoDistilledWtrAtMeLineTemp, string.Format("{0} of distilled water at T line", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? 0 : Config.Formulas.DistilledWaterDensityFromTemp((w.GetTestRslt(t).TempUpMean + w.GetTestRslt(t).TempDownMean) / 2))));
|
||||
|
||||
///
|
||||
/// Time (duration), date and time
|
||||
/// Date and time
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_start_time, Strings.T_start + "()", Quantity.DateTime, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).StartTime.ToString() : string.Format(f, w.GetTestRslt(t).StartTime))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_end_time, Strings.T_end + "()", Quantity.DateTime, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(f) ? w.GetTestRslt(t).EndTime.ToString() : string.Format(f, w.GetTestRslt(t).EndTime))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).TestTime.ToString(GetPr(p, "F2"))));
|
||||
|
||||
///
|
||||
/// Time (duration)
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Timestamp_start, "Timestamp start ()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).TimestampStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Timestamp_end, "Timestamp end ()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).TimestampEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time_ni, Strings.T_s + "_ni()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "V3", w.GetMeterTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.PMax_test_time, "Pressure test time ()", "Pressure test time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsPMaxTest()) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TestTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_start_time, "Diverter start time ()", "Diverter start time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsDiverter()) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_end_time, "Diverter end time ()", "Diverter end time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsDiverter()) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_valve_open_time, "Start valve open time ()", "Start valve open time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsStartStop()) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_valve_close_time, "Start valve close time ()", "Start valve close time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsStartStop()) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterEnd)));
|
||||
|
||||
///
|
||||
/// 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) ? "" : w.GetTestRslt(t).Qfrom().ToString(GetPr(p, "F3"))));
|
||||
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) ? "" : w.GetTestRslt(t).Qto().ToString(GetPr(p, "F3"))));
|
||||
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) ? "" : Utils.DoubleToStr(Config.Units.ConvertTo(u, w.GetTestRslt(t).FlowVolume), 4)));
|
||||
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) ? "-" : Utils.DoubleToStr(w.QRise, 4)) : ""));
|
||||
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) ? "-" : Utils.DoubleToStr(w.QFall, 4)) : ""));
|
||||
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) ? "" : Utils.DoubleToStr(Config.Units.ConvertTo(u, w.GetTestRslt(t).FlowMean), 4)));
|
||||
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.Qc, string.Format("Qc"), "Calculated water meter flow", Quantity.Flow, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).VolumeCTV / w.GetMeterTestRslt(t).TestTime * 3.6 * w.GetMeterTestRslt(t).PulsesMaster / w.GetTestRslt(t).PulsesMaster)));
|
||||
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.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, "V3", (w.GetTestRslt(t).TestTime == 0) ? 0 : 3.6 * w.GetTestRslt(t).VolumeCTV / w.GetTestRslt(t).TestTime)));
|
||||
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_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, "V3", ((w.GetTestRslt(t).ConstMaster < float.Epsilon) ? 0 : (1 / w.GetTestRslt(t).ConstMaster)))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ConstMasterRaw, string.Format("k MID raw ()"), "Const. of the ref. flow meter uncorrected",Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", ((w.GetTestRslt(t).ConstMasterRaw < float.Epsilon) ? 0 : (1 / w.GetTestRslt(t).ConstMasterRaw)))));
|
||||
|
||||
///
|
||||
/// Temperature
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_mean, string.Format("{0} UP ME ()", Strings.VName_Temp), Strings.Tooltip_T_up_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempUpMean).ToString(GetPr(p, "F2"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_start, string.Format("{0} UP ST ()", Strings.VName_Temp), Strings.Tooltip_T_up_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempUpStart).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_end, string.Format("{0} UP EN ()", Strings.VName_Temp), Strings.Tooltip_T_up_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempUpEnd).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_avg, string.Format("{0} UP avg ()", Strings.VName_Temp), Strings.Tooltip_T_up_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempUpEnd) / 2).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_mean, string.Format("{0} DW ME ()", Strings.VName_Temp), Strings.Tooltip_T_dw_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDownMean).ToString(GetPr(p, "F2"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_start, string.Format("{0} DW ST ()", Strings.VName_Temp), Strings.Tooltip_T_dw_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDownStart).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_end, string.Format("{0} DW EN ()", Strings.VName_Temp), Strings.Tooltip_T_dw_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDownEnd).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_avg, string.Format("{0} DW avg ()", Strings.VName_Temp), Strings.Tooltip_T_dw_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).TempDownStart + w.GetTestRslt(t).TempDownEnd) / 2).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div, string.Format("{0} DI ME ()", Strings.VName_Temp), Strings.Tooltip_T_di_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivMean).ToString(GetPr(p, "F2"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_start, string.Format("{0} DI ST ()", Strings.VName_Temp), Strings.Tooltip_T_di_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivStart).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_end, string.Format("{0} DI EN ()", Strings.VName_Temp), Strings.Tooltip_T_di_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).TempDivEnd).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_avg, string.Format("{0} DI avg ()", Strings.VName_Temp), Strings.Tooltip_T_di_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).TempDivStart + w.GetTestRslt(t).TempDivEnd) / 2).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_mean, string.Format("{0} UP ME ()", Strings.VName_Temp), Strings.Tooltip_T_up_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_start, string.Format("{0} UP ST ()", Strings.VName_Temp), Strings.Tooltip_T_up_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_end, string.Format("{0} UP EN ()", Strings.VName_Temp), Strings.Tooltip_T_up_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_avg, string.Format("{0} UP avg ()", Strings.VName_Temp), Strings.Tooltip_T_up_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempUpEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_min, string.Format("{0} UP min ()", Strings.VName_Temp), Strings.Tooltip_T_up_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_up_max, string.Format("{0} UP max ()", Strings.VName_Temp), Strings.Tooltip_T_up_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempUpMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_mean, string.Format("{0} LN ME ()", Strings.VName_Temp), Strings.Tooltip_T_ln_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpMean + w.GetTestRslt(t).TempDownMean) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_start, string.Format("{0} LN ST ()", Strings.VName_Temp), Strings.Tooltip_T_ln_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempDownStart) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_end, string.Format("{0} LN EN ()", Strings.VName_Temp), Strings.Tooltip_T_ln_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpEnd + w.GetTestRslt(t).TempDownEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_avg, string.Format("{0} LN avg ()", Strings.VName_Temp), Strings.Tooltip_T_ln_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpStart + w.GetTestRslt(t).TempDownStart + w.GetTestRslt(t).TempUpEnd + w.GetTestRslt(t).TempDownEnd) / 4)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_min, string.Format("{0} LN min ()", Strings.VName_Temp), Strings.Tooltip_T_ln_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpMin + w.GetTestRslt(t).TempDownMin) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_line_max, string.Format("{0} LN max ()", Strings.VName_Temp), Strings.Tooltip_T_ln_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempUpMax + w.GetTestRslt(t).TempDownMax) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_mean, string.Format("{0} DW ME ()", Strings.VName_Temp), Strings.Tooltip_T_dw_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_start, string.Format("{0} DW ST ()", Strings.VName_Temp), Strings.Tooltip_T_dw_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_end, string.Format("{0} DW EN ()", Strings.VName_Temp), Strings.Tooltip_T_dw_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_avg, string.Format("{0} DW avg ()", Strings.VName_Temp), Strings.Tooltip_T_dw_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempDownStart + w.GetTestRslt(t).TempDownEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_min, string.Format("{0} DW min ()", Strings.VName_Temp), Strings.Tooltip_T_dw_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_down_max, string.Format("{0} DW max ()", Strings.VName_Temp), Strings.Tooltip_T_dw_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDownMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div, string.Format("{0} DI ME ()", Strings.VName_Temp), Strings.Tooltip_T_di_me, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_start, string.Format("{0} DI ST ()", Strings.VName_Temp), Strings.Tooltip_T_di_st, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_end, string.Format("{0} DI EN ()", Strings.VName_Temp), Strings.Tooltip_T_di_en, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_avg, string.Format("{0} DI avg ()", Strings.VName_Temp), Strings.Tooltip_T_di_avg, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).TempDivStart + w.GetTestRslt(t).TempDivEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_min, string.Format("{0} DI min ()", Strings.VName_Temp), Strings.Tooltip_T_di_min, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_div_max, string.Format("{0} DI max ()", Strings.VName_Temp), Strings.Tooltip_T_di_max, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TempDivMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_rho_0, string.Format("{0} RO0", Strings.VName_Temp), Strings.Tooltip_T_rho_0, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", AtTemperature)));
|
||||
#if HEAT_METERS
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_mean, string.Format("{0} hi me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom1).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_start, string.Format("{0} hi st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_end, string.Format("{0} hi en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom3).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_avg, string.Format("{0} hi av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).Custom2 + w.GetTestRslt(t).Custom3) / 2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_mean, string.Format("{0} lo me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom6).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_start, string.Format("{0} lo st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom7).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_end, string.Format("{0} lo en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom8).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_avg, string.Format("{0} lo av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_mean, string.Format("{0} hi me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom1)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_start, string.Format("{0} hi st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_end, string.Format("{0} hi en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom3)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Hi_avg, string.Format("{0} hi av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", (w.GetTestRslt(t).Custom2 + w.GetTestRslt(t).Custom3) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_mean, string.Format("{0} lo me", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom6)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_start, string.Format("{0} lo st", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom7)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_end, string.Format("{0} lo en", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).Custom8)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.T_Lo_avg, string.Format("{0} lo av", Strings.VName_Temp), Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", (w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2)));
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Pressure
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up, string.Format("{0} UP ME ()", Strings.VName_Press), Strings.Tooltip_P_up_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpMean).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_start, string.Format("{0} UP ST ()", Strings.VName_Press), Strings.Tooltip_P_up_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpStart).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_end, string.Format("{0} UP EN ()", Strings.VName_Press), Strings.Tooltip_P_up_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressUpEnd).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_avg, string.Format("{0} UP avg ()", Strings.VName_Press), Strings.Tooltip_P_up_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).PressUpStart + w.GetTestRslt(t).PressUpEnd) / 2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down, string.Format("{0} DW ME ()", Strings.VName_Press), Strings.Tooltip_P_dw_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownMean).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_start, string.Format("{0} DW ST ()", Strings.VName_Press), Strings.Tooltip_P_dw_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownStart).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_end, string.Format("{0} DW EN ()", Strings.VName_Press), Strings.Tooltip_P_dw_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDownEnd).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_avg, string.Format("{0} DW avg ()", Strings.VName_Press), Strings.Tooltip_P_dw_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).PressDownStart + w.GetTestRslt(t).PressDownEnd) / 2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean, string.Format("{0} DE ME ()", Strings.VName_Press), Strings.Tooltip_P_de_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDeltaMean).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_start, string.Format("{0} DE ST ()", Strings.VName_Press), Strings.Tooltip_P_de_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDeltaStart).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_end, string.Format("{0} DE EN ()", Strings.VName_Press), Strings.Tooltip_P_de_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).PressDeltaEnd).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_avg, string.Format("{0} DE avg ()", Strings.VName_Press), Strings.Tooltip_P_de_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).PressDeltaStart + w.GetTestRslt(t).PressDeltaEnd) / 2).ToString(GetPr(p, "F3"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up, string.Format("{0} UP ME ()", Strings.VName_Press), Strings.Tooltip_P_up_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_start, string.Format("{0} UP ST ()", Strings.VName_Press), Strings.Tooltip_P_up_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_end, string.Format("{0} UP EN ()", Strings.VName_Press), Strings.Tooltip_P_up_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_avg, string.Format("{0} UP avg ()", Strings.VName_Press), Strings.Tooltip_P_up_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressUpStart + w.GetTestRslt(t).PressUpEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_min, string.Format("{0} UP min ()", Strings.VName_Press), Strings.Tooltip_P_up_min, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_up_max, string.Format("{0} UP max ()", Strings.VName_Press), Strings.Tooltip_P_up_max, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down, string.Format("{0} DW ME ()", Strings.VName_Press), Strings.Tooltip_P_dw_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDownMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_start, string.Format("{0} DW ST ()", Strings.VName_Press), Strings.Tooltip_P_dw_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDownStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_end, string.Format("{0} DW EN ()", Strings.VName_Press), Strings.Tooltip_P_dw_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDownEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_avg, string.Format("{0} DW avg ()", Strings.VName_Press), Strings.Tooltip_P_dw_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressDownStart + w.GetTestRslt(t).PressDownEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_min, string.Format("{0} DW min ()", Strings.VName_Press), Strings.Tooltip_P_dw_min, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDownMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_down_max, string.Format("{0} DW max ()", Strings.VName_Press), Strings.Tooltip_P_dw_max, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDownMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean, string.Format("{0} DE ME ()", Strings.VName_Press), Strings.Tooltip_P_de_me, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_start, string.Format("{0} DE ST ()", Strings.VName_Press), Strings.Tooltip_P_de_st, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaStart)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_end, string.Format("{0} DE EN ()", Strings.VName_Press), Strings.Tooltip_P_de_en, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_avg, string.Format("{0} DE avg ()", Strings.VName_Press), Strings.Tooltip_P_de_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressDeltaStart + w.GetTestRslt(t).PressDeltaEnd) / 2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_min, string.Format("{0} DE min ()", Strings.VName_Press), Strings.Tooltip_P_de_min, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMin)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_max, string.Format("{0} DE max ()", Strings.VName_Press), Strings.Tooltip_P_de_max, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_per_mtr, string.Format("{0} DE ME per mtr.()", Strings.VName_Press), "P delta mean per one meter", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMean / Math.Max(1, w.GetTestRslt(t).Batch.WaterMeters.Count))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_from_up_down, string.Format("{0} UP-DW ME ()", Strings.VName_Press), "P delta mean from UP/DW", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMean - w.GetTestRslt(t).PressDownMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_from_up_down_per_mtr, string.Format("{0} UP-DW ME per mtr ()", Strings.VName_Press), "P delta mean from UP/DW per one meter", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressUpMean - w.GetTestRslt(t).PressDownMean) / Math.Max(1, w.GetTestRslt(t).Batch.WaterMeters.Count))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.P_PMax_test_mean, string.Format("{0} PMax mean ()", Strings.VName_Press), "Mean PMax test pressure", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsPMaxTest()) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressUpMean + w.GetTestRslt(t).PressDownMean) / 2)));
|
||||
|
||||
///
|
||||
/// Ambient temperature/pressure/humidity/Buoyancy
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_temperature, string.Format("{0} Amb M", Strings.VName_Temp), Strings.Tooltip_T_Amb_M, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbTempMean()).ToString(GetPr(p, "F1")) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbTempMean).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_pressure, string.Format("{0} Amb M", Strings.VName_Press), Strings.Tooltip_P_Amb_M, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbPressMean()).ToString(GetPr(p, "F0")) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbPressMean).ToString(GetPr(p, "F0"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_humidity, string.Format("{0} Amb M", Strings.VName_Humi), Strings.Tooltip_Hu_Amb_M, Quantity.Humidity, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? Config.Units.ConvertTo(u, w.Batch.AmbHumiMean()).ToString(GetPr(p, "F1")) : Config.Units.ConvertTo(u, w.GetTestRslt(t).AmbHumiMean).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Buoyancy, "Buoyancy ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.Batch.Buoyancy().ToString(GetPr(p, "F5")) : ((w.GetTestRslt(t) != null) ? w.GetTestRslt(t).Buoyancy.ToString(GetPr(p, "F5")) : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_temperature, string.Format("{0} Amb M", Strings.VName_Temp), Strings.Tooltip_T_Amb_M, Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetTestRslt(t) == null) ? w.Batch.AmbTempMean() : w.GetTestRslt(t).AmbTempMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_pressure, string.Format("{0} Amb M", Strings.VName_Press), Strings.Tooltip_P_Amb_M, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? w.Batch.AmbPressMean() : w.GetTestRslt(t).AmbPressMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Ambient_humidity, string.Format("{0} Amb M", Strings.VName_Humi), Strings.Tooltip_Hu_Amb_M, Quantity.Humidity, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V2", (w.GetTestRslt(t) == null) ? w.Batch.AmbHumiMean() : w.GetTestRslt(t).AmbHumiMean)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Amb_temp_start_end, string.Format("{0} Amb ST/EN", Strings.VName_Temp), Quantity.Temperature, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.GetTestRslt(t) == null) ? w.Batch.AmbTempStart() : w.GetTestRslt(t).AmbTempStart, (w.GetTestRslt(t) == null) ? w.Batch.AmbTempEnd() : w.GetTestRslt(t).AmbTempEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Amb_press_start_end, string.Format("{0} Amb ST/EN", Strings.VName_Press), Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? w.Batch.AmbPressStart(): w.GetTestRslt(t).AmbPressStart, (w.GetTestRslt(t) == null) ? w.Batch.AmbPressEnd() : w.GetTestRslt(t).AmbPressEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Amb_humi_start_end, string.Format("{0} Amb ST/EN", Strings.VName_Humi), Quantity.Humidity, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V2", (w.GetTestRslt(t) == null) ? w.Batch.AmbHumiStart() : w.GetTestRslt(t).AmbHumiStart, (w.GetTestRslt(t) == null) ? w.Batch.AmbHumiEnd() : w.GetTestRslt(t).AmbHumiEnd)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Buoyancy, "Buoyancy ()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? FormatDbl(u, f, p, "V6", w.Batch.Buoyancy()) : ((w.GetTestRslt(t) != null) ? FormatDbl(u, f, p, "V6", (w.GetTestRslt(t).Buoyancy)) : "")));
|
||||
|
||||
///
|
||||
/// Error
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Lo, Strings.ErrLimLo + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimLo()).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrLimHi()).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Uncertainty().ToString(GetPr(p, "F2"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).ErrorMaster).ToString(GetPr(p, "F3"))));
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(GetPr(p, "F2"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Lo, Strings.ErrLimLo + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimLo())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimHi())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error_corr, string.Format("{0} ref.corr. ()", Strings.VName_Error), "Relative error of the reference flow meter after correction using correction curve", Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", Config.Formulas.ErrorFromVolumes(w.GetTestRslt(t).ConstMasterCorr, w.GetTestRslt(t).ConstMaster))));
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.LastError, string.Format("{0} rel. last ()", Strings.VName_Error), Strings.Tooltip_E_rel_last, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).LastError)));
|
||||
#else
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(GetPr(p, "F2"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr() : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr())));
|
||||
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.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
|
||||
///
|
||||
/// Water meter info
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeter_type, Strings.WM_Type, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ProductName));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Producer, Strings.Producer, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Producer));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeter_type, Strings.WM_Type, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.ProductName)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Producer, Strings.Producer, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Producer)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.DN, "DN", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.DN).ToString()
|
||||
: Config.Units.ConvertTo(u, w.WaterMeterData.DN).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.L, "L", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.L).ToString()
|
||||
: Config.Units.ConvertTo(u, w.WaterMeterData.L).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mounting, Strings.Mounting, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Mounting.ToDescription()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.DN, "DN", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V2", w.WaterMeterData.DN)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.L, "L", Quantity.Length, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.WaterMeterData.L)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Mounting, Strings.Mounting, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Mounting.ToDescription())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q4, "Q4_Qmax", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.WaterMeterData.Q4_Qmax)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q3, "Q3_Qn", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V2", w.WaterMeterData.Q3_Qn)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2, "Q2_Qt", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.WaterMeterData.Q2_Qt)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q1, "Q1_Qmin", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.WaterMeterData.Q1_Qmin)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q4, "Q4_Qmax", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString()
|
||||
: Config.Units.ConvertTo(u, w.WaterMeterData.Q4_Qmax).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q3, "Q3_Qn", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn).ToString()
|
||||
: Config.Units.ConvertTo(u, w.WaterMeterData.Q3_Qn).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2, "Q2_Qt", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString()
|
||||
: Config.Units.ConvertTo(u, w.WaterMeterData.Q2_Qt).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q1, "Q1_Qmin", Quantity.Flow, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString()
|
||||
: Config.Units.ConvertTo(u, w.WaterMeterData.Q1_Qmin).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Metrological_class, Strings.MClass, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.MetrologicalClass)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Temperature_class, "Temperature class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.TemperatureClass.ToDescription())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pressure_loss_class, "Pressure loss class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.PressureLossClass.ToDescription())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_admissible_pressure, "Max. admissible pressure", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.MaxAdmissiblePressure.ToDescription())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_profile_sensitivity_class, "Flow profile sensitivity class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.FlowProfileSensitivityClass.ToDescription())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.ApprovalInfo)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Certificate)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Medium, "Water cold/hot", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Medium.ToDescription())));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Metrological_class, Strings.MClass, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.MetrologicalClass));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Temperature_class, "Temperature class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.TemperatureClass.ToDescription()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pressure_loss_class, "Pressure loss class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.PressureLossClass.ToDescription()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_admissible_pressure, "Max. admissible pressure", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.MaxAdmissiblePressure.ToDescription()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow_profile_sensitivity_class, "Flow profile sensitivity class", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.FlowProfileSensitivityClass.ToDescription()));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ApprovalInfo));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.Certificate));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? w.WaterMeterData.PulsesPerLtr.ToString()
|
||||
: w.WaterMeterData.PulsesPerLtr.ToString(p)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text1));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text2));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text3, "Text3", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text3));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text4, "Text4", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text4));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text5, "Text5", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Text5));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text1)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text3, "Text3", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text3)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text4, "Text4", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text4)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Text5, "Text5", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text5)));
|
||||
|
||||
/// Water meters results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, Strings.Tooltip_sn, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNr));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.PurchaseOrder));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.YearOfProduction.ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.WMPosition.ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr, Strings.sn, Strings.Tooltip_sn, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Purchase_order, Strings.PO, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.PurchaseOrder)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Year_of_production, Strings.Year, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.YearOfProduction)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_Position, Strings.Pos, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.WMPosition)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Formatted_WM_ID, "Formatted WM ID", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? string.Format("{0}-{1}", w.BatchNr(), w.WMPosition) : string.Format(f, w.StartTime(), w.EndTime(), w.BatchNr(), w.WMPosition, w.SerialNr)));
|
||||
|
||||
/// Water meters results (single)
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMeter.ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t).PulsesPerLiter.ToString()
|
||||
: w.GetMeterTestRslt(t).PulsesPerLiter.ToString(p))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PulsesMaster.ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsPulses() ? w.GetMeterTestRslt(t).PulsesMeter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses_ni, Strings.RefPulses + "_ni()", Quantity.Pulses, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).PulsesMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Pulses, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetTestRslt(t).PulsesMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle, "Angle ()", "Angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesMeter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle_start, "Start angle ()", "Start angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).VolumeStart * w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle_end, "End angle ()", "End angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).VolumeEnd * w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", w.WaterMeterData.PulsesPerLtr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulse__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? 0 : w.GetMeterTestRslt(t).PulsesPerLiter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Degree__liter, "Degree per liter ()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
|
||||
|
||||
/// Water meters results (combined)
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error.ToString() : w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error.ToString(p))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : (string.IsNullOrEmpty(p) ? w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error.ToString()
|
||||
: w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error.ToString(p))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_main, string.Format("{0} {1}", Strings.sn, Strings.main), Strings.Tooltip_sn_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNr));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, string.Format("{0} {1}", Strings.sn, Strings.aux), Strings.Tooltip_sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.SerialNrAux));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndState));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => w.EndStateAux));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_main, string.Format("{0} {1}", Strings.sn, Strings.main), Strings.Tooltip_sn_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, string.Format("{0} {1}", Strings.sn, Strings.aux), Strings.Tooltip_sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNrAux)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndStateAux)));
|
||||
|
||||
/// Batch info
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.TestBenchId.ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.ProgramVersion));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.UserName));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => w.Batch.UserNumber.ToString()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeters, Strings.WMs, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.WatermetersStr));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Protocol_title, Strings.Protocol, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.Batch.ProtocolTitle));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_start_time, Strings.Start, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.StartTime.ToString() : string.Format(f, w.Batch.StartTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_end_time, Strings.End, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.EndTime.ToString() : string.Format(f, w.Batch.EndTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Lite_per_pulse_Read, "1 / PlsPerLtr_Read", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(p) ? ((w.WaterMeterData.PulsesPerLtr != 0) ? 1 / w.WaterMeterData.PulsesPerLtr : 0).ToString()
|
||||
: ((w.WaterMeterData.PulsesPerLtr != 0) ? 1 / w.WaterMeterData.PulsesPerLtr : 0).ToString(p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_ID, Strings.Bench_ID, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.TestBenchId.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_name, Strings.Bench_name, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.TestBenchName) ? w.Batch.TestBenchName : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address1, Strings.Address + " 1", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address1) ? w.Batch.Address1 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address2, Strings.Address + " 2", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address2) ? w.Batch.Address2 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address3, Strings.Address + " 3", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address3) ? w.Batch.Address3 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address4, Strings.Address + " 4", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address4) ? w.Batch.Address4 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address5, Strings.Address + " 5", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address5) ? w.Batch.Address5 : "")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProgramVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.UserNumber)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToUserName(w.Batch.UserName))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_description, Strings.User_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToFullName(w.Batch.UserName))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Legalizator, Strings.Legalizator, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToLegalizator(w.Batch.UserName))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeters, Strings.WMs, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.WatermetersStr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Protocol_title, Strings.Protocol, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProtocolTitle)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_start_time, Strings.Start, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.StartTime.ToString() : string.Format(f, w.Batch.StartTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_end_time, Strings.End, Quantity.DateTime, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.Batch.EndTime.ToString() : string.Format(f, w.Batch.EndTime)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Lite_per_pulse_Read, "1 / PlsPerLtr_Read", Quantity.PulsePerLtr, ItemCategory.Other, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.WaterMeterData.PulsesPerLtr != 0) ? 1/w.WaterMeterData.PulsesPerLtr : 0)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed_meters_count, Strings.Passed_meters_count, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.PassedMetersCount())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Failed_meters_count, Strings.Failed_meters_count, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.FailedMetersCount())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed_seals_count, "Seals count of passed meters", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.PassedMetersCount() * int.Parse(w.WaterMeterData.Text5))));
|
||||
|
||||
/// Extra water meter data
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? w.ResultCode.ToString() : string.Format(f, w.ResultCode)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => w.Batch.Remark));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ResultCode)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, w.Batch.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
|
||||
|
||||
#if HEAT_METERS
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef).ToString(GetPr(p, "F1"))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef))));
|
||||
#endif
|
||||
|
||||
#if IPERL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.OrigCalibFactor.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.CalibFactor.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2ErrWOCorrection.ToString(GetPr(p, "F2")))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? "yes" : "no")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrRFlow.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrLFlow.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrFlowRight.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => (w.FWVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactorLNA,"iPerl OrigCalibFactorLNA",Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactorLNA)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactorLNA, "iPerl CalibFactorLNA", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactorLNA)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100))));
|
||||
#endif
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).TestDone) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null && w.GetMeterTestRslt(t).Passed) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).TestDone)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).Passed)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlags, Strings.Error_flags + "()", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) != null) ? w.GetTestRslt(t).ErrorFlagsStr() : w.ErrorFlagsStr())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ErrorFlagsEx, Strings.Error_flags + "Ex", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ErrorFlagsStrEx())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E1, "E1 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0001) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E2, "E2 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0002) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E3, "E3 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0004) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E4, "E4 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0008) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E5, "E5 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0010) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E6, "E6 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0020) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E7, "E7 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0040) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E8, "E8 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0080) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E9, "E9 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0100) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E10, "E10 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0200) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E11, "E11 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0400) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E12, "E12 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x0800) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E13, "E13 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x1000) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E14, "E14 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x2000) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E15, "E15 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x4000) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E16, "E16 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x8000) != 0) ? Strings.Yes : Strings.No));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.E21, "E21 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x100000) != 0) ? Strings.Yes : Strings.No));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_row_nr, "Table row #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableRowNr.ToString() : string.Format(f, TableRowNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_column_nr, "Table column #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableColumnNr.ToString() : string.Format(f, TableColumnNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WMRemark, string.Format("{0} {1}", Strings.Water_Meter, Strings.Remark), Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.Remark)));
|
||||
}
|
||||
|
||||
/// To be updated by Output.FileWriter or Output.Printer
|
||||
public static int TableRowNr;
|
||||
public static int TableColumnNr;
|
||||
|
||||
|
||||
public static string FormatStr(string format, string value)
|
||||
{
|
||||
return string.IsNullOrEmpty(format) ? value : string.Format(format, value);
|
||||
}
|
||||
|
||||
public static string FormatBool(string format, bool value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(format))
|
||||
{
|
||||
return value ? Strings.Yes : Strings.No;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] yesNo = format.Split(new char[] { '~' });
|
||||
return value ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Strings.No);
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatInt(string format, int value)
|
||||
{
|
||||
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
|
||||
}
|
||||
|
||||
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v)
|
||||
{
|
||||
return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v, CultureInfo.CurrentCulture);
|
||||
}
|
||||
///
|
||||
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v, CultureInfo ci)
|
||||
{
|
||||
double val = Config.Units.ConvertTo(units, v);
|
||||
|
||||
string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty;
|
||||
|
||||
/// Modify "Vx" precision specification to an appropriate "Fx" format specification
|
||||
if (precision.Contains("V"))
|
||||
{
|
||||
int significantDigits;
|
||||
if (int.TryParse(precision.Substring(1), out significantDigits))
|
||||
{
|
||||
precision = Config.Utils.SignificantDigitsToFmt(val, significantDigits);
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(format))
|
||||
{
|
||||
if (-float.Epsilon <= val && val <= float.Epsilon)
|
||||
return "0";
|
||||
else
|
||||
return val.ToString(precision, ci);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-float.Epsilon <= val && val <= float.Epsilon)
|
||||
return string.Format(format, "0");
|
||||
else
|
||||
return string.Format(format, val.ToString(precision, ci));
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2)
|
||||
{
|
||||
return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v1, v2, CultureInfo.CurrentCulture);
|
||||
}
|
||||
///
|
||||
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci)
|
||||
{
|
||||
double val1 = Config.Units.ConvertTo(units, v1);
|
||||
double val2 = Config.Units.ConvertTo(units, v2);
|
||||
|
||||
string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty;
|
||||
|
||||
/// Modify "Vx" precision specification to an appropriate "Fx" format specification
|
||||
if (precision.Contains("V"))
|
||||
{
|
||||
int significantDigits;
|
||||
if (int.TryParse(precision.Substring(1), out significantDigits))
|
||||
{
|
||||
precision = Config.Utils.SignificantDigitsToFmt(val1, significantDigits);
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(format))
|
||||
{
|
||||
return string.Format("{0} {1}",
|
||||
(-float.Epsilon <= val1 && val1 <= float.Epsilon) ? "0" : val1.ToString(precision, ci),
|
||||
(-float.Epsilon <= val2 && val2 <= float.Epsilon) ? "0" : val2.ToString(precision, ci));
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format(format,
|
||||
(-float.Epsilon <= val1 && val1 <= float.Epsilon) ? "0" : val1.ToString(precision, ci),
|
||||
(-float.Epsilon <= val2 && val2 <= float.Epsilon) ? "0" : val2.ToString(precision, ci));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of 'Output item specifications' to a string array
|
||||
/// </summary>
|
||||
@@ -359,12 +565,17 @@ namespace Results
|
||||
string[] result = new string[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (items[i].Caption == null) items[i].Caption = string.Empty;
|
||||
if (items[i].TestID == null) items[i].TestID = string.Empty;
|
||||
if (items[i].Format == null) items[i].Format = string.Empty;
|
||||
if (items[i].Precision == null) items[i].Precision = string.Empty;
|
||||
|
||||
result[i] = string.Format("{0}~{1}~{2}~{3}~{4}~{5}~{6}~{7}",
|
||||
items[i].Uid,
|
||||
items[i].Caption,
|
||||
items[i].Caption.Replace("~", "\n"),
|
||||
items[i].TestID,
|
||||
items[i].Units,
|
||||
items[i].Format,
|
||||
items[i].Format.Replace("~", "\n"),
|
||||
items[i].Precision,
|
||||
items[i].Width,
|
||||
items[i].Alignment);
|
||||
@@ -425,14 +636,14 @@ namespace Results
|
||||
///
|
||||
/// Load the new style results item specification
|
||||
///
|
||||
item.Caption = field[1];
|
||||
item.Caption = field[1].Replace("\n", "~");
|
||||
item.TestID = field[2];
|
||||
item.Units = 0;
|
||||
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
|
||||
{
|
||||
if (u.ToString().Equals(field[3])) { item.Units = u; break; }
|
||||
}
|
||||
item.Format = field[4];
|
||||
item.Format = field[4].Replace("\n", "~");
|
||||
item.Precision = field[5];
|
||||
item.Width = int.Parse(field[6]);
|
||||
item.Alignment = 0;
|
||||
@@ -481,5 +692,13 @@ namespace Results
|
||||
{
|
||||
return GetItem((int)itemId);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Caption))
|
||||
return Caption;
|
||||
else
|
||||
return ((ItemID)Uid).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ namespace ResultsBrowser
|
||||
|
||||
public string[] ResultItems;
|
||||
|
||||
public string PrinterClass;
|
||||
public string PrinterCfg;
|
||||
|
||||
[XmlArrayAttribute("ResultsClmnWidths")]
|
||||
public int[] ResultsClmnWidths;
|
||||
[XmlIgnore]
|
||||
|
||||
+199
-199
@@ -28,204 +28,204 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.languageLabel = new System.Windows.Forms.Label();
|
||||
this.languageTextBox = new System.Windows.Forms.TextBox();
|
||||
this.formatLabel = new System.Windows.Forms.Label();
|
||||
this.timePeriodFormatTextBox = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// connectionStringTextBox1
|
||||
//
|
||||
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
|
||||
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
|
||||
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox1.TabIndex = 3;
|
||||
//
|
||||
// benchNameLabel
|
||||
//
|
||||
this.benchNameLabel.AutoSize = true;
|
||||
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
|
||||
this.benchNameLabel.Name = "benchNameLabel";
|
||||
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.benchNameLabel.TabIndex = 0;
|
||||
this.benchNameLabel.Text = "Bench name";
|
||||
//
|
||||
// connectionStringLabel
|
||||
//
|
||||
this.connectionStringLabel.AutoSize = true;
|
||||
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
|
||||
this.connectionStringLabel.Name = "connectionStringLabel";
|
||||
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.connectionStringLabel.TabIndex = 1;
|
||||
this.connectionStringLabel.Text = "Connection string";
|
||||
//
|
||||
// connectionStringTextBox2
|
||||
//
|
||||
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
|
||||
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
|
||||
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox2.TabIndex = 5;
|
||||
//
|
||||
// connectionStringTextBox3
|
||||
//
|
||||
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
|
||||
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
|
||||
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox3.TabIndex = 7;
|
||||
//
|
||||
// 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(506, 250);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.okButton.TabIndex = 16;
|
||||
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(617, 250);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.cancelButton.TabIndex = 17;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// benchNameTextBox1
|
||||
//
|
||||
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
|
||||
this.benchNameTextBox1.Name = "benchNameTextBox1";
|
||||
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox1.TabIndex = 2;
|
||||
//
|
||||
// benchNameTextBox2
|
||||
//
|
||||
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
|
||||
this.benchNameTextBox2.Name = "benchNameTextBox2";
|
||||
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox2.TabIndex = 4;
|
||||
//
|
||||
// benchNameTextBox3
|
||||
//
|
||||
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
|
||||
this.benchNameTextBox3.Name = "benchNameTextBox3";
|
||||
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox3.TabIndex = 6;
|
||||
//
|
||||
// languageLabel
|
||||
//
|
||||
this.languageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageLabel.AutoSize = true;
|
||||
this.languageLabel.Location = new System.Drawing.Point(26, 239);
|
||||
this.languageLabel.Name = "languageLabel";
|
||||
this.languageLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.languageLabel.TabIndex = 14;
|
||||
this.languageLabel.Text = "Language";
|
||||
//
|
||||
// languageTextBox
|
||||
//
|
||||
this.languageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageTextBox.Location = new System.Drawing.Point(29, 263);
|
||||
this.languageTextBox.Name = "languageTextBox";
|
||||
this.languageTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.languageTextBox.TabIndex = 15;
|
||||
//
|
||||
// formatLabel
|
||||
//
|
||||
this.formatLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.formatLabel.AutoSize = true;
|
||||
this.formatLabel.Location = new System.Drawing.Point(26, 185);
|
||||
this.formatLabel.Name = "formatLabel";
|
||||
this.formatLabel.Size = new System.Drawing.Size(39, 13);
|
||||
this.formatLabel.TabIndex = 12;
|
||||
this.formatLabel.Text = "Format";
|
||||
//
|
||||
// timePeriodFormatTextBox
|
||||
//
|
||||
this.timePeriodFormatTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.timePeriodFormatTextBox.Location = new System.Drawing.Point(29, 207);
|
||||
this.timePeriodFormatTextBox.Name = "timePeriodFormatTextBox";
|
||||
this.timePeriodFormatTextBox.Size = new System.Drawing.Size(683, 20);
|
||||
this.timePeriodFormatTextBox.TabIndex = 13;
|
||||
//
|
||||
// benchNameTextBox5
|
||||
//
|
||||
this.benchNameTextBox5.Location = new System.Drawing.Point(29, 149);
|
||||
this.benchNameTextBox5.Name = "benchNameTextBox5";
|
||||
this.benchNameTextBox5.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox5.TabIndex = 10;
|
||||
//
|
||||
// benchNameTextBox4
|
||||
//
|
||||
this.benchNameTextBox4.Location = new System.Drawing.Point(29, 123);
|
||||
this.benchNameTextBox4.Name = "benchNameTextBox4";
|
||||
this.benchNameTextBox4.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox4.TabIndex = 8;
|
||||
//
|
||||
// connectionStringTextBox5
|
||||
//
|
||||
this.connectionStringTextBox5.Location = new System.Drawing.Point(157, 149);
|
||||
this.connectionStringTextBox5.Name = "connectionStringTextBox5";
|
||||
this.connectionStringTextBox5.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox5.TabIndex = 11;
|
||||
//
|
||||
// connectionStringTextBox4
|
||||
//
|
||||
this.connectionStringTextBox4.Location = new System.Drawing.Point(157, 123);
|
||||
this.connectionStringTextBox4.Name = "connectionStringTextBox4";
|
||||
this.connectionStringTextBox4.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox4.TabIndex = 9;
|
||||
//
|
||||
// DatabaseSettingsDlg
|
||||
//
|
||||
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(743, 310);
|
||||
this.Controls.Add(this.benchNameTextBox5);
|
||||
this.Controls.Add(this.benchNameTextBox4);
|
||||
this.Controls.Add(this.connectionStringTextBox5);
|
||||
this.Controls.Add(this.connectionStringTextBox4);
|
||||
this.Controls.Add(this.timePeriodFormatTextBox);
|
||||
this.Controls.Add(this.formatLabel);
|
||||
this.Controls.Add(this.languageTextBox);
|
||||
this.Controls.Add(this.languageLabel);
|
||||
this.Controls.Add(this.benchNameTextBox3);
|
||||
this.Controls.Add(this.benchNameTextBox2);
|
||||
this.Controls.Add(this.benchNameTextBox1);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.connectionStringTextBox3);
|
||||
this.Controls.Add(this.connectionStringLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox2);
|
||||
this.Controls.Add(this.benchNameLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox1);
|
||||
this.Name = "DatabaseSettingsDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Database Settings";
|
||||
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.connectionStringTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringLabel = new System.Windows.Forms.Label();
|
||||
this.connectionStringTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.benchNameTextBox1 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox3 = new System.Windows.Forms.TextBox();
|
||||
this.languageLabel = new System.Windows.Forms.Label();
|
||||
this.languageTextBox = new System.Windows.Forms.TextBox();
|
||||
this.formatLabel = new System.Windows.Forms.Label();
|
||||
this.timePeriodFormatTextBox = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.benchNameTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox5 = new System.Windows.Forms.TextBox();
|
||||
this.connectionStringTextBox4 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// connectionStringTextBox1
|
||||
//
|
||||
this.connectionStringTextBox1.Location = new System.Drawing.Point(157, 45);
|
||||
this.connectionStringTextBox1.Name = "connectionStringTextBox1";
|
||||
this.connectionStringTextBox1.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox1.TabIndex = 3;
|
||||
//
|
||||
// benchNameLabel
|
||||
//
|
||||
this.benchNameLabel.AutoSize = true;
|
||||
this.benchNameLabel.Location = new System.Drawing.Point(26, 20);
|
||||
this.benchNameLabel.Name = "benchNameLabel";
|
||||
this.benchNameLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.benchNameLabel.TabIndex = 0;
|
||||
this.benchNameLabel.Text = "Bench name";
|
||||
//
|
||||
// connectionStringLabel
|
||||
//
|
||||
this.connectionStringLabel.AutoSize = true;
|
||||
this.connectionStringLabel.Location = new System.Drawing.Point(154, 20);
|
||||
this.connectionStringLabel.Name = "connectionStringLabel";
|
||||
this.connectionStringLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.connectionStringLabel.TabIndex = 1;
|
||||
this.connectionStringLabel.Text = "Connection string";
|
||||
//
|
||||
// connectionStringTextBox2
|
||||
//
|
||||
this.connectionStringTextBox2.Location = new System.Drawing.Point(157, 71);
|
||||
this.connectionStringTextBox2.Name = "connectionStringTextBox2";
|
||||
this.connectionStringTextBox2.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox2.TabIndex = 5;
|
||||
//
|
||||
// connectionStringTextBox3
|
||||
//
|
||||
this.connectionStringTextBox3.Location = new System.Drawing.Point(157, 97);
|
||||
this.connectionStringTextBox3.Name = "connectionStringTextBox3";
|
||||
this.connectionStringTextBox3.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox3.TabIndex = 7;
|
||||
//
|
||||
// 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(506, 250);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.okButton.TabIndex = 18;
|
||||
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(617, 250);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(95, 38);
|
||||
this.cancelButton.TabIndex = 19;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// benchNameTextBox1
|
||||
//
|
||||
this.benchNameTextBox1.Location = new System.Drawing.Point(29, 45);
|
||||
this.benchNameTextBox1.Name = "benchNameTextBox1";
|
||||
this.benchNameTextBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox1.TabIndex = 2;
|
||||
//
|
||||
// benchNameTextBox2
|
||||
//
|
||||
this.benchNameTextBox2.Location = new System.Drawing.Point(29, 71);
|
||||
this.benchNameTextBox2.Name = "benchNameTextBox2";
|
||||
this.benchNameTextBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox2.TabIndex = 4;
|
||||
//
|
||||
// benchNameTextBox3
|
||||
//
|
||||
this.benchNameTextBox3.Location = new System.Drawing.Point(29, 97);
|
||||
this.benchNameTextBox3.Name = "benchNameTextBox3";
|
||||
this.benchNameTextBox3.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox3.TabIndex = 6;
|
||||
//
|
||||
// languageLabel
|
||||
//
|
||||
this.languageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageLabel.AutoSize = true;
|
||||
this.languageLabel.Location = new System.Drawing.Point(26, 239);
|
||||
this.languageLabel.Name = "languageLabel";
|
||||
this.languageLabel.Size = new System.Drawing.Size(55, 13);
|
||||
this.languageLabel.TabIndex = 14;
|
||||
this.languageLabel.Text = "Language";
|
||||
//
|
||||
// languageTextBox
|
||||
//
|
||||
this.languageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.languageTextBox.Location = new System.Drawing.Point(29, 263);
|
||||
this.languageTextBox.Name = "languageTextBox";
|
||||
this.languageTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.languageTextBox.TabIndex = 15;
|
||||
//
|
||||
// formatLabel
|
||||
//
|
||||
this.formatLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.formatLabel.AutoSize = true;
|
||||
this.formatLabel.Location = new System.Drawing.Point(26, 185);
|
||||
this.formatLabel.Name = "formatLabel";
|
||||
this.formatLabel.Size = new System.Drawing.Size(94, 13);
|
||||
this.formatLabel.TabIndex = 12;
|
||||
this.formatLabel.Text = "Time period format";
|
||||
//
|
||||
// timePeriodFormatTextBox
|
||||
//
|
||||
this.timePeriodFormatTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.timePeriodFormatTextBox.Location = new System.Drawing.Point(29, 207);
|
||||
this.timePeriodFormatTextBox.Name = "timePeriodFormatTextBox";
|
||||
this.timePeriodFormatTextBox.Size = new System.Drawing.Size(683, 20);
|
||||
this.timePeriodFormatTextBox.TabIndex = 13;
|
||||
//
|
||||
// benchNameTextBox5
|
||||
//
|
||||
this.benchNameTextBox5.Location = new System.Drawing.Point(29, 149);
|
||||
this.benchNameTextBox5.Name = "benchNameTextBox5";
|
||||
this.benchNameTextBox5.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox5.TabIndex = 10;
|
||||
//
|
||||
// benchNameTextBox4
|
||||
//
|
||||
this.benchNameTextBox4.Location = new System.Drawing.Point(29, 123);
|
||||
this.benchNameTextBox4.Name = "benchNameTextBox4";
|
||||
this.benchNameTextBox4.Size = new System.Drawing.Size(100, 20);
|
||||
this.benchNameTextBox4.TabIndex = 8;
|
||||
//
|
||||
// connectionStringTextBox5
|
||||
//
|
||||
this.connectionStringTextBox5.Location = new System.Drawing.Point(157, 149);
|
||||
this.connectionStringTextBox5.Name = "connectionStringTextBox5";
|
||||
this.connectionStringTextBox5.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox5.TabIndex = 11;
|
||||
//
|
||||
// connectionStringTextBox4
|
||||
//
|
||||
this.connectionStringTextBox4.Location = new System.Drawing.Point(157, 123);
|
||||
this.connectionStringTextBox4.Name = "connectionStringTextBox4";
|
||||
this.connectionStringTextBox4.Size = new System.Drawing.Size(555, 20);
|
||||
this.connectionStringTextBox4.TabIndex = 9;
|
||||
//
|
||||
// DatabaseSettingsDlg
|
||||
//
|
||||
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(743, 310);
|
||||
this.Controls.Add(this.benchNameTextBox5);
|
||||
this.Controls.Add(this.benchNameTextBox4);
|
||||
this.Controls.Add(this.connectionStringTextBox5);
|
||||
this.Controls.Add(this.connectionStringTextBox4);
|
||||
this.Controls.Add(this.timePeriodFormatTextBox);
|
||||
this.Controls.Add(this.formatLabel);
|
||||
this.Controls.Add(this.languageTextBox);
|
||||
this.Controls.Add(this.languageLabel);
|
||||
this.Controls.Add(this.benchNameTextBox3);
|
||||
this.Controls.Add(this.benchNameTextBox2);
|
||||
this.Controls.Add(this.benchNameTextBox1);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.connectionStringTextBox3);
|
||||
this.Controls.Add(this.connectionStringLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox2);
|
||||
this.Controls.Add(this.benchNameLabel);
|
||||
this.Controls.Add(this.connectionStringTextBox1);
|
||||
this.Name = "DatabaseSettingsDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Settings";
|
||||
this.Load += new System.EventHandler(this.DatabaseSettings_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -248,6 +248,6 @@
|
||||
private System.Windows.Forms.TextBox benchNameTextBox5;
|
||||
private System.Windows.Forms.TextBox benchNameTextBox4;
|
||||
private System.Windows.Forms.TextBox connectionStringTextBox5;
|
||||
private System.Windows.Forms.TextBox connectionStringTextBox4;
|
||||
private System.Windows.Forms.TextBox connectionStringTextBox4;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using ResultsBrowser.Resources;
|
||||
using TBF.BenchControl;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
partial class PrinterConfigDlg
|
||||
{
|
||||
/// <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.printerClassComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.changePrinterClassButton = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.configureButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// printerClassComboBox
|
||||
//
|
||||
this.printerClassComboBox.Enabled = false;
|
||||
this.printerClassComboBox.FormattingEnabled = true;
|
||||
this.printerClassComboBox.Location = new System.Drawing.Point(12, 29);
|
||||
this.printerClassComboBox.Name = "printerClassComboBox";
|
||||
this.printerClassComboBox.Size = new System.Drawing.Size(389, 21);
|
||||
this.printerClassComboBox.TabIndex = 0;
|
||||
//
|
||||
// changePrinterClassButton
|
||||
//
|
||||
this.changePrinterClassButton.Location = new System.Drawing.Point(15, 67);
|
||||
this.changePrinterClassButton.Name = "changePrinterClassButton";
|
||||
this.changePrinterClassButton.Size = new System.Drawing.Size(161, 43);
|
||||
this.changePrinterClassButton.TabIndex = 1;
|
||||
this.changePrinterClassButton.Text = "Change printer type (configuration will be deleted)";
|
||||
this.changePrinterClassButton.UseVisualStyleBackColor = true;
|
||||
this.changePrinterClassButton.Click += new System.EventHandler(this.changePrinterClassButton_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Printer type";
|
||||
//
|
||||
// configureButton
|
||||
//
|
||||
this.configureButton.Location = new System.Drawing.Point(196, 67);
|
||||
this.configureButton.Name = "configureButton";
|
||||
this.configureButton.Size = new System.Drawing.Size(95, 43);
|
||||
this.configureButton.TabIndex = 3;
|
||||
this.configureButton.Text = "Configure";
|
||||
this.configureButton.UseVisualStyleBackColor = true;
|
||||
this.configureButton.Click += new System.EventHandler(this.configureButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Location = new System.Drawing.Point(306, 67);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(95, 43);
|
||||
this.cancelButton.TabIndex = 4;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// PrinterConfigDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(416, 122);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.configureButton);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.changePrinterClassButton);
|
||||
this.Controls.Add(this.printerClassComboBox);
|
||||
this.Name = "PrinterConfigDlg";
|
||||
this.Text = "Printer configuration";
|
||||
this.Load += new System.EventHandler(this.PrinterClassDlg_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox printerClassComboBox;
|
||||
private System.Windows.Forms.Button changePrinterClassButton;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button configureButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
public partial class PrinterConfigDlg : Form
|
||||
{
|
||||
public string PrinterClass; /// To be initialized in the constructor
|
||||
public string PrinterCfg;
|
||||
|
||||
IList<IComponentFactory> printerFactories; /// Printer components classes
|
||||
IComponentFactory printerFactory;
|
||||
|
||||
|
||||
public PrinterConfigDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
printerFactories = new List<IComponentFactory>();
|
||||
foreach (var fctry in TbfComponents.Factories)
|
||||
{
|
||||
if (fctry.ClassName.Contains("Output.Printers.")) printerFactories.Add(fctry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void PrinterClassDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
printerClassComboBox.Items.Add("---");
|
||||
foreach (var fctry in printerFactories)
|
||||
{
|
||||
printerClassComboBox.Items.Add(fctry.ClassName);
|
||||
}
|
||||
printerClassComboBox.Text = string.IsNullOrEmpty(PrinterClass) ? "---" : PrinterClass;
|
||||
}
|
||||
|
||||
|
||||
private void changePrinterClassButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
printerClassComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
private void configureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string oriClassName = PrinterClass;
|
||||
|
||||
PrinterClass = string.Empty;
|
||||
if (printerClassComboBox.Text != "---")
|
||||
{
|
||||
foreach (var pc in printerFactories)
|
||||
{
|
||||
if (printerClassComboBox.Text == pc.ClassName) PrinterClass = pc.ClassName;
|
||||
}
|
||||
}
|
||||
|
||||
printerFactory = GetFactory(PrinterClass);
|
||||
if (printerFactory == null)
|
||||
{
|
||||
MessageBox.Show("Invalid printer");
|
||||
return;
|
||||
}
|
||||
|
||||
IComponentCfg printerCfg;
|
||||
if ((oriClassName != printerFactory.ClassName) || string.IsNullOrEmpty(PrinterCfg))
|
||||
{
|
||||
printerCfg = printerFactory.DefaultConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
Config.Entities.Component cmpnt = new Config.Entities.Component();
|
||||
cmpnt.Name = "printer";
|
||||
cmpnt.ClassName = PrinterClass;
|
||||
cmpnt.Parameters = PrinterCfg;
|
||||
printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
|
||||
}
|
||||
|
||||
IComponentCfgCtrl cfgControl = printerCfg.GetControl();
|
||||
cfgControl.Config = printerCfg;
|
||||
cfgControl.Config.ItemNr = 0;
|
||||
|
||||
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
|
||||
cfgForm.TbfComponents = new List<Config.Entities.Component>();
|
||||
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
DialogResult dr = cfgForm.ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
|
||||
PrinterCfg = (printerCfg != null) ? printerCfg.CreateDbEntity().Parameters : string.Empty;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
-237
@@ -1,237 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace ResultsBrowser.Forms
|
||||
{
|
||||
partial class ResultsConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.availableResultsListBox = new System.Windows.Forms.ListBox();
|
||||
this.selectedResultsListBox = new System.Windows.Forms.ListBox();
|
||||
this.availableResultsLabel = new System.Windows.Forms.Label();
|
||||
this.selectedResultsLabel = new System.Windows.Forms.Label();
|
||||
this.removeAllButton = new System.Windows.Forms.Button();
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.unlockButton = new System.Windows.Forms.Button();
|
||||
this.singleRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.combinedRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(283, 57);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(104, 30);
|
||||
this.okButton.TabIndex = 4;
|
||||
this.okButton.Text = "Close";
|
||||
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(283, 94);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(104, 30);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Visible = false;
|
||||
//
|
||||
// availableResultsListBox
|
||||
//
|
||||
this.availableResultsListBox.Enabled = false;
|
||||
this.availableResultsListBox.FormattingEnabled = true;
|
||||
this.availableResultsListBox.Location = new System.Drawing.Point(12, 162);
|
||||
this.availableResultsListBox.Name = "availableResultsListBox";
|
||||
this.availableResultsListBox.Size = new System.Drawing.Size(135, 186);
|
||||
this.availableResultsListBox.TabIndex = 6;
|
||||
this.availableResultsListBox.DoubleClick += new System.EventHandler(this.availableResultsListBox_DoubleClick);
|
||||
//
|
||||
// selectedResultsListBox
|
||||
//
|
||||
this.selectedResultsListBox.Enabled = false;
|
||||
this.selectedResultsListBox.FormattingEnabled = true;
|
||||
this.selectedResultsListBox.Location = new System.Drawing.Point(252, 162);
|
||||
this.selectedResultsListBox.Name = "selectedResultsListBox";
|
||||
this.selectedResultsListBox.Size = new System.Drawing.Size(135, 186);
|
||||
this.selectedResultsListBox.TabIndex = 7;
|
||||
this.selectedResultsListBox.DoubleClick += new System.EventHandler(this.selectedResultsListBox_DoubleClick);
|
||||
//
|
||||
// availableResultsLabel
|
||||
//
|
||||
this.availableResultsLabel.AutoSize = true;
|
||||
this.availableResultsLabel.Location = new System.Drawing.Point(12, 140);
|
||||
this.availableResultsLabel.Name = "availableResultsLabel";
|
||||
this.availableResultsLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.availableResultsLabel.TabIndex = 8;
|
||||
this.availableResultsLabel.Text = "Available results:";
|
||||
//
|
||||
// selectedResultsLabel
|
||||
//
|
||||
this.selectedResultsLabel.AutoSize = true;
|
||||
this.selectedResultsLabel.Location = new System.Drawing.Point(249, 140);
|
||||
this.selectedResultsLabel.Name = "selectedResultsLabel";
|
||||
this.selectedResultsLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.selectedResultsLabel.TabIndex = 9;
|
||||
this.selectedResultsLabel.Text = "Selected results:";
|
||||
//
|
||||
// removeAllButton
|
||||
//
|
||||
this.removeAllButton.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.removeAllButton.Enabled = false;
|
||||
this.removeAllButton.Location = new System.Drawing.Point(153, 273);
|
||||
this.removeAllButton.Name = "removeAllButton";
|
||||
this.removeAllButton.Size = new System.Drawing.Size(94, 30);
|
||||
this.removeAllButton.TabIndex = 46;
|
||||
this.removeAllButton.Text = "<< R&emove all";
|
||||
this.removeAllButton.UseVisualStyleBackColor = true;
|
||||
this.removeAllButton.Click += new System.EventHandler(this.removeAllButton_Click);
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.removeButton.Enabled = false;
|
||||
this.removeButton.Location = new System.Drawing.Point(153, 238);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.removeButton.TabIndex = 45;
|
||||
this.removeButton.Text = "< &Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.addButton.Enabled = false;
|
||||
this.addButton.Location = new System.Drawing.Point(153, 203);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(93, 30);
|
||||
this.addButton.TabIndex = 44;
|
||||
this.addButton.Text = "&Add >";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// unlockButton
|
||||
//
|
||||
this.unlockButton.Location = new System.Drawing.Point(283, 21);
|
||||
this.unlockButton.Name = "unlockButton";
|
||||
this.unlockButton.Size = new System.Drawing.Size(104, 30);
|
||||
this.unlockButton.TabIndex = 47;
|
||||
this.unlockButton.Text = "Unlock";
|
||||
this.unlockButton.UseVisualStyleBackColor = true;
|
||||
this.unlockButton.Click += new System.EventHandler(this.unlockButton_Click);
|
||||
//
|
||||
// singleRadioButton
|
||||
//
|
||||
this.singleRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.singleRadioButton.AutoSize = true;
|
||||
this.singleRadioButton.Checked = true;
|
||||
this.singleRadioButton.Location = new System.Drawing.Point(19, 24);
|
||||
this.singleRadioButton.Name = "singleRadioButton";
|
||||
this.singleRadioButton.Size = new System.Drawing.Size(46, 23);
|
||||
this.singleRadioButton.TabIndex = 48;
|
||||
this.singleRadioButton.TabStop = true;
|
||||
this.singleRadioButton.Text = "Single";
|
||||
this.singleRadioButton.UseVisualStyleBackColor = true;
|
||||
this.singleRadioButton.CheckedChanged += new System.EventHandler(this.singleRadioButton_CheckedChanged);
|
||||
//
|
||||
// combinedRadioButton
|
||||
//
|
||||
this.combinedRadioButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.combinedRadioButton.AutoSize = true;
|
||||
this.combinedRadioButton.Location = new System.Drawing.Point(71, 24);
|
||||
this.combinedRadioButton.Name = "combinedRadioButton";
|
||||
this.combinedRadioButton.Size = new System.Drawing.Size(64, 23);
|
||||
this.combinedRadioButton.TabIndex = 49;
|
||||
this.combinedRadioButton.Text = "Combined";
|
||||
this.combinedRadioButton.UseVisualStyleBackColor = true;
|
||||
this.combinedRadioButton.CheckedChanged += new System.EventHandler(this.combinedRadioButton_CheckedChanged);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.combinedRadioButton);
|
||||
this.groupBox1.Controls.Add(this.singleRadioButton);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 21);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(153, 60);
|
||||
this.groupBox1.TabIndex = 52;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Water Meter";
|
||||
//
|
||||
// ResultsConfig
|
||||
//
|
||||
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(399, 358);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.unlockButton);
|
||||
this.Controls.Add(this.removeAllButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.selectedResultsLabel);
|
||||
this.Controls.Add(this.availableResultsLabel);
|
||||
this.Controls.Add(this.selectedResultsListBox);
|
||||
this.Controls.Add(this.availableResultsListBox);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Name = "ResultsConfig";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "ResultsConfig";
|
||||
this.Load += new System.EventHandler(this.ResultsConfig_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.ListBox availableResultsListBox;
|
||||
private System.Windows.Forms.ListBox selectedResultsListBox;
|
||||
private System.Windows.Forms.Label availableResultsLabel;
|
||||
private System.Windows.Forms.Label selectedResultsLabel;
|
||||
private System.Windows.Forms.Button removeAllButton;
|
||||
private System.Windows.Forms.Button removeButton;
|
||||
private System.Windows.Forms.Button addButton;
|
||||
private System.Windows.Forms.Button unlockButton;
|
||||
private System.Windows.Forms.RadioButton singleRadioButton;
|
||||
private System.Windows.Forms.RadioButton combinedRadioButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user