diff --git a/Results/Output/Printers/Enums.cs b/Results/Output/Printers/Enums.cs
new file mode 100644
index 000000000..4a5985638
--- /dev/null
+++ b/Results/Output/Printers/Enums.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace Results.Output.Printers
+{
+ public enum BarcodeType
+ {
+ None,
+ Code_128_Horizontally,
+ Code_128_Vertically,
+ QR_Code,
+ Count
+ }
+}
diff --git a/Results/Output/Printers/Label/LabelPrintDocument.cs b/Results/Output/Printers/Label/LabelPrintDocument.cs
index 6faeaeb16..e56476e4d 100644
--- a/Results/Output/Printers/Label/LabelPrintDocument.cs
+++ b/Results/Output/Printers/Label/LabelPrintDocument.cs
@@ -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
}
}
}
diff --git a/Results/Output/Printers/Label/LabelPrinterCfg.cs b/Results/Output/Printers/Label/LabelPrinterCfg.cs
index 46c12520d..be0706ba7 100644
--- a/Results/Output/Printers/Label/LabelPrinterCfg.cs
+++ b/Results/Output/Printers/Label/LabelPrinterCfg.cs
@@ -17,8 +17,7 @@ namespace Results.Output.Printers.Label
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;
diff --git a/Results/Results.csproj b/Results/Results.csproj
index 7cde6d471..3f7fb3453 100644
--- a/Results/Results.csproj
+++ b/Results/Results.csproj
@@ -150,6 +150,7 @@
Component
+
Component
@@ -190,6 +191,10 @@
{743DF7DB-C7B6-42EB-986D-0F485E5588E4}
Config
+
+ {32817bf9-e380-4467-9c7f-936f4b122bc7}
+ GenCode128
+
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}
TracingDB
diff --git a/TBF/BenchControl/Output/Printers/Label/Printer.cs b/TBF/BenchControl/Output/Printers/Label/Printer.cs
index 6536b8390..a423a72f1 100644
--- a/TBF/BenchControl/Output/Printers/Label/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/Label/Printer.cs
@@ -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;
@@ -76,8 +76,7 @@ namespace TBF.BenchControl.Output.Printers.Label
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;
@@ -152,8 +151,7 @@ namespace TBF.BenchControl.Output.Printers.Label
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,
diff --git a/TBF/BenchControl/Output/Printers/Label/PrinterCfg.cs b/TBF/BenchControl/Output/Printers/Label/PrinterCfg.cs
index 0f91176b9..49499ce99 100644
--- a/TBF/BenchControl/Output/Printers/Label/PrinterCfg.cs
+++ b/TBF/BenchControl/Output/Printers/Label/PrinterCfg.cs
@@ -33,8 +33,7 @@ namespace TBF.BenchControl.Output.Printers.Label
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;
@@ -63,7 +62,7 @@ namespace TBF.BenchControl.Output.Printers.Label
NrOfCopies = 1;
GoodOnly = false;
SupressPrinting = false;
- DrawSNasBarcode = false;
+ BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
@@ -76,7 +75,7 @@ namespace TBF.BenchControl.Output.Printers.Label
Template,
GoodOnly ? "yes" : "no",
SupressPrinting ? "yes" : "no",
- DrawSNasBarcode ? "yes" : "no"
+ BarcodeType.ToString()
);
}
}
diff --git a/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.Designer.cs b/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.Designer.cs
index fd04c5c4f..5ce9480ac 100644
--- a/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.Designer.cs
+++ b/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.Designer.cs
@@ -55,18 +55,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
@@ -289,124 +287,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);
@@ -428,8 +414,6 @@ namespace TBF.BenchControl.Output.Printers.Label
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();
@@ -460,17 +444,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;
}
}
diff --git a/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.cs b/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.cs
index 173ff909b..743360fe0 100644
--- a/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.cs
+++ b/TBF/BenchControl/Output/Printers/Label/PrinterCfgCtrl.cs
@@ -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)
@@ -84,8 +88,7 @@ namespace TBF.BenchControl.Output.Printers.Label
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();
@@ -109,20 +112,13 @@ namespace TBF.BenchControl.Output.Printers.Label
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;
@@ -165,6 +161,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";
@@ -236,8 +238,15 @@ namespace TBF.BenchControl.Output.Printers.Label
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 +273,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)