Compare commits

...
42 changed files with 2346 additions and 247 deletions
+2
View File
@@ -10,6 +10,8 @@ Encrypt/bin/
Encrypt/obj/
GemCard/bin
GemCard/obj
GenCode128/bin
GenCode128/obj
GraphLib/bin
GraphLib/obj
TracingDB/bin
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;ALZIR_25;LANG_FR</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;ALZIR_25;LANG_FR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+51
View File
@@ -0,0 +1,51 @@
using System.Reflection;
// 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("GenCode128")]
[assembly: AssemblyDescription("GenCode128")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chris Wuestefeld")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("2006 Chris Wuestefeld")]
[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.0.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("")]
+139
View File
@@ -0,0 +1,139 @@
namespace GenCode128
{
/// <summary>
/// Static tools for determining codes for individual characters in the content
/// </summary>
public static class Code128Code
{
private const int CShift = 98;
private const int CCodeA = 101;
private const int CCodeB = 100;
private const int CStartA = 103;
private const int CStartB = 104;
private const int CStop = 106;
/// <summary>
/// Indicates which code sets can represent a character -- CodeA, CodeB, or either
/// </summary>
public enum CodeSetAllowed
{
CodeA,
CodeB,
CodeAorB
}
/// <summary>
/// Get the Code128 code value(s) to represent an ASCII character, with
/// optional look-ahead for length optimization
/// </summary>
/// <param name="charAscii">The ASCII value of the character to translate</param>
/// <param name="lookAheadAscii">The next character in sequence (or -1 if none)</param>
/// <param name="currentCodeSet">The current codeset, that the returned codes need to follow;
/// if the returned codes change that, then this value will be changed to reflect it</param>
/// <returns>An array of integers representing the codes that need to be output to produce the
/// given character</returns>
public static int[] CodesForChar(int charAscii, int lookAheadAscii, ref CodeSet currentCodeSet)
{
int[] result;
var shifter = -1;
if (!CharCompatibleWithCodeset(charAscii, currentCodeSet))
{
// if we have a lookahead character AND if the next character is ALSO not compatible
if ((lookAheadAscii != -1) && !CharCompatibleWithCodeset(lookAheadAscii, currentCodeSet))
{
// we need to switch code sets
switch (currentCodeSet)
{
case CodeSet.CodeA:
shifter = CCodeB;
currentCodeSet = CodeSet.CodeB;
break;
case CodeSet.CodeB:
shifter = CCodeA;
currentCodeSet = CodeSet.CodeA;
break;
}
}
else
{
// no need to switch code sets, a temporary SHIFT will suffice
shifter = CShift;
}
}
if (shifter != -1)
{
result = new int[2];
result[0] = shifter;
result[1] = CodeValueForChar(charAscii);
}
else
{
result = new int[1];
result[0] = CodeValueForChar(charAscii);
}
return result;
}
/// <summary>
/// Tells us which codesets a given character value is allowed in
/// </summary>
/// <param name="charAscii">ASCII value of character to look at</param>
/// <returns>Which codeset(s) can be used to represent this character</returns>
public static CodeSetAllowed CodesetAllowedForChar(int charAscii)
{
if (charAscii >= 32 && charAscii <= 95)
{
return CodeSetAllowed.CodeAorB;
}
else
{
return charAscii < 32 ? CodeSetAllowed.CodeA : CodeSetAllowed.CodeB;
}
}
/// <summary>
/// Determine if a character can be represented in a given codeset
/// </summary>
/// <param name="charAscii">character to check for</param>
/// <param name="currentCodeSet">codeset context to test</param>
/// <returns>true if the codeset contains a representation for the ASCII character</returns>
public static bool CharCompatibleWithCodeset(int charAscii, CodeSet currentCodeSet)
{
var csa = CodesetAllowedForChar(charAscii);
return csa == CodeSetAllowed.CodeAorB || (csa == CodeSetAllowed.CodeA && currentCodeSet == CodeSet.CodeA)
|| (csa == CodeSetAllowed.CodeB && currentCodeSet == CodeSet.CodeB);
}
/// <summary>
/// Gets the integer code128 code value for a character (assuming the appropriate code set)
/// </summary>
/// <param name="charAscii">character to convert</param>
/// <returns>code128 symbol value for the character</returns>
public static int CodeValueForChar(int charAscii)
{
return charAscii >= 32 ? charAscii - 32 : charAscii + 64;
}
/// <summary>
/// Return the appropriate START code depending on the codeset we want to be in
/// </summary>
/// <param name="cs">The codeset you want to start in</param>
/// <returns>The code128 code to start a barcode in that codeset</returns>
public static int StartCodeForCodeSet(CodeSet cs)
{
return cs == CodeSet.CodeA ? CStartA : CStartB;
}
/// <summary>
/// Return the Code128 stop code
/// </summary>
/// <returns>the stop code</returns>
public static int StopCode()
{
return CStop;
}
}
}
+97
View File
@@ -0,0 +1,97 @@
namespace GenCode128
{
using System.Collections;
using System.Text;
/// <summary>
/// Represent the set of code values to be output into barcode form
/// </summary>
public class Code128Content
{
/// <summary>
/// Create content based on a string of ASCII data
/// </summary>
/// <param name="asciiData">the string that should be represented</param>
public Code128Content(string asciiData)
{
this.Codes = this.StringToCode128(asciiData);
}
/// <summary>
/// Provides the Code128 code values representing the object's string
/// </summary>
public int[] Codes
{
get { return codes; }
set { codes = value; }
}
int[] codes;
/// <summary>
/// Transform the string into integers representing the Code128 codes
/// necessary to represent it
/// </summary>
/// <param name="asciiData">String to be encoded</param>
/// <returns>Code128 representation</returns>
private int[] StringToCode128(string asciiData)
{
// turn the string into ascii byte data
var asciiBytes = Encoding.ASCII.GetBytes(asciiData);
// decide which codeset to start with
var csa1 = asciiBytes.Length > 0
? Code128Code.CodesetAllowedForChar(asciiBytes[0])
: Code128Code.CodeSetAllowed.CodeAorB;
var csa2 = asciiBytes.Length > 1
? Code128Code.CodesetAllowedForChar(asciiBytes[1])
: Code128Code.CodeSetAllowed.CodeAorB;
var currentCodeSet = this.GetBestStartSet(csa1, csa2);
// set up the beginning of the barcode
// assume no codeset changes, account for start, checksum, and stop
var codes = new ArrayList(asciiBytes.Length + 3) { Code128Code.StartCodeForCodeSet(currentCodeSet) };
// add the codes for each character in the string
for (var i = 0; i < asciiBytes.Length; i++)
{
int thischar = asciiBytes[i];
var nextchar = asciiBytes.Length > i + 1 ? asciiBytes[i + 1] : -1;
codes.AddRange(Code128Code.CodesForChar(thischar, nextchar, ref currentCodeSet));
}
// calculate the check digit
var checksum = (int)codes[0];
for (var i = 1; i < codes.Count; i++)
{
checksum += i * (int)codes[i];
}
codes.Add(checksum % 103);
codes.Add(Code128Code.StopCode());
var result = codes.ToArray(typeof(int)) as int[];
return result;
}
/// <summary>
/// Determines the best starting code set based on the the first two
/// characters of the string to be encoded
/// </summary>
/// <param name="csa1">First character of input string</param>
/// <param name="csa2">Second character of input string</param>
/// <returns>The codeset determined to be best to start with</returns>
private CodeSet GetBestStartSet(Code128Code.CodeSetAllowed csa1, Code128Code.CodeSetAllowed csa2)
{
var vote = 0;
vote += csa1 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
vote += csa1 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
vote += csa2 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
vote += csa2 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
return vote > 0 ? CodeSet.CodeA : CodeSet.CodeB; // ties go to codeB due to my own prejudices
}
}
}
+188
View File
@@ -0,0 +1,188 @@
namespace GenCode128
{
using System;
using System.Drawing;
/// <summary>
/// Summary description for Code128Rendering.
/// </summary>
public static class Code128Rendering
{
private const int CQuietWidth = 10;
// Code patterns:
// in principle these rows should each have 6 elements
// however, the last one -- STOP -- has 7. The cost of the
// extra integers is trivial, and this lets the code flow
// much more elegantly
private static readonly int[,] CPatterns =
{
{ 2, 1, 2, 2, 2, 2, 0, 0 }, // 0
{ 2, 2, 2, 1, 2, 2, 0, 0 }, // 1
{ 2, 2, 2, 2, 2, 1, 0, 0 }, // 2
{ 1, 2, 1, 2, 2, 3, 0, 0 }, // 3
{ 1, 2, 1, 3, 2, 2, 0, 0 }, // 4
{ 1, 3, 1, 2, 2, 2, 0, 0 }, // 5
{ 1, 2, 2, 2, 1, 3, 0, 0 }, // 6
{ 1, 2, 2, 3, 1, 2, 0, 0 }, // 7
{ 1, 3, 2, 2, 1, 2, 0, 0 }, // 8
{ 2, 2, 1, 2, 1, 3, 0, 0 }, // 9
{ 2, 2, 1, 3, 1, 2, 0, 0 }, // 10
{ 2, 3, 1, 2, 1, 2, 0, 0 }, // 11
{ 1, 1, 2, 2, 3, 2, 0, 0 }, // 12
{ 1, 2, 2, 1, 3, 2, 0, 0 }, // 13
{ 1, 2, 2, 2, 3, 1, 0, 0 }, // 14
{ 1, 1, 3, 2, 2, 2, 0, 0 }, // 15
{ 1, 2, 3, 1, 2, 2, 0, 0 }, // 16
{ 1, 2, 3, 2, 2, 1, 0, 0 }, // 17
{ 2, 2, 3, 2, 1, 1, 0, 0 }, // 18
{ 2, 2, 1, 1, 3, 2, 0, 0 }, // 19
{ 2, 2, 1, 2, 3, 1, 0, 0 }, // 20
{ 2, 1, 3, 2, 1, 2, 0, 0 }, // 21
{ 2, 2, 3, 1, 1, 2, 0, 0 }, // 22
{ 3, 1, 2, 1, 3, 1, 0, 0 }, // 23
{ 3, 1, 1, 2, 2, 2, 0, 0 }, // 24
{ 3, 2, 1, 1, 2, 2, 0, 0 }, // 25
{ 3, 2, 1, 2, 2, 1, 0, 0 }, // 26
{ 3, 1, 2, 2, 1, 2, 0, 0 }, // 27
{ 3, 2, 2, 1, 1, 2, 0, 0 }, // 28
{ 3, 2, 2, 2, 1, 1, 0, 0 }, // 29
{ 2, 1, 2, 1, 2, 3, 0, 0 }, // 30
{ 2, 1, 2, 3, 2, 1, 0, 0 }, // 31
{ 2, 3, 2, 1, 2, 1, 0, 0 }, // 32
{ 1, 1, 1, 3, 2, 3, 0, 0 }, // 33
{ 1, 3, 1, 1, 2, 3, 0, 0 }, // 34
{ 1, 3, 1, 3, 2, 1, 0, 0 }, // 35
{ 1, 1, 2, 3, 1, 3, 0, 0 }, // 36
{ 1, 3, 2, 1, 1, 3, 0, 0 }, // 37
{ 1, 3, 2, 3, 1, 1, 0, 0 }, // 38
{ 2, 1, 1, 3, 1, 3, 0, 0 }, // 39
{ 2, 3, 1, 1, 1, 3, 0, 0 }, // 40
{ 2, 3, 1, 3, 1, 1, 0, 0 }, // 41
{ 1, 1, 2, 1, 3, 3, 0, 0 }, // 42
{ 1, 1, 2, 3, 3, 1, 0, 0 }, // 43
{ 1, 3, 2, 1, 3, 1, 0, 0 }, // 44
{ 1, 1, 3, 1, 2, 3, 0, 0 }, // 45
{ 1, 1, 3, 3, 2, 1, 0, 0 }, // 46
{ 1, 3, 3, 1, 2, 1, 0, 0 }, // 47
{ 3, 1, 3, 1, 2, 1, 0, 0 }, // 48
{ 2, 1, 1, 3, 3, 1, 0, 0 }, // 49
{ 2, 3, 1, 1, 3, 1, 0, 0 }, // 50
{ 2, 1, 3, 1, 1, 3, 0, 0 }, // 51
{ 2, 1, 3, 3, 1, 1, 0, 0 }, // 52
{ 2, 1, 3, 1, 3, 1, 0, 0 }, // 53
{ 3, 1, 1, 1, 2, 3, 0, 0 }, // 54
{ 3, 1, 1, 3, 2, 1, 0, 0 }, // 55
{ 3, 3, 1, 1, 2, 1, 0, 0 }, // 56
{ 3, 1, 2, 1, 1, 3, 0, 0 }, // 57
{ 3, 1, 2, 3, 1, 1, 0, 0 }, // 58
{ 3, 3, 2, 1, 1, 1, 0, 0 }, // 59
{ 3, 1, 4, 1, 1, 1, 0, 0 }, // 60
{ 2, 2, 1, 4, 1, 1, 0, 0 }, // 61
{ 4, 3, 1, 1, 1, 1, 0, 0 }, // 62
{ 1, 1, 1, 2, 2, 4, 0, 0 }, // 63
{ 1, 1, 1, 4, 2, 2, 0, 0 }, // 64
{ 1, 2, 1, 1, 2, 4, 0, 0 }, // 65
{ 1, 2, 1, 4, 2, 1, 0, 0 }, // 66
{ 1, 4, 1, 1, 2, 2, 0, 0 }, // 67
{ 1, 4, 1, 2, 2, 1, 0, 0 }, // 68
{ 1, 1, 2, 2, 1, 4, 0, 0 }, // 69
{ 1, 1, 2, 4, 1, 2, 0, 0 }, // 70
{ 1, 2, 2, 1, 1, 4, 0, 0 }, // 71
{ 1, 2, 2, 4, 1, 1, 0, 0 }, // 72
{ 1, 4, 2, 1, 1, 2, 0, 0 }, // 73
{ 1, 4, 2, 2, 1, 1, 0, 0 }, // 74
{ 2, 4, 1, 2, 1, 1, 0, 0 }, // 75
{ 2, 2, 1, 1, 1, 4, 0, 0 }, // 76
{ 4, 1, 3, 1, 1, 1, 0, 0 }, // 77
{ 2, 4, 1, 1, 1, 2, 0, 0 }, // 78
{ 1, 3, 4, 1, 1, 1, 0, 0 }, // 79
{ 1, 1, 1, 2, 4, 2, 0, 0 }, // 80
{ 1, 2, 1, 1, 4, 2, 0, 0 }, // 81
{ 1, 2, 1, 2, 4, 1, 0, 0 }, // 82
{ 1, 1, 4, 2, 1, 2, 0, 0 }, // 83
{ 1, 2, 4, 1, 1, 2, 0, 0 }, // 84
{ 1, 2, 4, 2, 1, 1, 0, 0 }, // 85
{ 4, 1, 1, 2, 1, 2, 0, 0 }, // 86
{ 4, 2, 1, 1, 1, 2, 0, 0 }, // 87
{ 4, 2, 1, 2, 1, 1, 0, 0 }, // 88
{ 2, 1, 2, 1, 4, 1, 0, 0 }, // 89
{ 2, 1, 4, 1, 2, 1, 0, 0 }, // 90
{ 4, 1, 2, 1, 2, 1, 0, 0 }, // 91
{ 1, 1, 1, 1, 4, 3, 0, 0 }, // 92
{ 1, 1, 1, 3, 4, 1, 0, 0 }, // 93
{ 1, 3, 1, 1, 4, 1, 0, 0 }, // 94
{ 1, 1, 4, 1, 1, 3, 0, 0 }, // 95
{ 1, 1, 4, 3, 1, 1, 0, 0 }, // 96
{ 4, 1, 1, 1, 1, 3, 0, 0 }, // 97
{ 4, 1, 1, 3, 1, 1, 0, 0 }, // 98
{ 1, 1, 3, 1, 4, 1, 0, 0 }, // 99
{ 1, 1, 4, 1, 3, 1, 0, 0 }, // 100
{ 3, 1, 1, 1, 4, 1, 0, 0 }, // 101
{ 4, 1, 1, 1, 3, 1, 0, 0 }, // 102
{ 2, 1, 1, 4, 1, 2, 0, 0 }, // 103
{ 2, 1, 1, 2, 1, 4, 0, 0 }, // 104
{ 2, 1, 1, 2, 3, 2, 0, 0 }, // 105
{ 2, 3, 3, 1, 1, 1, 2, 0 } // 106
};
/// <summary>
/// Make an image of a Code128 barcode for a given string
/// </summary>
/// <param name="inputData">Message to be encoded</param>
/// <param name="barWeight">Base thickness for bar width (1 or 2 works well)</param>
/// <param name="addQuietZone">Add required horizontal margins (use if output is tight)</param>
/// <returns>An Image of the Code128 barcode representing the message</returns>
public static Image MakeBarcodeImage(string inputData, int barWeight, bool addQuietZone)
{
// get the Code128 codes to represent the message
var content = new Code128Content(inputData);
var codes = content.Codes;
var width = (((codes.Length - 3) * 11) + 35) * barWeight;
var height = Convert.ToInt32(Math.Ceiling(Convert.ToSingle(width) * .15F));
if (addQuietZone)
{
width += 2 * CQuietWidth * barWeight; // on both sides
}
// get surface to draw on
Image myImage = new Bitmap(width, height);
using (var gr = Graphics.FromImage(myImage))
{
// set to white so we don't have to fill the spaces with white
gr.FillRectangle(Brushes.White, 0, 0, width, height);
// skip quiet zone
var cursor = addQuietZone ? CQuietWidth * barWeight : 0;
for (var codeIdx = 0; codeIdx < codes.Length; codeIdx++)
{
var code = codes[codeIdx];
// take the bars two at a time: a black and a white
for (var bar = 0; bar < 8; bar += 2)
{
var barWidth = CPatterns[code, bar] * barWeight;
var spcWidth = CPatterns[code, bar + 1] * barWeight;
// if width is zero, don't try to draw it
if (barWidth > 0)
{
gr.FillRectangle(Brushes.Black, cursor, 0, barWidth, height);
}
// note that we never need to draw the space, since we
// initialized the graphics to all white
// advance cursor beyond this pair
cursor += barWidth + spcWidth;
}
}
}
return myImage;
}
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace GenCode128
{
public enum CodeSet
{
CodeA,
CodeB
//// CodeC // not supported
}
}
+147
View File
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{32817BF9-E380-4467-9C7F-936F4B122BC7}</ProjectGuid>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>GenCode128</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>GenCode128</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<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>false</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>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</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>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Code128Code.cs" />
<Compile Include="CodeSet.cs" />
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Code128Content.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Code128Rendering.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
+9 -9
View File
@@ -59,15 +59,15 @@ namespace Results.Entities
public virtual bool Equals(Components bc)
{
if (TestBenchId != bc.TestBenchId) return false;
if (!TestBenchName.Equals(bc.TestBenchName)) return false;
if (!Pump.Equals(bc.Pump)) return false;
if (!RegValve.Equals(bc.RegValve)) return false;
if (!Flowmeter.Equals(bc.Flowmeter)) return false;
if (!Diverter.Equals(bc.Diverter)) return false;
if (!Scale.Equals(bc.Scale)) return false;
if (!Custom1.Equals(bc.Custom1)) return false;
if (!Custom2.Equals(bc.Custom2)) return false;
if (!Custom3.Equals(bc.Custom3)) return false;
if (TestBenchName != bc.TestBenchName) return false;
if (Pump != bc.Pump) return false;
if (RegValve != bc.RegValve) return false;
if (Flowmeter != bc.Flowmeter) return false;
if (Diverter != bc.Diverter) return false;
if (Scale != bc.Scale) return false;
if (Custom1 != bc.Custom1) return false;
if (Custom2 != bc.Custom2) return false;
if (Custom3 != bc.Custom3) return false;
return true;
}
+2 -2
View File
@@ -64,13 +64,13 @@ namespace Results.Entities
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(TestData td)
{
if (!Name.Equals(td.Name)) return false;
if (Name != td.Name) return false;
if (Repeats != td.Repeats) return false;
if (Qfrom != td.Qfrom) return false;
if (Qto != td.Qto) return false;
if (TargetVolume != td.TargetVolume) return false;
if (TargetTime != td.TargetTime) return false;
if (!Method.Equals(td.Method)) return false;
if (Method != td.Method) return false;
if (ErrLimLo != td.ErrLimLo) return false;
if (ErrLimHi != td.ErrLimHi) return false;
if (Uncertainty != td.Uncertainty) return false;
+8 -8
View File
@@ -68,8 +68,8 @@ namespace Results.Entities
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(WaterMeterData wmd)
{
if (!ProductName.Equals(wmd.ProductName)) return false;
if (!Producer.Equals(wmd.Producer)) return false;
if (ProductName != wmd.ProductName) return false;
if (Producer != wmd.Producer) return false;
if (DN != wmd.DN) return false;
if (L != wmd.L) return false;
@@ -81,13 +81,13 @@ namespace Results.Entities
if (Q2_Qt != wmd.Q2_Qt) return false;
if (Q1_Qmin != wmd.Q1_Qmin) return false;
if (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
if (!TemperatureClass.Equals(wmd.TemperatureClass)) return false;
if (!PressureLossClass.Equals(wmd.PressureLossClass)) return false;
if (!MaxAdmissiblePressure.Equals(wmd.MaxAdmissiblePressure)) return false;
if (!FlowProfileSensitivityClass.Equals(wmd.FlowProfileSensitivityClass)) return false;
if (MetrologicalClass != wmd.MetrologicalClass) return false;
if (TemperatureClass != wmd.TemperatureClass) return false;
if (PressureLossClass != wmd.PressureLossClass) return false;
if (MaxAdmissiblePressure != wmd.MaxAdmissiblePressure) return false;
if (FlowProfileSensitivityClass != wmd.FlowProfileSensitivityClass) return false;
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
if (ApprovalInfo != wmd.ApprovalInfo) return false;
if (Certificate != wmd.Certificate) return false;
if (PulsesPerLtr != wmd.PulsesPerLtr) return false;
+13
View File
@@ -0,0 +1,13 @@
using System;
namespace Results.Output.Printers
{
public enum BarcodeType
{
None,
Code_128_Horizontally,
Code_128_Vertically,
QR_Code,
Count
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -10,6 +10,7 @@ using System.IO;
using Gma.QrCodeNet.Encoding;
using Config.Entities;
using Results.Resources;
using GenCode128;
namespace Results.Output.Printers.Label
{
@@ -98,16 +99,27 @@ namespace Results.Output.Printers.Label
}
}
if (cfg.DrawSNasBarcode)
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count)
{
if (cfg.IsQR)
try
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
if (cfg.BarcodeType == BarcodeType.QR_Code)
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
e.Graphics.DrawImage(img, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
}
else
catch (Exception)
{
/// TODO
}
}
}
@@ -16,9 +16,7 @@ namespace Results.Output.Printers.Label
public int FontStyle;
public System.Globalization.CultureInfo CultureInfo;
public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing
public bool DrawSNasBarcode;
public bool IsQR;
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
@@ -0,0 +1,175 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Gma.QrCodeNet.Encoding;
using Config.Entities;
using Results.Resources;
using GenCode128;
namespace Results.Output.Printers.MultiLabel
{
public class MultiLabelPrintDocument : PrintersCommon
{
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int labelHeight;
readonly int labelWidth;
/// Selected font
readonly Font font;
/// Data to print
Results.Entities.Batch batch;
MultiLabelPrinterCfg cfg;
IList<Results.Entities.WaterMeter> waterMeters;
/// Items to print
IList<WMeterRsltItemSpec> itemsToPrint;
/// <summary>
/// Constructor
/// </summary>
/// <param name="textToPrint">Text to be printed</param>
public MultiLabelPrintDocument(Results.Entities.Batch batch, MultiLabelPrinterCfg cfg, string documentName)
{
DocumentName = documentName;
this.batch = batch;
this.waterMeters = batch.WaterMeters;
this.cfg = cfg;
this.itemsToPrint = Results.WMeterRsltItemSpec.FromStrArray(cfg.ItemsToPrint);
/// Initialize fonts
font = new Font((cfg.FontFamily != null ? cfg.FontFamily : "Arial"),
(cfg.FontSize > 0 ? cfg.FontSize : 10),
(FontStyle)cfg.FontStyle);
/// Set print area size and margins (in dots using 100 dpi)
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
///
labelHeight = cfg.LabelHeight;
labelWidth = cfg.LabelWidth;
}
/// <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);
int labelColumn = 0;
int labelLeft = cfg.LeftTopLabelLeft;
int labelTop = cfg.LeftTopLabelTop;
foreach (var wm in waterMeters)
{
if (!wm.Disabled && (!cfg.GoodOnly || wm.Passed))
{
if (!string.IsNullOrEmpty(cfg.Template))
{
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
if (File.Exists(templatePath))
{
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), labelWidth, labelHeight), new Rectangle(labelLeft, labelTop, labelWidth, labelHeight));
}
}
foreach (var item in itemsToPrint)
{
string[] coords = item.Caption.Split(new char[] { ';' });
int x, y;
if (coords.Length >= 2 && int.TryParse(coords[0].Trim(new char[] { ' ' }), out x)
&& int.TryParse(coords[1].Trim(new char[] { ' ' }), out y))
{
RectangleF printArea = new RectangleF(labelLeft + x, labelTop + y, labelWidth - x, labelHeight - y);
e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea);
}
}
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count)
{
try
{
if (cfg.BarcodeType == BarcodeType.QR_Code)
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, labelLeft + cfg.BarcodeLeft, labelTop + cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
e.Graphics.DrawImage(img, labelLeft + cfg.BarcodeLeft, labelTop + cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
}
catch (Exception)
{
}
}
///
/// Move (labelLeft, labelTop) coordinates to the next label
///
if (++labelColumn == cfg.LabelColumnsCount)
{
labelColumn = 0;
labelLeft = cfg.LeftTopLabelLeft;
labelTop += cfg.LabelHeight;
}
else
{
labelLeft += cfg.LabelWidth;
}
}
}
}
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
}
}
@@ -0,0 +1,29 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.MultiLabel
{
public class MultiLabelPrinterCfg
{
public Config.Entities.PageOrientation PageOrientation;
public int LabelColumnsCount;
public int LeftTopLabelLeft;
public int LeftTopLabelTop;
public bool GoodOnly;
public string[] ItemsToPrint;
public int LabelWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int LabelHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string Template; /// Full path to a 'png' file
public string FontFamily;
public int FontSize;
public int FontStyle;
public System.Globalization.CultureInfo CultureInfo;
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1340.0")]
[assembly: AssemblyFileVersion("2.18.1340.0")]
[assembly: AssemblyVersion("2.18.1428.0")]
[assembly: AssemblyFileVersion("2.18.1428.0")]
+11 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;ALZIR_25;LANG_FR</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;ALZIR_25;LANG_FR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -134,10 +134,15 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Enhanced\EnhancedPrinterCfg.cs" />
<Compile Include="Output\Printers\Enums.cs" />
<Compile Include="Output\Printers\Label\LabelPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Label\LabelPrinterCfg.cs" />
<Compile Include="Output\Printers\MultiLabel\MultiLabelPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\MultiLabel\MultiLabelPrinterCfg.cs" />
<Compile Include="Output\Printers\PrintersCommon.cs">
<SubType>Component</SubType>
</Compile>
@@ -173,6 +178,10 @@
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\GenCode128\GenCode128.csproj">
<Project>{32817bf9-e380-4467-9c7f-936f4b122bc7}</Project>
<Name>GenCode128</Name>
</ProjectReference>
<ProjectReference Include="..\TracingDB\TracingDB.csproj">
<Project>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</Project>
<Name>TracingDB</Name>
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;ALZIR_25;LANG_FR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;ALZIR_25;LANG_FR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+2
View File
@@ -550,6 +550,7 @@ namespace ResultsBrowser
private void customQueryButton_Click(object sender, EventArgs e)
{
#if IPERL
try
{
string[] orders = new string[] { "3137303", "3137301", "3142304", "3137302", "3137300" };
@@ -787,6 +788,7 @@ namespace ResultsBrowser
{
MessageBox.Show(exc.Message);
}
#endif
}
}
}
+12
View File
@@ -50,6 +50,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Decrypt", "Decrypt\Decrypt.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypt", "Encrypt\Encrypt.csproj", "{DA9B09F3-A99D-4883-A954-537560453674}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenCode128", "GenCode128\GenCode128.csproj", "{32817BF9-E380-4467-9C7F-936F4B122BC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -202,6 +204,16 @@ Global
{DA9B09F3-A99D-4883-A954-537560453674}.Release|Mixed Platforms.Build.0 = Release|x86
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.ActiveCfg = Release|x86
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.Build.0 = Release|x86
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Any CPU.Build.0 = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+1 -1
View File
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || IZRAEL_200 || MALTA_WSD25
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || IZRAEL_200 || MALTA_WSD25 || FUZHOU_300
public int EtPulsesK { get { return 1; } }
#else /// all new benches
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Output.Printers.Label
readonly PrinterCfg printerCfg;
public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
public bool SupressPrinting { get { return (printerCfg.NrOfCopies == 0); } }
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
@@ -75,9 +75,7 @@ namespace TBF.BenchControl.Output.Printers.Label
printerCfg.Culture = newCfg.Culture;
printerCfg.NrOfCopies = newCfg.NrOfCopies;
printerCfg.GoodOnly = newCfg.GoodOnly;
printerCfg.SupressPrinting = newCfg.SupressPrinting;
printerCfg.DrawSNasBarcode = newCfg.DrawSNasBarcode;
printerCfg.IsQR = newCfg.IsQR;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeLeft = newCfg.BarcodeLeft;
printerCfg.BarcodeTop = newCfg.BarcodeTop;
printerCfg.BarcodeWidth = newCfg.BarcodeWidth;
@@ -151,9 +149,7 @@ namespace TBF.BenchControl.Output.Printers.Label
FontStyle = printerCfg.FontStyle,
CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()),
GoodOnly = printerCfg.GoodOnly,
SupressPrinting = printerCfg.SupressPrinting,
DrawSNasBarcode = printerCfg.DrawSNasBarcode,
IsQR = printerCfg.IsQR,
BarcodeType = printerCfg.BarcodeType,
BarcodeLeft = printerCfg.BarcodeLeft,
BarcodeTop = printerCfg.BarcodeTop,
BarcodeWidth = printerCfg.BarcodeWidth,
@@ -31,10 +31,8 @@ namespace TBF.BenchControl.Output.Printers.Label
public Culture Culture;
public int NrOfCopies;
public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing
public bool DrawSNasBarcode;
public bool IsQR;
public Results.Output.Printers.BarcodeType BarcodeType;
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
@@ -62,21 +60,19 @@ namespace TBF.BenchControl.Output.Printers.Label
FontStyle = 0;
NrOfCopies = 1;
GoodOnly = false;
SupressPrinting = false;
DrawSNasBarcode = false;
BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
{
return string.Format("Name={0}, Orientation={1}, PaperWidth={2}, PaperHeight={3}, TemplateFile={4}, GoodOnly={5}, SupressPrinting={6}, Barcode={7}",
return string.Format("Name={0}, Orientation={1}, PaperWidth={2}, PaperHeight={3}, TemplateFile={4}, GoodOnly={5}, Barcode={6}",
Name,
PageOrientation,
PaperWidth,
PaperHeight,
Template,
GoodOnly ? "yes" : "no",
SupressPrinting ? "yes" : "no",
DrawSNasBarcode ? "yes" : "no"
BarcodeType.ToString()
);
}
}
+105 -136
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.Output.Printers.Label
{
@@ -34,7 +34,6 @@ namespace TBF.BenchControl.Output.Printers.Label
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.supressPrintingCheckBox = new System.Windows.Forms.CheckBox();
this.orientationLabel = new System.Windows.Forms.Label();
this.orientationComboBox = new System.Windows.Forms.ComboBox();
this.templateTextBox = new System.Windows.Forms.TextBox();
@@ -55,18 +54,16 @@ namespace TBF.BenchControl.Output.Printers.Label
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.snBarcodeGroupBox = new System.Windows.Forms.GroupBox();
this.barcodeHeightLabel = new System.Windows.Forms.Label();
this.barcodeHeightTextBox = new System.Windows.Forms.TextBox();
this.isQrCheckBox = new System.Windows.Forms.CheckBox();
this.barcodeWidthLabel = new System.Windows.Forms.Label();
this.barcodeWidthTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopLabel = new System.Windows.Forms.Label();
this.barcodeTopTextBox = new System.Windows.Forms.TextBox();
this.barcodeLeftTextBox = new System.Windows.Forms.TextBox();
this.barcodeLeftLabel = new System.Windows.Forms.Label();
this.snBarcodeCheckBox = new System.Windows.Forms.CheckBox();
this.snBarcodeGroupBox.SuspendLayout();
this.barcodeLeftTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopLabel = new System.Windows.Forms.Label();
this.barcodeWidthTextBox = new System.Windows.Forms.TextBox();
this.barcodeWidthLabel = new System.Windows.Forms.Label();
this.barcodeHeightTextBox = new System.Windows.Forms.TextBox();
this.barcodeHeightLabel = new System.Windows.Forms.Label();
this.barcodeTypeComboBox = new System.Windows.Forms.ComboBox();
this.barcodeLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
@@ -95,17 +92,6 @@ namespace TBF.BenchControl.Output.Printers.Label
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "Class name";
//
// supressPrintingCheckBox
//
this.supressPrintingCheckBox.AutoSize = true;
this.supressPrintingCheckBox.Enabled = false;
this.supressPrintingCheckBox.Location = new System.Drawing.Point(245, 200);
this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
this.supressPrintingCheckBox.TabIndex = 11;
this.supressPrintingCheckBox.Text = "Supress printing";
this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
//
// orientationLabel
//
this.orientationLabel.AutoSize = true;
@@ -289,124 +275,112 @@ namespace TBF.BenchControl.Output.Printers.Label
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
// snBarcodeGroupBox
//
this.snBarcodeGroupBox.Controls.Add(this.barcodeHeightLabel);
this.snBarcodeGroupBox.Controls.Add(this.barcodeHeightTextBox);
this.snBarcodeGroupBox.Controls.Add(this.isQrCheckBox);
this.snBarcodeGroupBox.Controls.Add(this.barcodeWidthLabel);
this.snBarcodeGroupBox.Controls.Add(this.barcodeWidthTextBox);
this.snBarcodeGroupBox.Controls.Add(this.barcodeTopLabel);
this.snBarcodeGroupBox.Controls.Add(this.barcodeTopTextBox);
this.snBarcodeGroupBox.Controls.Add(this.barcodeLeftTextBox);
this.snBarcodeGroupBox.Controls.Add(this.barcodeLeftLabel);
this.snBarcodeGroupBox.Controls.Add(this.snBarcodeCheckBox);
this.snBarcodeGroupBox.Location = new System.Drawing.Point(11, 227);
this.snBarcodeGroupBox.Name = "snBarcodeGroupBox";
this.snBarcodeGroupBox.Size = new System.Drawing.Size(339, 59);
this.snBarcodeGroupBox.TabIndex = 56;
this.snBarcodeGroupBox.TabStop = false;
//
// barcodeHeightLabel
//
this.barcodeHeightLabel.AutoSize = true;
this.barcodeHeightLabel.Location = new System.Drawing.Point(207, 29);
this.barcodeHeightLabel.Name = "barcodeHeightLabel";
this.barcodeHeightLabel.Size = new System.Drawing.Size(38, 13);
this.barcodeHeightLabel.TabIndex = 18;
this.barcodeHeightLabel.Text = "Height";
//
// barcodeHeightTextBox
//
this.barcodeHeightTextBox.Enabled = false;
this.barcodeHeightTextBox.Location = new System.Drawing.Point(247, 25);
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
this.barcodeHeightTextBox.Size = new System.Drawing.Size(32, 20);
this.barcodeHeightTextBox.TabIndex = 17;
//
// isQrCheckBox
//
this.isQrCheckBox.AutoSize = true;
this.isQrCheckBox.Location = new System.Drawing.Point(293, 27);
this.isQrCheckBox.Name = "isQrCheckBox";
this.isQrCheckBox.Size = new System.Drawing.Size(42, 17);
this.isQrCheckBox.TabIndex = 16;
this.isQrCheckBox.Text = "QR";
this.isQrCheckBox.UseVisualStyleBackColor = true;
//
// barcodeWidthLabel
//
this.barcodeWidthLabel.AutoSize = true;
this.barcodeWidthLabel.Location = new System.Drawing.Point(135, 29);
this.barcodeWidthLabel.Name = "barcodeWidthLabel";
this.barcodeWidthLabel.Size = new System.Drawing.Size(35, 13);
this.barcodeWidthLabel.TabIndex = 15;
this.barcodeWidthLabel.Text = "Width";
//
// barcodeWidthTextBox
//
this.barcodeWidthTextBox.Enabled = false;
this.barcodeWidthTextBox.Location = new System.Drawing.Point(171, 25);
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
this.barcodeWidthTextBox.Size = new System.Drawing.Size(32, 20);
this.barcodeWidthTextBox.TabIndex = 14;
//
// barcodeTopLabel
//
this.barcodeTopLabel.AutoSize = true;
this.barcodeTopLabel.Location = new System.Drawing.Point(71, 29);
this.barcodeTopLabel.Name = "barcodeTopLabel";
this.barcodeTopLabel.Size = new System.Drawing.Size(26, 13);
this.barcodeTopLabel.TabIndex = 13;
this.barcodeTopLabel.Text = "Top";
//
// barcodeTopTextBox
//
this.barcodeTopTextBox.Enabled = false;
this.barcodeTopTextBox.Location = new System.Drawing.Point(99, 25);
this.barcodeTopTextBox.Name = "barcodeTopTextBox";
this.barcodeTopTextBox.Size = new System.Drawing.Size(32, 20);
this.barcodeTopTextBox.TabIndex = 11;
//
// barcodeLeftTextBox
//
this.barcodeLeftTextBox.Enabled = false;
this.barcodeLeftTextBox.Location = new System.Drawing.Point(35, 25);
this.barcodeLeftTextBox.Name = "barcodeLeftTextBox";
this.barcodeLeftTextBox.Size = new System.Drawing.Size(32, 20);
this.barcodeLeftTextBox.TabIndex = 10;
//
// barcodeLeftLabel
//
this.barcodeLeftLabel.AutoSize = true;
this.barcodeLeftLabel.Location = new System.Drawing.Point(8, 29);
this.barcodeLeftLabel.Location = new System.Drawing.Point(97, 250);
this.barcodeLeftLabel.Name = "barcodeLeftLabel";
this.barcodeLeftLabel.Size = new System.Drawing.Size(25, 13);
this.barcodeLeftLabel.TabIndex = 9;
this.barcodeLeftLabel.Text = "Left";
//
// snBarcodeCheckBox
// barcodeLeftTextBox
//
this.snBarcodeCheckBox.AutoSize = true;
this.snBarcodeCheckBox.Location = new System.Drawing.Point(10, 0);
this.snBarcodeCheckBox.Name = "snBarcodeCheckBox";
this.snBarcodeCheckBox.Size = new System.Drawing.Size(176, 17);
this.snBarcodeCheckBox.TabIndex = 0;
this.snBarcodeCheckBox.Text = "Print barcode with serial number";
this.snBarcodeCheckBox.UseVisualStyleBackColor = true;
this.snBarcodeCheckBox.CheckedChanged += new System.EventHandler(this.snBarcodeCheckBox_CheckedChanged);
this.barcodeLeftTextBox.Enabled = false;
this.barcodeLeftTextBox.Location = new System.Drawing.Point(122, 246);
this.barcodeLeftTextBox.Name = "barcodeLeftTextBox";
this.barcodeLeftTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeLeftTextBox.TabIndex = 10;
//
// barcodeTopTextBox
//
this.barcodeTopTextBox.Enabled = false;
this.barcodeTopTextBox.Location = new System.Drawing.Point(181, 246);
this.barcodeTopTextBox.Name = "barcodeTopTextBox";
this.barcodeTopTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeTopTextBox.TabIndex = 11;
//
// barcodeTopLabel
//
this.barcodeTopLabel.AutoSize = true;
this.barcodeTopLabel.Location = new System.Drawing.Point(155, 250);
this.barcodeTopLabel.Name = "barcodeTopLabel";
this.barcodeTopLabel.Size = new System.Drawing.Size(26, 13);
this.barcodeTopLabel.TabIndex = 13;
this.barcodeTopLabel.Text = "Top";
//
// barcodeWidthTextBox
//
this.barcodeWidthTextBox.Enabled = false;
this.barcodeWidthTextBox.Location = new System.Drawing.Point(249, 246);
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
this.barcodeWidthTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeWidthTextBox.TabIndex = 14;
//
// barcodeWidthLabel
//
this.barcodeWidthLabel.AutoSize = true;
this.barcodeWidthLabel.Location = new System.Drawing.Point(214, 250);
this.barcodeWidthLabel.Name = "barcodeWidthLabel";
this.barcodeWidthLabel.Size = new System.Drawing.Size(35, 13);
this.barcodeWidthLabel.TabIndex = 15;
this.barcodeWidthLabel.Text = "Width";
//
// barcodeHeightTextBox
//
this.barcodeHeightTextBox.Enabled = false;
this.barcodeHeightTextBox.Location = new System.Drawing.Point(320, 246);
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
this.barcodeHeightTextBox.Size = new System.Drawing.Size(30, 20);
this.barcodeHeightTextBox.TabIndex = 17;
//
// barcodeHeightLabel
//
this.barcodeHeightLabel.AutoSize = true;
this.barcodeHeightLabel.Location = new System.Drawing.Point(282, 250);
this.barcodeHeightLabel.Name = "barcodeHeightLabel";
this.barcodeHeightLabel.Size = new System.Drawing.Size(38, 13);
this.barcodeHeightLabel.TabIndex = 18;
this.barcodeHeightLabel.Text = "Height";
//
// barcodeTypeComboBox
//
this.barcodeTypeComboBox.Enabled = false;
this.barcodeTypeComboBox.FormattingEnabled = true;
this.barcodeTypeComboBox.Location = new System.Drawing.Point(122, 222);
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
this.barcodeTypeComboBox.Size = new System.Drawing.Size(228, 21);
this.barcodeTypeComboBox.TabIndex = 19;
//
// barcodeLabel
//
this.barcodeLabel.AutoSize = true;
this.barcodeLabel.Location = new System.Drawing.Point(8, 225);
this.barcodeLabel.Name = "barcodeLabel";
this.barcodeLabel.Size = new System.Drawing.Size(88, 13);
this.barcodeLabel.TabIndex = 56;
this.barcodeLabel.Text = "Barcode with s/n";
//
// PrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.snBarcodeGroupBox);
this.Controls.Add(this.barcodeLabel);
this.Controls.Add(this.barcodeTypeComboBox);
this.Controls.Add(this.barcodeHeightLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.barcodeHeightTextBox);
this.Controls.Add(this.cultureComboBox);
this.Controls.Add(this.barcodeWidthLabel);
this.Controls.Add(this.cultureLabel);
this.Controls.Add(this.barcodeWidthTextBox);
this.Controls.Add(this.barcodeTopLabel);
this.Controls.Add(this.nrOfCopiesLabel);
this.Controls.Add(this.barcodeTopTextBox);
this.Controls.Add(this.nrOfCopiesTextBox);
this.Controls.Add(this.barcodeLeftTextBox);
this.Controls.Add(this.itemsToPrintButton);
this.Controls.Add(this.barcodeLeftLabel);
this.Controls.Add(this.italicCheckBox);
this.Controls.Add(this.boldCheckBox);
this.Controls.Add(this.fontSizeTextBox);
@@ -421,15 +395,12 @@ namespace TBF.BenchControl.Output.Printers.Label
this.Controls.Add(this.templateLabel);
this.Controls.Add(this.orientationComboBox);
this.Controls.Add(this.orientationLabel);
this.Controls.Add(this.supressPrintingCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "PrinterCfgCtrl";
this.Size = new System.Drawing.Size(372, 327);
this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
this.snBarcodeGroupBox.ResumeLayout(false);
this.snBarcodeGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -439,8 +410,7 @@ namespace TBF.BenchControl.Output.Printers.Label
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox supressPrintingCheckBox;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label orientationLabel;
private System.Windows.Forms.ComboBox orientationComboBox;
private System.Windows.Forms.TextBox templateTextBox;
@@ -460,17 +430,16 @@ namespace TBF.BenchControl.Output.Printers.Label
private System.Windows.Forms.TextBox nrOfCopiesTextBox;
private System.Windows.Forms.ComboBox cultureComboBox;
private System.Windows.Forms.Label cultureLabel;
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
private System.Windows.Forms.GroupBox snBarcodeGroupBox;
private System.Windows.Forms.TextBox barcodeTopTextBox;
private System.Windows.Forms.TextBox barcodeLeftTextBox;
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
private System.Windows.Forms.Label barcodeLeftLabel;
private System.Windows.Forms.CheckBox snBarcodeCheckBox;
private System.Windows.Forms.Label barcodeWidthLabel;
private System.Windows.Forms.TextBox barcodeWidthTextBox;
private System.Windows.Forms.TextBox barcodeLeftTextBox;
private System.Windows.Forms.TextBox barcodeTopTextBox;
private System.Windows.Forms.Label barcodeTopLabel;
private System.Windows.Forms.CheckBox isQrCheckBox;
private System.Windows.Forms.Label barcodeHeightLabel;
private System.Windows.Forms.TextBox barcodeWidthTextBox;
private System.Windows.Forms.Label barcodeWidthLabel;
private System.Windows.Forms.TextBox barcodeHeightTextBox;
private System.Windows.Forms.Label barcodeHeightLabel;
private System.Windows.Forms.ComboBox barcodeTypeComboBox;
private System.Windows.Forms.Label barcodeLabel;
}
}
@@ -7,6 +7,7 @@ using System.IO;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Output.Printers;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs;
@@ -44,7 +45,10 @@ namespace TBF.BenchControl.Output.Printers.Label
fontFamilyComboBox.Items.Add(ff.Name);
}
ManageCheckGroupBox(snBarcodeCheckBox, snBarcodeGroupBox);
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
barcodeTypeComboBox.Items.Add(bt.ToString());
}
}
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
@@ -82,10 +86,8 @@ namespace TBF.BenchControl.Output.Printers.Label
cultureComboBox.Text = config.Culture.ToString();
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
goodOnlyCheckBox.Checked = config.GoodOnly;
supressPrintingCheckBox.Checked = config.SupressPrinting;
snBarcodeCheckBox.Checked = config.DrawSNasBarcode;
isQrCheckBox.Checked = config.IsQR;
barcodeTypeComboBox.Text = config.BarcodeType.ToString();
barcodeLeftTextBox.Text = config.BarcodeLeft.ToString();
barcodeTopTextBox.Text = config.BarcodeTop.ToString();
barcodeWidthTextBox.Text = config.BarcodeWidth.ToString();
@@ -107,27 +109,19 @@ namespace TBF.BenchControl.Output.Printers.Label
cultureComboBox.Enabled = true;
nrOfCopiesTextBox.Enabled = true;
goodOnlyCheckBox.Enabled = true;
supressPrintingCheckBox.Enabled = true;
snBarcodeCheckBox.Enabled = true;
ManageCheckGroupBox(snBarcodeCheckBox, snBarcodeGroupBox);
isQrCheckBox.Enabled = true;
barcodeTypeComboBox.Enabled = true;
barcodeLeftTextBox.Enabled = true;
barcodeTopTextBox.Enabled = true;
barcodeWidthTextBox.Enabled = true;
barcodeHeightTextBox.Enabled = true;
}
private void snBarcodeCheckBox_CheckedChanged(object sender, EventArgs e)
{
ManageCheckGroupBox(snBarcodeCheckBox, snBarcodeGroupBox);
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
if (!string.IsNullOrEmpty(templateTextBox.Text) && !File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
{
message += Environment.NewLine + "Template file missing";
flags |= CfgUpdateFlags.Error;
@@ -165,6 +159,12 @@ namespace TBF.BenchControl.Output.Printers.Label
message += Environment.NewLine + "'Number of copies' should be between 0 and 9";
flags |= CfgUpdateFlags.Error;
}
if (!barcodeTypeComboBox.Items.Contains(barcodeTypeComboBox.Text))
{
message += Environment.NewLine + "Invalid barcode type";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeLeftTextBox.Text, out dummy) || dummy < 0 || dummy > 2000)
{
message += Environment.NewLine + "Barcode 'Left' should be between 0 and 2000";
@@ -234,10 +234,16 @@ namespace TBF.BenchControl.Output.Printers.Label
flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.GoodOnly, goodOnlyCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.SupressPrinting, supressPrintingCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.DrawSNasBarcode, snBarcodeCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.IsQR, isQrCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
if (bt.ToString().Equals(barcodeTypeComboBox.Text))
{
config.BarcodeType = bt;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
break;
}
}
flags |= UpdateDifferent(ref config.BarcodeLeft, barcodeLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeTop, barcodeTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeWidth, barcodeWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
@@ -264,20 +270,6 @@ namespace TBF.BenchControl.Output.Printers.Label
}
}
private void ManageCheckGroupBox(CheckBox chk, GroupBox grp)
{
/// Make sure the CheckBox isn't in the GroupBox. This will only happen the first time.
if (chk.Parent == grp)
{
grp.Parent.Controls.Add(chk); /// Reparent the CheckBox so it's not in the GroupBox.
chk.Location = new Point(chk.Left + grp.Left, chk.Top + grp.Top); /// Adjust the CheckBox's location.
chk.BringToFront(); /// Move the CheckBox to the top of the stacking order.
}
/// Enable or disable the GroupBox.
grp.Enabled = chk.Checked;
}
#region Configuration Change Handling
public static void OnCmdResponse(object sender, CmdResponseArgs args)
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Printer(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Printer(cfg); }
public IComponentCfg DefaultConfig() { return new PrinterCfg(this.GetType().Namespace.Substring(24), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(PrinterCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,168 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using System.Globalization;
using System.Threading;
using Results.Output.Printers.MultiLabel;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
public override string ToString() { return string.Format("MultiLabel.Printer({0})", Cfg.ToString(1)); }
readonly PrinterCfg printerCfg;
public bool SupressPrinting { get { return (printerCfg.NrOfCopies == 0); } }
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
///
/// Items to print
///
IList<Results.WMeterRsltItemSpec> commonItems;
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Debug(this.ToString());
}
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
}
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
{
if (CfgChangeHandler == null) return;
try { CfgChangeHandler(sender, args); }
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
}
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
public override void StartChangeHandler()
{
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
{
PrinterCfg newCfg = args.Cfg as PrinterCfg;
if (newCfg != null && newCfg.Name.Equals(Name))
{
if (args.Command == CfgChangeCmd.CfgChange)
{
printerCfg.PageOrientation = newCfg.PageOrientation;
printerCfg.LabelColumnsCount = newCfg.LabelColumnsCount;
printerCfg.LeftTopLabelLeft = newCfg.LeftTopLabelLeft;
printerCfg.LeftTopLabelTop = newCfg.LeftTopLabelTop;
printerCfg.NrOfCopies = newCfg.NrOfCopies;
printerCfg.GoodOnly = newCfg.GoodOnly;
printerCfg.ItemsToPrint = newCfg.ItemsToPrint;
printerCfg.LabelWidth = newCfg.LabelWidth;
printerCfg.LabelHeight = newCfg.LabelHeight;
printerCfg.Template = newCfg.Template;
printerCfg.FontFamily = newCfg.FontFamily;
printerCfg.FontSize = newCfg.FontSize;
printerCfg.FontStyle = newCfg.FontStyle;
printerCfg.Culture = newCfg.Culture;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeLeft = newCfg.BarcodeLeft;
printerCfg.BarcodeTop = newCfg.BarcodeTop;
printerCfg.BarcodeWidth = newCfg.BarcodeWidth;
printerCfg.BarcodeHeight = newCfg.BarcodeHeight;
ApplyConfig();
}
}
};
}
#endregion Configuration Change Handling
/// <summary>
/// Prints the test cycle results, Events: Event.ResultsPrinted
/// </summary>
/// <param name="batch">Batch results to print</param>
/// <returns>Reference to the operation</returns>
public IOperation PrintResultsOp(Results.Entities.Batch batch)
{
this.batch = batch;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
PrintResults(batch, string.Format("{0}", batch.BatchNr));
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
void PrintResults(Results.Entities.Batch batch, string documentName)
{
MultiLabelPrinterCfg cfg = new MultiLabelPrinterCfg
{
PageOrientation = printerCfg.PageOrientation,
LabelColumnsCount = printerCfg.LabelColumnsCount,
LeftTopLabelLeft = printerCfg.LeftTopLabelLeft,
LeftTopLabelTop = printerCfg.LeftTopLabelTop,
GoodOnly = printerCfg.GoodOnly,
ItemsToPrint = printerCfg.ItemsToPrint,
LabelWidth = printerCfg.LabelWidth,
LabelHeight = printerCfg.LabelHeight,
Template = printerCfg.Template,
FontFamily = printerCfg.FontFamily,
FontSize = printerCfg.FontSize,
FontStyle = printerCfg.FontStyle,
CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()),
BarcodeType = printerCfg.BarcodeType,
BarcodeLeft = printerCfg.BarcodeLeft,
BarcodeTop = printerCfg.BarcodeTop,
BarcodeWidth = printerCfg.BarcodeWidth,
BarcodeHeight = printerCfg.BarcodeHeight,
};
for (int i = 1; i <= printerCfg.NrOfCopies; i++)
{
string docNameEx = string.Format(((printerCfg.NrOfCopies == 1) ? "{0}" : "{0}_{1}"), documentName, i);
new Results.Output.Printers.MultiLabel.MultiLabelPrintDocument(batch, cfg, docNameEx).Print();
}
}
}
}
@@ -0,0 +1,82 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PrinterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
///
/// Serialized parameters
///
public PageOrientation PageOrientation;
public int LabelColumnsCount;
public int LeftTopLabelLeft;
public int LeftTopLabelTop;
public int NrOfCopies;
public bool GoodOnly;
public string[] ItemsToPrint;
public int LabelWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int LabelHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string Template; /// Full path to a 'png' file
public string FontFamily;
public int FontSize;
public int FontStyle;
public Culture Culture;
public Results.Output.Printers.BarcodeType BarcodeType;
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
/// Private parameterless constructor invoked by all other (public) constructors
PrinterCfg()
{
}
public PrinterCfg(string name, IComponentFactory factory)
: this()
{
this.Name = name;
this.Factory = factory;
ParentName = string.Empty;
Template = string.Empty;
PageOrientation = PageOrientation.Portrait;
LabelWidth = 827; /// A4 width
LabelHeight = 1169; /// A4 height
FontFamily = "Arial";
FontSize = 10;
FontStyle = 0;
NrOfCopies = 1;
GoodOnly = false;
BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
{
return string.Format("Name={0}, Orientation={1}, LabelClmnsCnt={2}, LabelW={3}, LabelH={4}, Barcode={5}, TemplateFile={6}",
Name,
PageOrientation,
LabelColumnsCount,
LabelWidth,
LabelHeight,
BarcodeType.ToString(),
Template
);
}
}
}
@@ -0,0 +1,529 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
partial class PrinterCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.orientationLabel = new System.Windows.Forms.Label();
this.orientationComboBox = new System.Windows.Forms.ComboBox();
this.templateTextBox = new System.Windows.Forms.TextBox();
this.templateLabel = new System.Windows.Forms.Label();
this.labelWidthTextBox = new System.Windows.Forms.TextBox();
this.paperWidthLabel = new System.Windows.Forms.Label();
this.labelHeightTextBox = new System.Windows.Forms.TextBox();
this.italicCheckBox = new System.Windows.Forms.CheckBox();
this.boldCheckBox = new System.Windows.Forms.CheckBox();
this.fontSizeTextBox = new System.Windows.Forms.TextBox();
this.fontFamilyComboBox = new System.Windows.Forms.ComboBox();
this.bodyFontLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.itemsToPrintButton = new System.Windows.Forms.Button();
this.nrOfCopiesLabel = new System.Windows.Forms.Label();
this.nrOfCopiesTextBox = new System.Windows.Forms.TextBox();
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.barcodeLeftLabel = new System.Windows.Forms.Label();
this.barcodeLeftTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopLabel = new System.Windows.Forms.Label();
this.barcodeWidthTextBox = new System.Windows.Forms.TextBox();
this.barcodeWidthLabel = new System.Windows.Forms.Label();
this.barcodeHeightTextBox = new System.Windows.Forms.TextBox();
this.barcodeHeightLabel = new System.Windows.Forms.Label();
this.barcodeTypeComboBox = new System.Windows.Forms.ComboBox();
this.barcodeLabel = new System.Windows.Forms.Label();
this.leftTopLabelTopLabel = new System.Windows.Forms.Label();
this.leftTopLabelTopTextBox = new System.Windows.Forms.TextBox();
this.leftTopLabelLeftTextBox = new System.Windows.Forms.TextBox();
this.leftTopLabelLeftLabel = new System.Windows.Forms.Label();
this.labelColumnsCountTextBox = new System.Windows.Forms.TextBox();
this.labelColumnsCountLabel = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(122, 35);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(8, 38);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(119, 11);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(61, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "Class name";
//
// orientationLabel
//
this.orientationLabel.AutoSize = true;
this.orientationLabel.Location = new System.Drawing.Point(8, 60);
this.orientationLabel.Name = "orientationLabel";
this.orientationLabel.Size = new System.Drawing.Size(84, 13);
this.orientationLabel.TabIndex = 3;
this.orientationLabel.Text = "Page orientation";
//
// orientationComboBox
//
this.orientationComboBox.Enabled = false;
this.orientationComboBox.FormattingEnabled = true;
this.orientationComboBox.Location = new System.Drawing.Point(122, 57);
this.orientationComboBox.Name = "orientationComboBox";
this.orientationComboBox.Size = new System.Drawing.Size(130, 21);
this.orientationComboBox.TabIndex = 4;
//
// templateTextBox
//
this.templateTextBox.Enabled = false;
this.templateTextBox.Location = new System.Drawing.Point(120, 22);
this.templateTextBox.Name = "templateTextBox";
this.templateTextBox.Size = new System.Drawing.Size(228, 20);
this.templateTextBox.TabIndex = 10;
//
// templateLabel
//
this.templateLabel.AutoSize = true;
this.templateLabel.Location = new System.Drawing.Point(6, 25);
this.templateLabel.Name = "templateLabel";
this.templateLabel.Size = new System.Drawing.Size(67, 13);
this.templateLabel.TabIndex = 9;
this.templateLabel.Text = "Template file";
//
// labelWidthTextBox
//
this.labelWidthTextBox.Enabled = false;
this.labelWidthTextBox.Location = new System.Drawing.Point(120, 44);
this.labelWidthTextBox.Name = "labelWidthTextBox";
this.labelWidthTextBox.Size = new System.Drawing.Size(51, 20);
this.labelWidthTextBox.TabIndex = 6;
//
// paperWidthLabel
//
this.paperWidthLabel.AutoSize = true;
this.paperWidthLabel.Location = new System.Drawing.Point(6, 47);
this.paperWidthLabel.Name = "paperWidthLabel";
this.paperWidthLabel.Size = new System.Drawing.Size(101, 13);
this.paperWidthLabel.TabIndex = 5;
this.paperWidthLabel.Text = "Label width / height";
//
// labelHeightTextBox
//
this.labelHeightTextBox.Enabled = false;
this.labelHeightTextBox.Location = new System.Drawing.Point(174, 44);
this.labelHeightTextBox.Name = "labelHeightTextBox";
this.labelHeightTextBox.Size = new System.Drawing.Size(51, 20);
this.labelHeightTextBox.TabIndex = 8;
//
// italicCheckBox
//
this.italicCheckBox.AutoSize = true;
this.italicCheckBox.Enabled = false;
this.italicCheckBox.Location = new System.Drawing.Point(333, 72);
this.italicCheckBox.Name = "italicCheckBox";
this.italicCheckBox.Size = new System.Drawing.Size(15, 14);
this.italicCheckBox.TabIndex = 47;
this.italicCheckBox.UseVisualStyleBackColor = true;
//
// boldCheckBox
//
this.boldCheckBox.AutoSize = true;
this.boldCheckBox.Enabled = false;
this.boldCheckBox.Location = new System.Drawing.Point(305, 72);
this.boldCheckBox.Name = "boldCheckBox";
this.boldCheckBox.Size = new System.Drawing.Size(15, 14);
this.boldCheckBox.TabIndex = 46;
this.boldCheckBox.UseVisualStyleBackColor = true;
//
// fontSizeTextBox
//
this.fontSizeTextBox.Enabled = false;
this.fontSizeTextBox.Location = new System.Drawing.Point(257, 66);
this.fontSizeTextBox.Name = "fontSizeTextBox";
this.fontSizeTextBox.Size = new System.Drawing.Size(29, 20);
this.fontSizeTextBox.TabIndex = 45;
//
// fontFamilyComboBox
//
this.fontFamilyComboBox.Enabled = false;
this.fontFamilyComboBox.FormattingEnabled = true;
this.fontFamilyComboBox.Location = new System.Drawing.Point(120, 66);
this.fontFamilyComboBox.Name = "fontFamilyComboBox";
this.fontFamilyComboBox.Size = new System.Drawing.Size(130, 21);
this.fontFamilyComboBox.TabIndex = 44;
//
// bodyFontLabel
//
this.bodyFontLabel.AutoSize = true;
this.bodyFontLabel.Location = new System.Drawing.Point(6, 69);
this.bodyFontLabel.Name = "bodyFontLabel";
this.bodyFontLabel.Size = new System.Drawing.Size(106, 13);
this.bodyFontLabel.TabIndex = 43;
this.bodyFontLabel.Text = "Font family/size/style";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label2.Location = new System.Drawing.Point(329, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(24, 13);
this.label2.TabIndex = 49;
this.label2.Text = "Ital.";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label1.Location = new System.Drawing.Point(295, 57);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 48;
this.label1.Text = "Bold";
//
// itemsToPrintButton
//
this.itemsToPrintButton.Enabled = false;
this.itemsToPrintButton.Location = new System.Drawing.Point(257, 96);
this.itemsToPrintButton.Name = "itemsToPrintButton";
this.itemsToPrintButton.Size = new System.Drawing.Size(91, 30);
this.itemsToPrintButton.TabIndex = 50;
this.itemsToPrintButton.Text = "Items to print";
this.itemsToPrintButton.UseVisualStyleBackColor = true;
this.itemsToPrintButton.Click += new System.EventHandler(this.itemsToPrintButton_Click);
//
// nrOfCopiesLabel
//
this.nrOfCopiesLabel.AutoSize = true;
this.nrOfCopiesLabel.Location = new System.Drawing.Point(8, 105);
this.nrOfCopiesLabel.Name = "nrOfCopiesLabel";
this.nrOfCopiesLabel.Size = new System.Drawing.Size(90, 13);
this.nrOfCopiesLabel.TabIndex = 52;
this.nrOfCopiesLabel.Text = "Number of copies";
//
// nrOfCopiesTextBox
//
this.nrOfCopiesTextBox.Enabled = false;
this.nrOfCopiesTextBox.Location = new System.Drawing.Point(122, 102);
this.nrOfCopiesTextBox.Name = "nrOfCopiesTextBox";
this.nrOfCopiesTextBox.Size = new System.Drawing.Size(32, 20);
this.nrOfCopiesTextBox.TabIndex = 51;
//
// cultureComboBox
//
this.cultureComboBox.Enabled = false;
this.cultureComboBox.FormattingEnabled = true;
this.cultureComboBox.Location = new System.Drawing.Point(120, 89);
this.cultureComboBox.Name = "cultureComboBox";
this.cultureComboBox.Size = new System.Drawing.Size(130, 21);
this.cultureComboBox.TabIndex = 54;
//
// cultureLabel
//
this.cultureLabel.AutoSize = true;
this.cultureLabel.Location = new System.Drawing.Point(6, 92);
this.cultureLabel.Name = "cultureLabel";
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
this.cultureLabel.TabIndex = 53;
this.cultureLabel.Text = "Cullture";
//
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Enabled = false;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(261, 104);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 55;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
// barcodeLeftLabel
//
this.barcodeLeftLabel.AutoSize = true;
this.barcodeLeftLabel.Location = new System.Drawing.Point(95, 139);
this.barcodeLeftLabel.Name = "barcodeLeftLabel";
this.barcodeLeftLabel.Size = new System.Drawing.Size(25, 13);
this.barcodeLeftLabel.TabIndex = 9;
this.barcodeLeftLabel.Text = "Left";
//
// barcodeLeftTextBox
//
this.barcodeLeftTextBox.Enabled = false;
this.barcodeLeftTextBox.Location = new System.Drawing.Point(120, 135);
this.barcodeLeftTextBox.Name = "barcodeLeftTextBox";
this.barcodeLeftTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeLeftTextBox.TabIndex = 10;
//
// barcodeTopTextBox
//
this.barcodeTopTextBox.Enabled = false;
this.barcodeTopTextBox.Location = new System.Drawing.Point(179, 135);
this.barcodeTopTextBox.Name = "barcodeTopTextBox";
this.barcodeTopTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeTopTextBox.TabIndex = 11;
//
// barcodeTopLabel
//
this.barcodeTopLabel.AutoSize = true;
this.barcodeTopLabel.Location = new System.Drawing.Point(153, 139);
this.barcodeTopLabel.Name = "barcodeTopLabel";
this.barcodeTopLabel.Size = new System.Drawing.Size(26, 13);
this.barcodeTopLabel.TabIndex = 13;
this.barcodeTopLabel.Text = "Top";
//
// barcodeWidthTextBox
//
this.barcodeWidthTextBox.Enabled = false;
this.barcodeWidthTextBox.Location = new System.Drawing.Point(247, 135);
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
this.barcodeWidthTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeWidthTextBox.TabIndex = 14;
//
// barcodeWidthLabel
//
this.barcodeWidthLabel.AutoSize = true;
this.barcodeWidthLabel.Location = new System.Drawing.Point(212, 139);
this.barcodeWidthLabel.Name = "barcodeWidthLabel";
this.barcodeWidthLabel.Size = new System.Drawing.Size(35, 13);
this.barcodeWidthLabel.TabIndex = 15;
this.barcodeWidthLabel.Text = "Width";
//
// barcodeHeightTextBox
//
this.barcodeHeightTextBox.Enabled = false;
this.barcodeHeightTextBox.Location = new System.Drawing.Point(318, 135);
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
this.barcodeHeightTextBox.Size = new System.Drawing.Size(30, 20);
this.barcodeHeightTextBox.TabIndex = 17;
//
// barcodeHeightLabel
//
this.barcodeHeightLabel.AutoSize = true;
this.barcodeHeightLabel.Location = new System.Drawing.Point(280, 139);
this.barcodeHeightLabel.Name = "barcodeHeightLabel";
this.barcodeHeightLabel.Size = new System.Drawing.Size(38, 13);
this.barcodeHeightLabel.TabIndex = 18;
this.barcodeHeightLabel.Text = "Height";
//
// barcodeTypeComboBox
//
this.barcodeTypeComboBox.Enabled = false;
this.barcodeTypeComboBox.FormattingEnabled = true;
this.barcodeTypeComboBox.Location = new System.Drawing.Point(120, 112);
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
this.barcodeTypeComboBox.Size = new System.Drawing.Size(130, 21);
this.barcodeTypeComboBox.TabIndex = 19;
//
// barcodeLabel
//
this.barcodeLabel.AutoSize = true;
this.barcodeLabel.Location = new System.Drawing.Point(6, 115);
this.barcodeLabel.Name = "barcodeLabel";
this.barcodeLabel.Size = new System.Drawing.Size(88, 13);
this.barcodeLabel.TabIndex = 56;
this.barcodeLabel.Text = "Barcode with s/n";
//
// leftTopLabelTopLabel
//
this.leftTopLabelTopLabel.AutoSize = true;
this.leftTopLabelTopLabel.Location = new System.Drawing.Point(294, 84);
this.leftTopLabelTopLabel.Name = "leftTopLabelTopLabel";
this.leftTopLabelTopLabel.Size = new System.Drawing.Size(26, 13);
this.leftTopLabelTopLabel.TabIndex = 60;
this.leftTopLabelTopLabel.Text = "Top";
//
// leftTopLabelTopTextBox
//
this.leftTopLabelTopTextBox.Enabled = false;
this.leftTopLabelTopTextBox.Location = new System.Drawing.Point(320, 80);
this.leftTopLabelTopTextBox.Name = "leftTopLabelTopTextBox";
this.leftTopLabelTopTextBox.Size = new System.Drawing.Size(31, 20);
this.leftTopLabelTopTextBox.TabIndex = 59;
//
// leftTopLabelLeftTextBox
//
this.leftTopLabelLeftTextBox.Enabled = false;
this.leftTopLabelLeftTextBox.Location = new System.Drawing.Point(261, 80);
this.leftTopLabelLeftTextBox.Name = "leftTopLabelLeftTextBox";
this.leftTopLabelLeftTextBox.Size = new System.Drawing.Size(31, 20);
this.leftTopLabelLeftTextBox.TabIndex = 58;
//
// leftTopLabelLeftLabel
//
this.leftTopLabelLeftLabel.AutoSize = true;
this.leftTopLabelLeftLabel.Location = new System.Drawing.Point(167, 83);
this.leftTopLabelLeftLabel.Name = "leftTopLabelLeftLabel";
this.leftTopLabelLeftLabel.Size = new System.Drawing.Size(93, 13);
this.leftTopLabelLeftLabel.TabIndex = 57;
this.leftTopLabelLeftLabel.Text = "Left-Top label Left";
//
// labelColumnsCountTextBox
//
this.labelColumnsCountTextBox.Enabled = false;
this.labelColumnsCountTextBox.Location = new System.Drawing.Point(122, 80);
this.labelColumnsCountTextBox.Name = "labelColumnsCountTextBox";
this.labelColumnsCountTextBox.Size = new System.Drawing.Size(32, 20);
this.labelColumnsCountTextBox.TabIndex = 61;
//
// labelColumnsCountLabel
//
this.labelColumnsCountLabel.AutoSize = true;
this.labelColumnsCountLabel.Location = new System.Drawing.Point(9, 83);
this.labelColumnsCountLabel.Name = "labelColumnsCountLabel";
this.labelColumnsCountLabel.Size = new System.Drawing.Size(105, 13);
this.labelColumnsCountLabel.TabIndex = 62;
this.labelColumnsCountLabel.Text = "Label columns count";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.templateLabel);
this.groupBox1.Controls.Add(this.templateTextBox);
this.groupBox1.Controls.Add(this.paperWidthLabel);
this.groupBox1.Controls.Add(this.labelWidthTextBox);
this.groupBox1.Controls.Add(this.labelHeightTextBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.barcodeLabel);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.itemsToPrintButton);
this.groupBox1.Controls.Add(this.barcodeTypeComboBox);
this.groupBox1.Controls.Add(this.bodyFontLabel);
this.groupBox1.Controls.Add(this.barcodeHeightLabel);
this.groupBox1.Controls.Add(this.fontFamilyComboBox);
this.groupBox1.Controls.Add(this.fontSizeTextBox);
this.groupBox1.Controls.Add(this.barcodeHeightTextBox);
this.groupBox1.Controls.Add(this.boldCheckBox);
this.groupBox1.Controls.Add(this.cultureComboBox);
this.groupBox1.Controls.Add(this.italicCheckBox);
this.groupBox1.Controls.Add(this.barcodeWidthLabel);
this.groupBox1.Controls.Add(this.barcodeLeftLabel);
this.groupBox1.Controls.Add(this.cultureLabel);
this.groupBox1.Controls.Add(this.barcodeLeftTextBox);
this.groupBox1.Controls.Add(this.barcodeWidthTextBox);
this.groupBox1.Controls.Add(this.barcodeTopLabel);
this.groupBox1.Controls.Add(this.barcodeTopTextBox);
this.groupBox1.Location = new System.Drawing.Point(3, 127);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(366, 164);
this.groupBox1.TabIndex = 63;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "One label";
//
// PrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.labelColumnsCountLabel);
this.Controls.Add(this.labelColumnsCountTextBox);
this.Controls.Add(this.leftTopLabelTopLabel);
this.Controls.Add(this.leftTopLabelTopTextBox);
this.Controls.Add(this.leftTopLabelLeftTextBox);
this.Controls.Add(this.leftTopLabelLeftLabel);
this.Controls.Add(this.orientationComboBox);
this.Controls.Add(this.orientationLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.nrOfCopiesLabel);
this.Controls.Add(this.nrOfCopiesTextBox);
this.Name = "PrinterCfgCtrl";
this.Size = new System.Drawing.Size(372, 299);
this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label orientationLabel;
private System.Windows.Forms.ComboBox orientationComboBox;
private System.Windows.Forms.TextBox templateTextBox;
private System.Windows.Forms.Label templateLabel;
private System.Windows.Forms.TextBox labelWidthTextBox;
private System.Windows.Forms.Label paperWidthLabel;
private System.Windows.Forms.TextBox labelHeightTextBox;
private System.Windows.Forms.CheckBox italicCheckBox;
private System.Windows.Forms.CheckBox boldCheckBox;
private System.Windows.Forms.TextBox fontSizeTextBox;
private System.Windows.Forms.ComboBox fontFamilyComboBox;
private System.Windows.Forms.Label bodyFontLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button itemsToPrintButton;
private System.Windows.Forms.Label nrOfCopiesLabel;
private System.Windows.Forms.TextBox nrOfCopiesTextBox;
private System.Windows.Forms.ComboBox cultureComboBox;
private System.Windows.Forms.Label cultureLabel;
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
private System.Windows.Forms.Label barcodeLeftLabel;
private System.Windows.Forms.TextBox barcodeLeftTextBox;
private System.Windows.Forms.TextBox barcodeTopTextBox;
private System.Windows.Forms.Label barcodeTopLabel;
private System.Windows.Forms.TextBox barcodeWidthTextBox;
private System.Windows.Forms.Label barcodeWidthLabel;
private System.Windows.Forms.TextBox barcodeHeightTextBox;
private System.Windows.Forms.Label barcodeHeightLabel;
private System.Windows.Forms.ComboBox barcodeTypeComboBox;
private System.Windows.Forms.Label barcodeLabel;
private System.Windows.Forms.Label leftTopLabelTopLabel;
private System.Windows.Forms.TextBox leftTopLabelTopTextBox;
private System.Windows.Forms.TextBox leftTopLabelLeftTextBox;
private System.Windows.Forms.Label leftTopLabelLeftLabel;
private System.Windows.Forms.TextBox labelColumnsCountTextBox;
private System.Windows.Forms.Label labelColumnsCountLabel;
private System.Windows.Forms.GroupBox groupBox1;
}
}
@@ -0,0 +1,310 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Output.Printers;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public partial class PrinterCfgCtrl : ConfigCtrlUtils, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
public bool ShowMore { get { return false; } }
PrinterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as PrinterCfg;
Redraw();
}
}
string[] itemsToPrint;
public PrinterCfgCtrl()
{
InitializeComponent();
Localize();
orientationComboBox.Items.Add(PageOrientation.Portrait.ToString());
orientationComboBox.Items.Add(PageOrientation.Landscape.ToString());
foreach (var ff in System.Drawing.FontFamily.Families)
{
fontFamilyComboBox.Items.Add(ff.Name);
}
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
barcodeTypeComboBox.Items.Add(bt.ToString());
}
}
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
{
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
itemsToPrint = config.ItemsToPrint;
Redraw();
}
void Localize()
{
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
orientationComboBox.Text = config.PageOrientation.ToString();
labelColumnsCountTextBox.Text = config.LabelColumnsCount.ToString();
leftTopLabelLeftTextBox.Text = config.LeftTopLabelLeft.ToString();
leftTopLabelTopTextBox.Text = config.LeftTopLabelTop.ToString();
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
goodOnlyCheckBox.Checked = config.GoodOnly;
labelWidthTextBox.Text = config.LabelWidth.ToString();
labelHeightTextBox.Text = config.LabelHeight.ToString();
templateTextBox.Text = config.Template;
fontFamilyComboBox.Text = config.FontFamily;
fontSizeTextBox.Text = config.FontSize.ToString();
boldCheckBox.Checked = ((config.FontStyle & (int)System.Drawing.FontStyle.Bold) != 0);
italicCheckBox.Checked = ((config.FontStyle & (int)System.Drawing.FontStyle.Italic) != 0);
cultureComboBox.Text = config.Culture.ToString();
barcodeTypeComboBox.Text = config.BarcodeType.ToString();
barcodeLeftTextBox.Text = config.BarcodeLeft.ToString();
barcodeTopTextBox.Text = config.BarcodeTop.ToString();
barcodeWidthTextBox.Text = config.BarcodeWidth.ToString();
barcodeHeightTextBox.Text = config.BarcodeHeight.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
orientationComboBox.Enabled = true;
labelColumnsCountTextBox.Enabled = true;
leftTopLabelLeftTextBox.Enabled = true;
leftTopLabelTopTextBox.Enabled = true;
nrOfCopiesTextBox.Enabled = true;
goodOnlyCheckBox.Enabled = true;
itemsToPrintButton.Enabled = true;
labelWidthTextBox.Enabled = true;
labelHeightTextBox.Enabled = true;
templateTextBox.Enabled = true;
fontFamilyComboBox.Enabled = true;
fontSizeTextBox.Enabled = true;
boldCheckBox.Enabled = true;
italicCheckBox.Enabled = true;
cultureComboBox.Enabled = true;
barcodeTypeComboBox.Enabled = true;
barcodeLeftTextBox.Enabled = true;
barcodeTopTextBox.Enabled = true;
barcodeWidthTextBox.Enabled = true;
barcodeHeightTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!string.IsNullOrEmpty(templateTextBox.Text) && !File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
{
message += Environment.NewLine + "Template file missing";
flags |= CfgUpdateFlags.Error;
}
if ((int)GetOrientation(orientationComboBox.Text) < 0)
{
message += Environment.NewLine + "Invalid page orientation";
flags |= CfgUpdateFlags.Error;
}
int dummy;
if (!int.TryParse(labelColumnsCountTextBox.Text, out dummy) || dummy < 1)
{
message += Environment.NewLine + "Invalid label columns count";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(leftTopLabelLeftTextBox.Text, out dummy) || dummy < 0)
{
message += Environment.NewLine + "Invalid left-top label left";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(leftTopLabelTopTextBox.Text, out dummy) || dummy < 0)
{
message += Environment.NewLine + "Invalid left-top label top";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(labelWidthTextBox.Text, out dummy) || dummy <= 0)
{
message += Environment.NewLine + "Invalid label width";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(labelHeightTextBox.Text, out dummy) || dummy <= 0)
{
message += Environment.NewLine + "Invalid label height";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(fontSizeTextBox.Text, out dummy) || dummy < 6 || dummy > 48)
{
message += Environment.NewLine + "Font size' should be between 6 and 48";
flags |= CfgUpdateFlags.Error;
}
if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
{
message += Environment.NewLine + "Invalid culture";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(nrOfCopiesTextBox.Text, out dummy) || dummy < 0 || dummy > 9)
{
message += Environment.NewLine + "'Number of copies' should be between 0 and 9";
flags |= CfgUpdateFlags.Error;
}
if (!barcodeTypeComboBox.Items.Contains(barcodeTypeComboBox.Text))
{
message += Environment.NewLine + "Invalid barcode type";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeLeftTextBox.Text, out dummy) || dummy < 0 || dummy > 2000)
{
message += Environment.NewLine + "Barcode 'Left' should be between 0 and 2000";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeTopTextBox.Text, out dummy) || dummy < 0 || dummy > 2000)
{
message += Environment.NewLine + "Barcode 'Top' should be between 0 and 2000";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeWidthTextBox.Text, out dummy) || dummy < 0 || dummy > 200)
{
message += Environment.NewLine + "Barcode 'Width' should be between 0 and 200";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeHeightTextBox.Text, out dummy) || dummy < 0 || dummy > 200)
{
message += Environment.NewLine + "Barcode 'Height' should be between 0 and 200";
flags |= CfgUpdateFlags.Error;
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (config.PageOrientation != GetOrientation(orientationComboBox.Text))
{
config.PageOrientation = GetOrientation(orientationComboBox.Text);
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
flags |= UpdateDifferent(ref config.LabelColumnsCount, labelColumnsCountTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LeftTopLabelLeft, leftTopLabelLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LeftTopLabelTop, leftTopLabelTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.GoodOnly, goodOnlyCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.ItemsToPrint, itemsToPrint, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LabelWidth, labelWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LabelHeight, labelHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Template, templateTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
/// Body font properties
flags |= UpdateDifferent(ref config.FontFamily, fontFamilyComboBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.FontSize, int.Parse(fontSizeTextBox.Text), CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
int tmp = (boldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0)
+ (italicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0);
flags |= UpdateDifferent(ref config.FontStyle, tmp, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
for (Culture i = 0; i < Culture.Count; i++)
{
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
{
config.Culture = i;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
break;
}
}
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
if (bt.ToString().Equals(barcodeTypeComboBox.Text))
{
config.BarcodeType = bt;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
break;
}
}
flags |= UpdateDifferent(ref config.BarcodeLeft, barcodeLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeTop, barcodeTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeWidth, barcodeWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeHeight, barcodeHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
{
Printer.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
return flags;
}
private void itemsToPrintButton_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
{
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(itemsToPrint),
};
if (dlg.ShowDialog() == DialogResult.OK)
{
itemsToPrint = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
}
}
#region Configuration Change Handling
public static void OnCmdResponse(object sender, CmdResponseArgs args)
{
if (CmdResponseHandler == null) return;
try { CmdResponseHandler(sender, args); }
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
}
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
public void StartResponseHandler() { }
public void StopResponseHandler() { }
#endregion Configuration Change Handling
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+2 -1
View File
@@ -148,7 +148,8 @@ namespace TBF.BenchControl
Factories.Add(new Output.Printers.Enhanced.FactorySingle());
Factories.Add(new Output.Printers.Enhanced.FactoryCompound());
Factories.Add(new Output.Printers.Enhanced.FactoryHeatMeters());
Factories.Add(new Output.Printers.Label.Factory()); /// Label printer
Factories.Add(new Output.Printers.Label.Factory());
Factories.Add(new Output.Printers.MultiLabel.Factory());
Factories.Add(new Output.Printers.Munich.PrinterFactory());
Factories.Add(new Output.Printers.OnePerMeter.FactorySingle());
Factories.Add(new Output.Printers.OnePerMeter.FactoryCompound());
+3 -2
View File
@@ -180,8 +180,9 @@ namespace TBF
try
{
string culture = LocalSettings.Language.Replace('_', '-');
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
System.Threading.Thread.CurrentThread.CurrentUICulture
= System.Threading.Thread.CurrentThread.CurrentCulture
= new System.Globalization.CultureInfo(LocalSettings.Language.Replace('_', '-'));
}
catch (Exception e)
{
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1413.0")]
[assembly: AssemblyFileVersion("2.18.1413.0")]
[assembly: AssemblyVersion("2.18.1428.0")]
[assembly: AssemblyFileVersion("2.18.1428.0")]
+3
View File
@@ -834,4 +834,7 @@
<data name="Evaporation" xml:space="preserve">
<value>Evaporare</value>
</data>
<data name="FeedingTabPageTitle" xml:space="preserve">
<value>Alimentare</value>
</data>
</root>
+18 -10
View File
@@ -4,31 +4,35 @@
<TestBenches>
<DatabaseSettings>
<BenchName>Test Bench</BenchName>
<BenchName>Mobile test bench</BenchName>
<IsRealBench>true</IsRealBench>
<ProceduresDBSettings>
<DbType>MySql</DbType>
<ConnectionString>SERVER=localhost; DATABASE=testbench; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
</ProceduresDBSettings>
<WaterMetersDBSettings>
<ConnectionString>SERVER=localhost; DATABASE=alzir25; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
<DbType>MySql</DbType>
<ConnectionString>SERVER=localhost; DATABASE=testbench-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
</WaterMetersDBSettings>
<ConnectionString>SERVER=localhost; DATABASE=alzir25-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
<ConnectionString />
</DatabaseSettings>
</TestBenches>
<LastBench>Test Bench</LastBench>
<LoginMethod>UserName</LoginMethod>
<LastBench>Mobile test bench</LastBench>
<BatchNr>1</BatchNr>
<RealDensity>998.2008</RealDensity>
<AtTemperature>20</AtTemperature>
<RightPaneHorizSplitterDistance>25</RightPaneHorizSplitterDistance>
<MainWndLeft>75</MainWndLeft>
<MainWndTop>5</MainWndTop>
<TopPaneVerticalSplitterDistance>596</TopPaneVerticalSplitterDistance>
<MainWndLeft>76</MainWndLeft>
<MainWndTop>21</MainWndTop>
<MainWndWidth>1250</MainWndWidth>
<MainWndHeight>750</MainWndHeight>
<ManiWndMaximized>false</ManiWndMaximized>
<ManiWndMaximized>true</ManiWndMaximized>
<ComponentsDlgLeft>200</ComponentsDlgLeft>
<ComponentsDlgTop>100</ComponentsDlgTop>
<ComponentsDlgWidth>850</ComponentsDlgWidth>
<ComponentsDlgHeight>500</ComponentsDlgHeight>
<PopupResultsLeft>0</PopupResultsLeft>
<PopupResultsTop>0</PopupResultsTop>
<PopupResultsWidth>0</PopupResultsWidth>
<PopupResultsHeight>0</PopupResultsHeight>
<PathsDlgLeft>0</PathsDlgLeft>
<PathsDlgTop>0</PathsDlgTop>
<PathsDlgWidth>0</PathsDlgWidth>
@@ -53,6 +57,10 @@
<OneProcedureDlgHeight>0</OneProcedureDlgHeight>
<PrintOrderLeft>0</PrintOrderLeft>
<PrintOrderTop>0</PrintOrderTop>
<EnduranceDlgLeft>0</EnduranceDlgLeft>
<EnduranceDlgTop>0</EnduranceDlgTop>
<EnduranceDlgWidth>0</EnduranceDlgWidth>
<EnduranceDlgHeight>0</EnduranceDlgHeight>
<PrintOrderOnlyGoodResult>false</PrintOrderOnlyGoodResult>
<PrintOrderOnlyLastResult>false</PrintOrderOnlyLastResult>
<ResultsConfigMeters>Vertically</ResultsConfigMeters>
+2 -1
View File
@@ -60,10 +60,11 @@
<logger name="NHibernate"> <level value="ERROR" /> </logger>
<logger name="TBF.BenchControl.StateMachine"> <level value="INFO" /> </logger>
<logger name="TBF.BenchControl.State"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.ControlComdWrap"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.ControlComWrap"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.Pump"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Elde.PumpWithFM"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.MettlerToledo"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Fomulas"> <level value="FATAL" /> </logger>
<logger name="TBF.BenchControl.Elde.StartMeasurementOp"> <level value="WARN" /> </logger>
<logger name="TBF.BenchControl.Modbus"> <level value="DEBUG" /> </logger>
</log4net>
+18 -6
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;ALZIR_25;LANG_FR;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -49,7 +49,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;ALZIR_25;LANG_FR;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -58,7 +58,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;ALZIR_25;LANG_FR;STABLE_MASS_EXTRAS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -67,7 +67,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;ALZIR_25;LANG_FR;STABLE_MASS_EXTRAS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -97,8 +97,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3Munich">
<HintPath>..\packages\ControlBoard\Munich\ControlComponent3Munich.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\Alzir-25\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -990,6 +990,15 @@
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Output\Printers\Label\Factory.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\Factory.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\Printer.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\PrinterCfg.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\PrinterCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\Output\Printers\MultiLabel\PrinterCfgCtrl.Designer.cs">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Output\Printers\Munich\Printer.cs" />
<Compile Include="BenchControl\Output\Printers\Munich\PrinterCfg.cs" />
<Compile Include="BenchControl\Output\Printers\Munich\PrinterCfgCtrl.cs">
@@ -2811,6 +2820,9 @@
<EmbeddedResource Include="BenchControl\Output\Printers\Label\PrinterCfgCtrl.resx">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Output\Printers\MultiLabel\PrinterCfgCtrl.resx">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Output\Printers\Munich\PrinterCfgCtrl.resx">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
+2 -2
View File
@@ -54,9 +54,9 @@ namespace TBF.UI
this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.homeTabPage = new System.Windows.Forms.TabPage();
this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1();
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl24();
this.insertTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPageCtrl = new TBF.UI.Results.ResultsTabPageCtrl();
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;LANG_FR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -26,7 +26,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;LANG_FR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+2
View File
@@ -10,6 +10,8 @@ rmdir /s /q Encrypt\bin
rmdir /s /q Encrypt\obj
rmdir /s /q GemCard\bin
rmdir /s /q GemCard\obj
rmdir /s /q GenCode128\bin
rmdir /s /q GenCode128\obj
rmdir /s /q GraphLib\bin
rmdir /s /q GraphLib\obj
rmdir /s /q TracingDB\bin