Output.Printers.Label clean-up : SupressPrinting removed, Template may be empty.

This commit is contained in:
Milan Hanajik
2020-03-06 08:21:24 +01:00
parent 482269209e
commit e1ca118671
5 changed files with 5 additions and 28 deletions
@@ -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,7 +75,6 @@ namespace TBF.BenchControl.Output.Printers.Label
printerCfg.Culture = newCfg.Culture;
printerCfg.NrOfCopies = newCfg.NrOfCopies;
printerCfg.GoodOnly = newCfg.GoodOnly;
printerCfg.SupressPrinting = newCfg.SupressPrinting;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeLeft = newCfg.BarcodeLeft;
printerCfg.BarcodeTop = newCfg.BarcodeTop;
@@ -150,7 +149,6 @@ 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,
BarcodeType = printerCfg.BarcodeType,
BarcodeLeft = printerCfg.BarcodeLeft,
BarcodeTop = printerCfg.BarcodeTop,
@@ -31,7 +31,6 @@ namespace TBF.BenchControl.Output.Printers.Label
public Culture Culture;
public int NrOfCopies;
public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing
public Results.Output.Printers.BarcodeType BarcodeType;
public int BarcodeLeft;
@@ -61,20 +60,18 @@ namespace TBF.BenchControl.Output.Printers.Label
FontStyle = 0;
NrOfCopies = 1;
GoodOnly = false;
SupressPrinting = 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",
BarcodeType.ToString()
);
}
@@ -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();
@@ -93,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;
@@ -407,7 +395,6 @@ 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);
@@ -423,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;
@@ -86,7 +86,6 @@ namespace TBF.BenchControl.Output.Printers.Label
cultureComboBox.Text = config.Culture.ToString();
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
goodOnlyCheckBox.Checked = config.GoodOnly;
supressPrintingCheckBox.Checked = config.SupressPrinting;
barcodeTypeComboBox.Text = config.BarcodeType.ToString();
barcodeLeftTextBox.Text = config.BarcodeLeft.ToString();
@@ -110,7 +109,6 @@ namespace TBF.BenchControl.Output.Printers.Label
cultureComboBox.Enabled = true;
nrOfCopiesTextBox.Enabled = true;
goodOnlyCheckBox.Enabled = true;
supressPrintingCheckBox.Enabled = true;
barcodeTypeComboBox.Enabled = true;
barcodeLeftTextBox.Enabled = true;
@@ -123,7 +121,7 @@ namespace TBF.BenchControl.Output.Printers.Label
{
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;
@@ -236,7 +234,6 @@ 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);
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{