GroupPrinter - print in separate files/printers
This commit is contained in:
parent
1140d67c75
commit
021beeb47f
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.9.2140.0")]
|
||||
[assembly: AssemblyFileVersion("3.9.2140.0")]
|
||||
[assembly: AssemblyVersion("3.9.2141.1")]
|
||||
[assembly: AssemblyFileVersion("3.9.2141.1")]
|
||||
|
||||
@ -0,0 +1,112 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Config.Resources;
|
||||
using NHibernate;
|
||||
|
||||
namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
{
|
||||
public class GroupPrinterUtils
|
||||
{
|
||||
public static ISession GetCorrespondedEntities(in IList<Component> cmpntEntities, in List<string> itemsToPrint)
|
||||
{
|
||||
ISession session = TBF.DB.CreateSession(DBKind.Config);
|
||||
IList<Component> cmpntEntitiesAll = session.QueryOver<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List<Component>();
|
||||
|
||||
cmpntEntities?.Clear();
|
||||
|
||||
List<PrinterDef> printerDefs = new List<PrinterDef>();
|
||||
if (itemsToPrint != null && itemsToPrint.Count > 0)
|
||||
{
|
||||
foreach (string printer in itemsToPrint)
|
||||
{
|
||||
printerDefs.Add(PrinterDef.fromString(printer));
|
||||
}
|
||||
}
|
||||
|
||||
if (printerDefs.Count > 0)
|
||||
{
|
||||
foreach (PrinterDef printerDef in printerDefs)
|
||||
{
|
||||
foreach (var component in cmpntEntitiesAll)
|
||||
{
|
||||
if (printerDef.Equals(PrinterDef.fromComponent(component)))
|
||||
{
|
||||
cmpntEntities.Add(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
public static string[] GetExpandedGroupPrinters(string[] printers)
|
||||
{
|
||||
List<string> allPrinters = new List<string>();
|
||||
|
||||
ISession session = TBF.DB.CreateSession(DBKind.Config);
|
||||
IList<Component> cmpntEntitiesAll = session.QueryOver<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List<Component>();
|
||||
|
||||
string groupPrinterClassName = new Factory().ClassName;
|
||||
|
||||
foreach (string printer in printers)
|
||||
{
|
||||
foreach (var component in cmpntEntitiesAll)
|
||||
{
|
||||
if (printer.Equals(component.Name))
|
||||
{
|
||||
if (component.ClassName.Equals(groupPrinterClassName))
|
||||
{
|
||||
List<PrinterDef> printersDef = PrinterDef.fromParametersString(component.Parameters);
|
||||
foreach (PrinterDef printerDef in printersDef)
|
||||
{
|
||||
allPrinters.Add(printerDef.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
allPrinters.Add(printer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return allPrinters.ToArray();
|
||||
}
|
||||
|
||||
public static void UpdateParametersInEntitys(ISession session, IList<Component> cmpntEntities,string definedPrinter)
|
||||
{
|
||||
|
||||
{
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
foreach (Component printerItem in cmpntEntities)
|
||||
{
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.LoadXml(printerItem.Parameters);
|
||||
XmlNodeList printerCfg = xmlDocument.GetElementsByTagName("PrinterName");
|
||||
|
||||
foreach (XmlNode itemNode in printerCfg)
|
||||
{
|
||||
itemNode.InnerText = definedPrinter;
|
||||
}
|
||||
|
||||
printerItem.Parameters = xmlDocument.OuterXml;
|
||||
|
||||
|
||||
session.SaveOrUpdate(printerItem); /// Save user 'admin'
|
||||
|
||||
}
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
@ -10,209 +12,128 @@ using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Results.Output.Printers;
|
||||
using FluentNHibernate.Conventions;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using NHibernate;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.Configs;
|
||||
|
||||
|
||||
namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
{
|
||||
public partial class PrinterCfgCtrl : ConfigCtrlUtils, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
|
||||
public partial class PrinterCfgCtrl : ConfigCtrlUtils, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
IList<Component> cmpntEntities;
|
||||
public bool ShowMore
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
PrinterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as PrinterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
IList<Component> cmpntEntities;
|
||||
private ISession session;
|
||||
|
||||
string[] itemsToPrint;
|
||||
PrinterCfg config;
|
||||
|
||||
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++)
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
barcodeTypeComboBox.Items.Add(bt.ToString());
|
||||
config = value as PrinterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
|
||||
List<string> itemsToPrint;
|
||||
|
||||
public PrinterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Localize();
|
||||
}
|
||||
|
||||
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
printerComboBox.Items.Add(Strings.default_printer);
|
||||
foreach (var p in PrinterSettings.InstalledPrinters) printerComboBox.Items.Add(p);
|
||||
|
||||
itemsToPrint = config.ItemsToPrint;
|
||||
EnableEdit(false);
|
||||
|
||||
InintComponents();
|
||||
|
||||
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;
|
||||
printerComboBox.Text = string.IsNullOrEmpty(config.PrinterName) ? Strings.default_printer : config.PrinterName;
|
||||
templateTextBox.Text = config.Template;
|
||||
orientationComboBox.Text = config.PageOrientation.ToString();
|
||||
paperWidthTextBox.Text = config.PaperWidth.ToString();
|
||||
paperHeightTextBox.Text = config.PaperHeight.ToString();
|
||||
|
||||
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();
|
||||
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
|
||||
goodOnlyCheckBox.Checked = config.GoodOnly;
|
||||
|
||||
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();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
printerComboBox.Enabled = true;
|
||||
selectPrinterButton.Enabled = true;
|
||||
templateTextBox.Enabled = true;
|
||||
orientationComboBox.Enabled = true;
|
||||
paperWidthTextBox.Enabled = true;
|
||||
paperHeightTextBox.Enabled = true;
|
||||
itemsToPrintButton.Enabled = true;
|
||||
fontFamilyComboBox.Enabled = true;
|
||||
fontSizeTextBox.Enabled = true;
|
||||
boldCheckBox.Enabled = true;
|
||||
italicCheckBox.Enabled = true;
|
||||
cultureComboBox.Enabled = true;
|
||||
nrOfCopiesTextBox.Enabled = true;
|
||||
goodOnlyCheckBox.Enabled = true;
|
||||
|
||||
barcodeTypeComboBox.Enabled = true;
|
||||
barcodeLeftTextBox.Enabled = true;
|
||||
barcodeTopTextBox.Enabled = true;
|
||||
barcodeWidthTextBox.Enabled = true;
|
||||
barcodeHeightTextBox.Enabled = true;
|
||||
void Localize()
|
||||
{
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
public void Closing()
|
||||
{
|
||||
// if (printerComboBox.Enabled && !printerComboBox.Text.IsEmpty())
|
||||
// {
|
||||
// GroupPrinterUtils.UpdateParametersInEntitys(session, cmpntEntities, printerComboBox.Text);
|
||||
// }
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(templateTextBox.Text) && !File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
|
||||
{
|
||||
message += Environment.NewLine + "Template file missing";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
void InintComponents()
|
||||
{
|
||||
cmpntEntities = cmpntEntities == null ? new List<Component>() : cmpntEntities;
|
||||
itemsToPrint = config.ItemsToPrint?.ToList();
|
||||
session = GroupPrinterUtils.GetCorrespondedEntities(in cmpntEntities, in itemsToPrint);
|
||||
|
||||
if ((int)GetOrientation(orientationComboBox.Text) < 0)
|
||||
{
|
||||
message += Environment.NewLine + "Invalid page orientation";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
RedrawAll();
|
||||
}
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(paperWidthTextBox.Text, out dummy) || dummy <= 0)
|
||||
{
|
||||
message += Environment.NewLine + "Invalid paper width";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
if (!int.TryParse(paperHeightTextBox.Text, out dummy) || dummy <= 0)
|
||||
{
|
||||
message += Environment.NewLine + "Invalid paper 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))
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
printerComboBox.Text =
|
||||
string.IsNullOrEmpty(config.PrinterName) ? Strings.default_printer : config.PrinterName;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
EnableEdit(true);
|
||||
}
|
||||
|
||||
private void EnableEdit(bool bEnable)
|
||||
{
|
||||
nameTextBox.Enabled = bEnable;
|
||||
printerComboBox.Enabled = bEnable;
|
||||
selectPrinterButton.Enabled = bEnable;
|
||||
btListAdd.Enabled = bEnable;
|
||||
btListRemove.Enabled = bEnable;
|
||||
btMoveUp.Enabled = bEnable;
|
||||
btMoveDown.Enabled = bEnable;
|
||||
listViewEx.Enabled = bEnable;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
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)
|
||||
{
|
||||
message += Environment.NewLine + "Invalid barcode type";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
string newPrinter = (printerComboBox.Text == Strings.default_printer) ? string.Empty : printerComboBox.Text;
|
||||
if (config.PrinterName != newPrinter)
|
||||
@ -221,89 +142,49 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
flags |= UpdateDifferent(ref config.Template, templateTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
if (config.PageOrientation != GetOrientation(orientationComboBox.Text))
|
||||
{
|
||||
config.PageOrientation = GetOrientation(orientationComboBox.Text);
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
flags |= UpdateDifferent(ref config.PaperWidth, paperWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.PaperHeight, paperHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
flags |= UpdateDifferent(ref config.ItemsToPrint, itemsToPrint, 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;
|
||||
}
|
||||
}
|
||||
|
||||
flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.GoodOnly, goodOnlyCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
if (bt.ToString().Equals(barcodeTypeComboBox.Text))
|
||||
{
|
||||
config.BarcodeType = bt;
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
break;
|
||||
}
|
||||
Printer.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
}
|
||||
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;
|
||||
}
|
||||
List<string> itemsComponent = new List<string>();
|
||||
foreach (Component entity in cmpntEntities)
|
||||
{
|
||||
itemsComponent.Add(PrinterDef.fromComponent(entity).ToString());
|
||||
}
|
||||
|
||||
private void itemsToPrintButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
|
||||
{
|
||||
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(itemsToPrint),
|
||||
};
|
||||
config.ItemsToPrint = itemsComponent.ToArray();
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
itemsToPrint = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
#region Configuration Change Handling
|
||||
#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 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 static event EventHandler<CmdResponseArgs> CmdResponseHandler;
|
||||
|
||||
public void StartResponseHandler() { }
|
||||
public void StopResponseHandler() { }
|
||||
public void StartResponseHandler()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
public void StopResponseHandler()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
|
||||
private void selectPrinterButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -316,40 +197,96 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
|
||||
private void btListAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
PrinterTestBenchComponentSelectorDlg dlg = new PrinterTestBenchComponentSelectorDlg();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (cmpntEntities == null)
|
||||
{
|
||||
cmpntEntities = new List<Component>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cmpntEntities.Any(com => com.ItemNr == dlg.SelectedComponent.ItemNr))
|
||||
{
|
||||
MessageBox.Show("Item is in list included already!", "Warning", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cmpntEntities.Add(dlg.SelectedComponent);
|
||||
RedrawAll();
|
||||
}
|
||||
PrinterTestBenchComponentSelectorDlg dlg = new PrinterTestBenchComponentSelectorDlg();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (cmpntEntities == null)
|
||||
{
|
||||
cmpntEntities = new List<Component>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cmpntEntities.Any(com => com.ItemNr == dlg.SelectedComponent.ItemNr))
|
||||
{
|
||||
MessageBox.Show("Item is in list included already!", "Warning", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cmpntEntities.Add(dlg.SelectedComponent);
|
||||
RedrawAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RedrawAll()
|
||||
{
|
||||
listViewEx.Items.Clear();
|
||||
foreach (var cmpnt in cmpntEntities) DrawOne(cmpnt);
|
||||
listViewEx.Items.Clear();
|
||||
foreach (var cmpnt in cmpntEntities) DrawOne(cmpnt);
|
||||
}
|
||||
|
||||
|
||||
void DrawOne(Component cmpnt)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(cmpnt.ItemNr.ToString());
|
||||
lvi.Tag = cmpnt;
|
||||
lvi.SubItems.Add(cmpnt.Name);
|
||||
listViewEx.Items.Add(lvi);
|
||||
ListViewItem lvi = new ListViewItem(cmpnt.ItemNr.ToString());
|
||||
lvi.Tag = cmpnt;
|
||||
lvi.SubItems.Add(cmpnt.Name);
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
|
||||
private void btListRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count > 0)
|
||||
{
|
||||
int selectedIndex = listViewEx.SelectedIndices[0];
|
||||
Component cmpntEntity = cmpntEntities[selectedIndex];
|
||||
if (MessageBox.Show($"Do you want remove {cmpntEntity.Name} from list?", "Remove Action",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
cmpntEntities.Remove(cmpntEntity);
|
||||
listViewEx.Items.RemoveAt(selectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btMoveUp_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count > 0)
|
||||
{
|
||||
int selectedIndex = listViewEx.SelectedIndices[0];
|
||||
if (selectedIndex > 0)
|
||||
{
|
||||
int newItemIndex = (selectedIndex - 1);
|
||||
Component cmpntEntity = cmpntEntities[selectedIndex];
|
||||
|
||||
cmpntEntities.Insert(newItemIndex, cmpntEntity);
|
||||
cmpntEntities.RemoveAt(selectedIndex + 1);
|
||||
|
||||
RedrawAll();
|
||||
listViewEx.Items[newItemIndex].Selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btMoveDown_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count > 0)
|
||||
{
|
||||
int selectedIndex = listViewEx.SelectedIndices[0];
|
||||
if (selectedIndex < listViewEx.Items.Count - 1)
|
||||
{
|
||||
Component cmpntEntity = cmpntEntities[selectedIndex];
|
||||
|
||||
int newItemIndex = selectedIndex + 2;
|
||||
cmpntEntities.Insert(newItemIndex, cmpntEntity);
|
||||
cmpntEntities.RemoveAt(selectedIndex);
|
||||
|
||||
RedrawAll();
|
||||
listViewEx.Items[newItemIndex - 1].Selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,36 +34,6 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
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.paperWidthTextBox = new System.Windows.Forms.TextBox();
|
||||
this.paperWidthLabel = new System.Windows.Forms.Label();
|
||||
this.paperHeightTextBox = 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.printerComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.selectPrinterButton = new System.Windows.Forms.Button();
|
||||
this.printerLabel = new System.Windows.Forms.Label();
|
||||
@ -73,6 +43,8 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
this.btListAdd = new System.Windows.Forms.Button();
|
||||
this.btListRemove = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.btMoveUp = new System.Windows.Forms.Button();
|
||||
this.btMoveDown = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
@ -104,305 +76,6 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "Class name";
|
||||
//
|
||||
// orientationLabel
|
||||
//
|
||||
this.orientationLabel.AutoSize = true;
|
||||
this.orientationLabel.Location = new System.Drawing.Point(12, 175);
|
||||
this.orientationLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.orientationLabel.Name = "orientationLabel";
|
||||
this.orientationLabel.Size = new System.Drawing.Size(125, 20);
|
||||
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(183, 171);
|
||||
this.orientationComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.orientationComboBox.Name = "orientationComboBox";
|
||||
this.orientationComboBox.Size = new System.Drawing.Size(193, 28);
|
||||
this.orientationComboBox.TabIndex = 4;
|
||||
//
|
||||
// templateTextBox
|
||||
//
|
||||
this.templateTextBox.Enabled = false;
|
||||
this.templateTextBox.Location = new System.Drawing.Point(183, 135);
|
||||
this.templateTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.templateTextBox.Name = "templateTextBox";
|
||||
this.templateTextBox.Size = new System.Drawing.Size(340, 26);
|
||||
this.templateTextBox.TabIndex = 10;
|
||||
//
|
||||
// templateLabel
|
||||
//
|
||||
this.templateLabel.AutoSize = true;
|
||||
this.templateLabel.Location = new System.Drawing.Point(12, 140);
|
||||
this.templateLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.templateLabel.Name = "templateLabel";
|
||||
this.templateLabel.Size = new System.Drawing.Size(99, 20);
|
||||
this.templateLabel.TabIndex = 9;
|
||||
this.templateLabel.Text = "Template file";
|
||||
//
|
||||
// paperWidthTextBox
|
||||
//
|
||||
this.paperWidthTextBox.Enabled = false;
|
||||
this.paperWidthTextBox.Location = new System.Drawing.Point(183, 208);
|
||||
this.paperWidthTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.paperWidthTextBox.Name = "paperWidthTextBox";
|
||||
this.paperWidthTextBox.Size = new System.Drawing.Size(74, 26);
|
||||
this.paperWidthTextBox.TabIndex = 6;
|
||||
//
|
||||
// paperWidthLabel
|
||||
//
|
||||
this.paperWidthLabel.AutoSize = true;
|
||||
this.paperWidthLabel.Location = new System.Drawing.Point(12, 212);
|
||||
this.paperWidthLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.paperWidthLabel.Name = "paperWidthLabel";
|
||||
this.paperWidthLabel.Size = new System.Drawing.Size(148, 20);
|
||||
this.paperWidthLabel.TabIndex = 5;
|
||||
this.paperWidthLabel.Text = "Paper width / height";
|
||||
//
|
||||
// paperHeightTextBox
|
||||
//
|
||||
this.paperHeightTextBox.Enabled = false;
|
||||
this.paperHeightTextBox.Location = new System.Drawing.Point(264, 208);
|
||||
this.paperHeightTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.paperHeightTextBox.Name = "paperHeightTextBox";
|
||||
this.paperHeightTextBox.Size = new System.Drawing.Size(74, 26);
|
||||
this.paperHeightTextBox.TabIndex = 8;
|
||||
//
|
||||
// italicCheckBox
|
||||
//
|
||||
this.italicCheckBox.AutoSize = true;
|
||||
this.italicCheckBox.Enabled = false;
|
||||
this.italicCheckBox.Location = new System.Drawing.Point(502, 252);
|
||||
this.italicCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.italicCheckBox.Name = "italicCheckBox";
|
||||
this.italicCheckBox.Size = new System.Drawing.Size(22, 21);
|
||||
this.italicCheckBox.TabIndex = 47;
|
||||
this.italicCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// boldCheckBox
|
||||
//
|
||||
this.boldCheckBox.AutoSize = true;
|
||||
this.boldCheckBox.Enabled = false;
|
||||
this.boldCheckBox.Location = new System.Drawing.Point(460, 252);
|
||||
this.boldCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.boldCheckBox.Name = "boldCheckBox";
|
||||
this.boldCheckBox.Size = new System.Drawing.Size(22, 21);
|
||||
this.boldCheckBox.TabIndex = 46;
|
||||
this.boldCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// fontSizeTextBox
|
||||
//
|
||||
this.fontSizeTextBox.Enabled = false;
|
||||
this.fontSizeTextBox.Location = new System.Drawing.Point(388, 243);
|
||||
this.fontSizeTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.fontSizeTextBox.Name = "fontSizeTextBox";
|
||||
this.fontSizeTextBox.Size = new System.Drawing.Size(42, 26);
|
||||
this.fontSizeTextBox.TabIndex = 45;
|
||||
//
|
||||
// fontFamilyComboBox
|
||||
//
|
||||
this.fontFamilyComboBox.Enabled = false;
|
||||
this.fontFamilyComboBox.FormattingEnabled = true;
|
||||
this.fontFamilyComboBox.Location = new System.Drawing.Point(183, 243);
|
||||
this.fontFamilyComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.fontFamilyComboBox.Name = "fontFamilyComboBox";
|
||||
this.fontFamilyComboBox.Size = new System.Drawing.Size(193, 28);
|
||||
this.fontFamilyComboBox.TabIndex = 44;
|
||||
//
|
||||
// bodyFontLabel
|
||||
//
|
||||
this.bodyFontLabel.AutoSize = true;
|
||||
this.bodyFontLabel.Location = new System.Drawing.Point(12, 248);
|
||||
this.bodyFontLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.bodyFontLabel.Name = "bodyFontLabel";
|
||||
this.bodyFontLabel.Size = new System.Drawing.Size(154, 20);
|
||||
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(496, 229);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(35, 20);
|
||||
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(446, 229);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(47, 20);
|
||||
this.label1.TabIndex = 48;
|
||||
this.label1.Text = "Bold";
|
||||
//
|
||||
// itemsToPrintButton
|
||||
//
|
||||
this.itemsToPrintButton.Enabled = false;
|
||||
this.itemsToPrintButton.Location = new System.Drawing.Point(388, 177);
|
||||
this.itemsToPrintButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.itemsToPrintButton.Name = "itemsToPrintButton";
|
||||
this.itemsToPrintButton.Size = new System.Drawing.Size(136, 46);
|
||||
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(12, 322);
|
||||
this.nrOfCopiesLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.nrOfCopiesLabel.Name = "nrOfCopiesLabel";
|
||||
this.nrOfCopiesLabel.Size = new System.Drawing.Size(133, 20);
|
||||
this.nrOfCopiesLabel.TabIndex = 52;
|
||||
this.nrOfCopiesLabel.Text = "Number of copies";
|
||||
//
|
||||
// nrOfCopiesTextBox
|
||||
//
|
||||
this.nrOfCopiesTextBox.Enabled = false;
|
||||
this.nrOfCopiesTextBox.Location = new System.Drawing.Point(183, 317);
|
||||
this.nrOfCopiesTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.nrOfCopiesTextBox.Name = "nrOfCopiesTextBox";
|
||||
this.nrOfCopiesTextBox.Size = new System.Drawing.Size(74, 26);
|
||||
this.nrOfCopiesTextBox.TabIndex = 51;
|
||||
//
|
||||
// cultureComboBox
|
||||
//
|
||||
this.cultureComboBox.Enabled = false;
|
||||
this.cultureComboBox.FormattingEnabled = true;
|
||||
this.cultureComboBox.Location = new System.Drawing.Point(183, 280);
|
||||
this.cultureComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.cultureComboBox.Name = "cultureComboBox";
|
||||
this.cultureComboBox.Size = new System.Drawing.Size(340, 28);
|
||||
this.cultureComboBox.TabIndex = 54;
|
||||
//
|
||||
// cultureLabel
|
||||
//
|
||||
this.cultureLabel.AutoSize = true;
|
||||
this.cultureLabel.Location = new System.Drawing.Point(12, 285);
|
||||
this.cultureLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.cultureLabel.Name = "cultureLabel";
|
||||
this.cultureLabel.Size = new System.Drawing.Size(63, 20);
|
||||
this.cultureLabel.TabIndex = 53;
|
||||
this.cultureLabel.Text = "Cullture";
|
||||
//
|
||||
// goodOnlyCheckBox
|
||||
//
|
||||
this.goodOnlyCheckBox.AutoSize = true;
|
||||
this.goodOnlyCheckBox.Enabled = false;
|
||||
this.goodOnlyCheckBox.Location = new System.Drawing.Point(368, 322);
|
||||
this.goodOnlyCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
|
||||
this.goodOnlyCheckBox.Size = new System.Drawing.Size(107, 24);
|
||||
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(146, 395);
|
||||
this.barcodeLeftLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.barcodeLeftLabel.Name = "barcodeLeftLabel";
|
||||
this.barcodeLeftLabel.Size = new System.Drawing.Size(37, 20);
|
||||
this.barcodeLeftLabel.TabIndex = 9;
|
||||
this.barcodeLeftLabel.Text = "Left";
|
||||
//
|
||||
// barcodeLeftTextBox
|
||||
//
|
||||
this.barcodeLeftTextBox.Enabled = false;
|
||||
this.barcodeLeftTextBox.Location = new System.Drawing.Point(183, 389);
|
||||
this.barcodeLeftTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.barcodeLeftTextBox.Name = "barcodeLeftTextBox";
|
||||
this.barcodeLeftTextBox.Size = new System.Drawing.Size(44, 26);
|
||||
this.barcodeLeftTextBox.TabIndex = 10;
|
||||
//
|
||||
// barcodeTopTextBox
|
||||
//
|
||||
this.barcodeTopTextBox.Enabled = false;
|
||||
this.barcodeTopTextBox.Location = new System.Drawing.Point(272, 389);
|
||||
this.barcodeTopTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.barcodeTopTextBox.Name = "barcodeTopTextBox";
|
||||
this.barcodeTopTextBox.Size = new System.Drawing.Size(44, 26);
|
||||
this.barcodeTopTextBox.TabIndex = 11;
|
||||
//
|
||||
// barcodeTopLabel
|
||||
//
|
||||
this.barcodeTopLabel.AutoSize = true;
|
||||
this.barcodeTopLabel.Location = new System.Drawing.Point(232, 395);
|
||||
this.barcodeTopLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.barcodeTopLabel.Name = "barcodeTopLabel";
|
||||
this.barcodeTopLabel.Size = new System.Drawing.Size(36, 20);
|
||||
this.barcodeTopLabel.TabIndex = 13;
|
||||
this.barcodeTopLabel.Text = "Top";
|
||||
//
|
||||
// barcodeWidthTextBox
|
||||
//
|
||||
this.barcodeWidthTextBox.Enabled = false;
|
||||
this.barcodeWidthTextBox.Location = new System.Drawing.Point(374, 389);
|
||||
this.barcodeWidthTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
|
||||
this.barcodeWidthTextBox.Size = new System.Drawing.Size(44, 26);
|
||||
this.barcodeWidthTextBox.TabIndex = 14;
|
||||
//
|
||||
// barcodeWidthLabel
|
||||
//
|
||||
this.barcodeWidthLabel.AutoSize = true;
|
||||
this.barcodeWidthLabel.Location = new System.Drawing.Point(321, 395);
|
||||
this.barcodeWidthLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.barcodeWidthLabel.Name = "barcodeWidthLabel";
|
||||
this.barcodeWidthLabel.Size = new System.Drawing.Size(50, 20);
|
||||
this.barcodeWidthLabel.TabIndex = 15;
|
||||
this.barcodeWidthLabel.Text = "Width";
|
||||
//
|
||||
// barcodeHeightTextBox
|
||||
//
|
||||
this.barcodeHeightTextBox.Enabled = false;
|
||||
this.barcodeHeightTextBox.Location = new System.Drawing.Point(480, 389);
|
||||
this.barcodeHeightTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
|
||||
this.barcodeHeightTextBox.Size = new System.Drawing.Size(43, 26);
|
||||
this.barcodeHeightTextBox.TabIndex = 17;
|
||||
//
|
||||
// barcodeHeightLabel
|
||||
//
|
||||
this.barcodeHeightLabel.AutoSize = true;
|
||||
this.barcodeHeightLabel.Location = new System.Drawing.Point(423, 395);
|
||||
this.barcodeHeightLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.barcodeHeightLabel.Name = "barcodeHeightLabel";
|
||||
this.barcodeHeightLabel.Size = new System.Drawing.Size(56, 20);
|
||||
this.barcodeHeightLabel.TabIndex = 18;
|
||||
this.barcodeHeightLabel.Text = "Height";
|
||||
//
|
||||
// barcodeTypeComboBox
|
||||
//
|
||||
this.barcodeTypeComboBox.Enabled = false;
|
||||
this.barcodeTypeComboBox.FormattingEnabled = true;
|
||||
this.barcodeTypeComboBox.Location = new System.Drawing.Point(183, 352);
|
||||
this.barcodeTypeComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
|
||||
this.barcodeTypeComboBox.Size = new System.Drawing.Size(340, 28);
|
||||
this.barcodeTypeComboBox.TabIndex = 19;
|
||||
//
|
||||
// barcodeLabel
|
||||
//
|
||||
this.barcodeLabel.AutoSize = true;
|
||||
this.barcodeLabel.Location = new System.Drawing.Point(12, 357);
|
||||
this.barcodeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.barcodeLabel.Name = "barcodeLabel";
|
||||
this.barcodeLabel.Size = new System.Drawing.Size(126, 20);
|
||||
this.barcodeLabel.TabIndex = 56;
|
||||
this.barcodeLabel.Text = "Barcode with s/n";
|
||||
//
|
||||
// printerComboBox
|
||||
//
|
||||
this.printerComboBox.Enabled = false;
|
||||
@ -442,9 +115,9 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
this.listViewEx.DoubleClickActivation = false;
|
||||
this.listViewEx.FullRowSelect = true;
|
||||
this.listViewEx.HideSelection = false;
|
||||
this.listViewEx.Location = new System.Drawing.Point(178, 433);
|
||||
this.listViewEx.Location = new System.Drawing.Point(183, 136);
|
||||
this.listViewEx.Name = "listViewEx";
|
||||
this.listViewEx.Size = new System.Drawing.Size(345, 104);
|
||||
this.listViewEx.Size = new System.Drawing.Size(340, 344);
|
||||
this.listViewEx.TabIndex = 60;
|
||||
this.listViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewEx.View = System.Windows.Forms.View.Details;
|
||||
@ -461,7 +134,7 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
//
|
||||
// btListAdd
|
||||
//
|
||||
this.btListAdd.Location = new System.Drawing.Point(12, 472);
|
||||
this.btListAdd.Location = new System.Drawing.Point(24, 165);
|
||||
this.btListAdd.Name = "btListAdd";
|
||||
this.btListAdd.Size = new System.Drawing.Size(115, 30);
|
||||
this.btListAdd.TabIndex = 61;
|
||||
@ -471,25 +144,48 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
//
|
||||
// btListRemove
|
||||
//
|
||||
this.btListRemove.Location = new System.Drawing.Point(12, 508);
|
||||
this.btListRemove.Location = new System.Drawing.Point(24, 201);
|
||||
this.btListRemove.Name = "btListRemove";
|
||||
this.btListRemove.Size = new System.Drawing.Size(115, 30);
|
||||
this.btListRemove.TabIndex = 62;
|
||||
this.btListRemove.Text = "Remove";
|
||||
this.btListRemove.UseVisualStyleBackColor = true;
|
||||
this.btListRemove.Click += new System.EventHandler(this.btListRemove_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Location = new System.Drawing.Point(12, 433);
|
||||
this.label3.Location = new System.Drawing.Point(12, 136);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(166, 26);
|
||||
this.label3.TabIndex = 63;
|
||||
this.label3.Text = "List of Print Assembly";
|
||||
//
|
||||
// btMoveUp
|
||||
//
|
||||
this.btMoveUp.Location = new System.Drawing.Point(24, 237);
|
||||
this.btMoveUp.Name = "btMoveUp";
|
||||
this.btMoveUp.Size = new System.Drawing.Size(115, 30);
|
||||
this.btMoveUp.TabIndex = 64;
|
||||
this.btMoveUp.Text = "Move Up";
|
||||
this.btMoveUp.UseVisualStyleBackColor = true;
|
||||
this.btMoveUp.Click += new System.EventHandler(this.btMoveUp_Click);
|
||||
//
|
||||
// btMoveDown
|
||||
//
|
||||
this.btMoveDown.Location = new System.Drawing.Point(24, 273);
|
||||
this.btMoveDown.Name = "btMoveDown";
|
||||
this.btMoveDown.Size = new System.Drawing.Size(115, 30);
|
||||
this.btMoveDown.TabIndex = 65;
|
||||
this.btMoveDown.Text = "Move Down";
|
||||
this.btMoveDown.UseVisualStyleBackColor = true;
|
||||
this.btMoveDown.Click += new System.EventHandler(this.btMoveDown_Click);
|
||||
//
|
||||
// PrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.btMoveDown);
|
||||
this.Controls.Add(this.btMoveUp);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.btListRemove);
|
||||
this.Controls.Add(this.btListAdd);
|
||||
@ -497,36 +193,6 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
this.Controls.Add(this.printerComboBox);
|
||||
this.Controls.Add(this.selectPrinterButton);
|
||||
this.Controls.Add(this.printerLabel);
|
||||
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);
|
||||
this.Controls.Add(this.fontFamilyComboBox);
|
||||
this.Controls.Add(this.bodyFontLabel);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.paperHeightTextBox);
|
||||
this.Controls.Add(this.paperWidthTextBox);
|
||||
this.Controls.Add(this.paperWidthLabel);
|
||||
this.Controls.Add(this.templateTextBox);
|
||||
this.Controls.Add(this.templateLabel);
|
||||
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);
|
||||
@ -538,6 +204,9 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
private System.Windows.Forms.Button btMoveUp;
|
||||
private System.Windows.Forms.Button btMoveDown;
|
||||
|
||||
private System.Windows.Forms.ColumnHeader columnItem;
|
||||
private System.Windows.Forms.ColumnHeader columnName;
|
||||
|
||||
@ -552,36 +221,6 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
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 paperWidthTextBox;
|
||||
private System.Windows.Forms.Label paperWidthLabel;
|
||||
private System.Windows.Forms.TextBox paperHeightTextBox;
|
||||
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.ComboBox printerComboBox;
|
||||
private System.Windows.Forms.Button selectPrinterButton;
|
||||
private System.Windows.Forms.Label printerLabel;
|
||||
|
||||
95
TBF/Rig/Output/Printers/GroupPrinting/Single/PrinterDef.cs
Normal file
95
TBF/Rig/Output/Printers/GroupPrinting/Single/PrinterDef.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
{
|
||||
public class PrinterDef
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
|
||||
public String Name { get; set; }
|
||||
public String ObjName { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || !(obj is PrinterDef))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Name.Equals(((PrinterDef)obj).Name) &&
|
||||
ObjName.Equals(((PrinterDef)obj).ObjName);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Name}:{ObjName}";
|
||||
}
|
||||
|
||||
public Component toComponent(IList<Component> components)
|
||||
{
|
||||
foreach (Component component in components)
|
||||
{
|
||||
if (component.Name.Equals(Name) && component.ClassName.Equals(ObjName))
|
||||
{
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PrinterDef fromString(string formated)
|
||||
{
|
||||
try
|
||||
{
|
||||
PrinterDef printerDef = new PrinterDef();
|
||||
string[] spliteStrings = formated.Split(':');
|
||||
printerDef.Name = spliteStrings[0];
|
||||
printerDef.ObjName = spliteStrings[1];
|
||||
return printerDef;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.Error(e.StackTrace);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<PrinterDef> fromParametersString(string parameters)
|
||||
{
|
||||
List<PrinterDef> printerDefs = new List<PrinterDef>();
|
||||
// we have group printer
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.LoadXml(parameters);
|
||||
XmlNodeList printerCfg = xmlDocument.GetElementsByTagName("ItemsToPrint");
|
||||
// Extract the text content of each <string> element within ItemsToPrint
|
||||
List<string> itemsToPrint = new List<string>();
|
||||
|
||||
foreach (XmlNode itemNode in printerCfg)
|
||||
{
|
||||
// Process each "ItemsToPrint" element here
|
||||
foreach (XmlNode itemToPrint in itemNode.ChildNodes)
|
||||
{
|
||||
if (itemToPrint.NodeType == XmlNodeType.Element && itemToPrint.Name == "string")
|
||||
{
|
||||
printerDefs.Add(PrinterDef.fromString(itemToPrint.InnerText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return printerDefs;
|
||||
}
|
||||
|
||||
public static PrinterDef fromComponent(Component component)
|
||||
{
|
||||
PrinterDef printerDef = new PrinterDef();
|
||||
printerDef.Name = component.Name;
|
||||
printerDef.ObjName = component.ClassName;
|
||||
return printerDef;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,19 +22,7 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
public Component SelectedComponent { get; set; }
|
||||
|
||||
ISession session;
|
||||
|
||||
/// <summary>
|
||||
/// ListViewEx columns
|
||||
/// </summary>
|
||||
enum Column
|
||||
{
|
||||
Number,
|
||||
Name,
|
||||
ClassName,
|
||||
ParentName,
|
||||
Parameters,
|
||||
}
|
||||
|
||||
|
||||
MySortOrder sortOrder = MySortOrder.Ascending;
|
||||
int sortColumn = -1; /// 0-based index of column to be used for sorting
|
||||
|
||||
@ -135,6 +123,13 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
listViewEx.Columns.Add(Strings.Parameters, (ls.ComponentsColumnCount > 6) ? ls.ComponentsColumnWidths[6] : 600);
|
||||
listViewEx.HeaderStyle = ColumnHeaderStyle.Clickable;
|
||||
|
||||
GetEntities();
|
||||
|
||||
RedrawAll();
|
||||
}
|
||||
|
||||
private void GetEntities()
|
||||
{
|
||||
session = TBF.DB.CreateSession(DBKind.Config);
|
||||
IList<Component> cmpntEntitiesAll = session.QueryOver<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
@ -156,10 +151,8 @@ namespace TBF.Rig.Output.Printers.GroupPrinting.Single
|
||||
cmpntEntities.Add(component);
|
||||
}
|
||||
}
|
||||
|
||||
RedrawAll();
|
||||
}
|
||||
|
||||
|
||||
void RedrawAll()
|
||||
{
|
||||
listViewEx.Items.Clear();
|
||||
|
||||
@ -12,6 +12,7 @@ using Config.Entities;
|
||||
using TBF.Rig.Operations;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Output.Printers.GroupPrinting.Single;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.Rig.Sequences
|
||||
@ -149,6 +150,11 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
|
||||
|
||||
private string[] ImplementActiveGroupPrinters(string[] printers)
|
||||
{
|
||||
return GroupPrinterUtils.GetExpandedGroupPrinters(printers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Main sequence execution
|
||||
/// </summary>
|
||||
@ -1315,6 +1321,10 @@ namespace TBF.Rig.Sequences
|
||||
string[] writers = (StateMachine.Procedure.ResultsWriter != null) ? StateMachine.Procedure.ResultsWriter.Split(new char[] { '~' }) : new string[0];
|
||||
string[] printers = (StateMachine.Procedure.ResultsPrinter != null) ? StateMachine.Procedure.ResultsPrinter.Split(new char[] { '~' }) : new string[0];
|
||||
string[] eventTriggers = (StateMachine.Procedure.EventTriggers != null) ? StateMachine.Procedure.EventTriggers.Split(new char[] { '~' }) : new string[0];
|
||||
|
||||
/// we have poassibility print GROUP printing - we just check if exist some like this
|
||||
printers = ImplementActiveGroupPrinters(printers);
|
||||
|
||||
///
|
||||
string[] rsltProcessors = new string[writers.Length + printers.Length + eventTriggers.Length];
|
||||
writers.CopyTo(rsltProcessors, 0);
|
||||
|
||||
@ -157,6 +157,12 @@ namespace TBF.UI
|
||||
}
|
||||
|
||||
Rig.StateMachine.MachineState = TBF.DB.CurrentBench.IsRealBench ? Rig.MachineState.StartingUp : Rig.MachineState.Disabled;
|
||||
|
||||
#if DEBUG
|
||||
//define alvays valid for printer test - BUMI
|
||||
Rig.StateMachine.MachineState = Rig.MachineState.StartingUp;
|
||||
#endif
|
||||
|
||||
///
|
||||
if (Rig.StateMachine.MachineState == Rig.MachineState.StartingUp)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user