1. LabelPrinting project created (based on Prod..Mon..SNPrinting), 2. Minor changes in Label.Printer

This commit is contained in:
Milan Hanajik 2023-12-06 12:03:26 +01:00
parent 8af89136e7
commit 05665288ab
27 changed files with 3604 additions and 7 deletions

2
.gitignore vendored
View File

@ -26,6 +26,8 @@ GenericTest/bin/
GenericTest/obj/
GraphLib/bin/
GraphLib/obj/
LabelPrinting/bin/
LabelPrinting/obj/
MergeResultsDBs/bin/
MergeResultsDBs/obj/
OrderManagement/bin/

6
LabelPrinting/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

7
LabelPrinting/Cnst.cs Normal file
View File

@ -0,0 +1,7 @@
namespace LabelPrinting
{
public class Cnst
{
public const int ExtraPieces = 10;
}
}

View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E4531D13-317C-4D9F-809F-5533B5C3C8BF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LabelPrinting</RootNamespace>
<AssemblyName>LabelPrinting</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>LabelPrinting.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Gma.QrCodeNet.Encoding">
<HintPath>..\packages\QrCode.Net.0.4.0.0\net40\Gma.QrCodeNet.Encoding.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.2\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Cnst.cs" />
<Compile Include="LocalSettings.cs" />
<Compile Include="MainWnd.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainWnd.Designer.cs">
<DependentUpon>MainWnd.cs</DependentUpon>
</Compile>
<Compile Include="Printers\DataMatrixAndTextPrintDoc.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="SettingsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsDlg.Designer.cs">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="MainWnd.resx">
<DependentUpon>MainWnd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Resources\Strings.cs.resx" />
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.sk.resx" />
<EmbeddedResource Include="SettingsDlg.resx">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\DataMatrix4Net\DataMatrix4Net.csproj">
<Project>{7cd2b5b4-3304-4151-b8b4-76a8b8af9b06}</Project>
<Name>DataMatrix4Net</Name>
</ProjectReference>
<ProjectReference Include="..\GenCode128\GenCode128.csproj">
<Project>{32817bf9-e380-4467-9c7f-936f4b122bc7}</Project>
<Name>GenCode128</Name>
</ProjectReference>
<ProjectReference Include="..\Results\Results.csproj">
<Project>{9d0dcc88-dc81-47eb-9fdd-4c3907871bfb}</Project>
<Name>Results</Name>
</ProjectReference>
<ProjectReference Include="..\SharedDatabase\SharedDatabase.csproj">
<Project>{211b5e3f-9996-48a7-abde-c878dd2d71c2}</Project>
<Name>SharedDatabase</Name>
</ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project>
<Name>TBF</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6e5cb0e9-e1b6-4e5d-ac6e-b1049e180f2b}</Project>
<Name>Users</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="SampleConfig\log4netConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,245 @@
///
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Xml.Serialization;
namespace LabelPrinting
{
/// <summary>
/// Class to be serialized to an XML file...
/// </summary>
[XmlRootAttribute("SNPrinting")]
public class LocalSettings
{
static XmlSerializer serializer = XmlSerializer.FromTypes(new[] { typeof(LocalSettings) })[0];
/// Configuration file ecryption/decryption key and initialization vector
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
public Mode Mode;
public string Language; /// User interface language used as CultureInfo(..) constructor argument
public int DelayBetweenLabels; /// Delay between printing two consecutive labels in ms
public bool IsUserLoginRequired; /// true = require user login on program start-up
public string LabelPrinterCfg;
public string TracingDBConnString; /// Connection string to MySQL database with production tracing records
public string UsersDBConnString; /// Connection string to MySQL database with authorized users
public string[] SapNumberHistory; /// SAP number history
public string[] SeparatorHistory; /// Separator history
public int CurrentSNTrail; /// Serial number trail to be printed now
public int RemainingSNsCount; /// Remaining count of serial numbers to be printed in this session
/// Parameterless constructor required by serialization
public LocalSettings() { }
public LocalSettings(bool createNew)
{
if (createNew)
{
Mode = Mode.TbfLabelPrinter;
Language = "EN";
DelayBetweenLabels = 1000;
IsUserLoginRequired = false;
LabelPrinterCfg = new TBF.Rig.Output.Printers.Label.Factory().DefaultConfig().CreateDbEntity().Parameters;
TracingDBConnString = string.Empty;
UsersDBConnString = string.Empty;
SapNumberHistory = new string[] { };
SeparatorHistory = new string[] { "4VQ" };
CurrentSNTrail = 1;
RemainingSNsCount = 1;
}
}
/// <summary>
/// Load public fields of this class from the XML file.
/// </summary>
/// <returns>LocalSettings object or null when Load() fails</returns>
public static LocalSettings Load(string fileName)
{
try
{
bool isEncrypted = true;
using (StreamReader reader = new StreamReader(fileName))
{
isEncrypted = !reader.ReadLine().StartsWith("<?xml version=");
reader.Close();
}
if (isEncrypted)
{
/// Write settings to a string
StringBuilder plain = new StringBuilder();
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(fileName, FileMode.Open))
{
using (ICryptoTransform decryptor = aes.CreateDecryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, decryptor, CryptoStreamMode.Read))
{
using (MemoryStream mStream = new MemoryStream())
{
using (var writer = new BinaryWriter(mStream))
{
int data;
while ((data = cs.ReadByte()) != -1)
{
if (data != 0) writer.Write((byte)data);
}
writer.Flush();
mStream.Position = 0;
using (var reader = new StreamReader(mStream))
{
return serializer.Deserialize(reader) as LocalSettings;
}
}
}
}
}
}
}
}
else
{
using (StreamReader reader = new StreamReader(fileName))
{
return serializer.Deserialize(reader) as LocalSettings;
}
}
}
catch (Exception e)
{
string msg = e.Message;
return null;
}
}
/// <summary>
/// Save public fields of this class to the XML file.
/// </summary>
public void Save()
{
try
{
/// Encrypt and write to file 'Program.LocalSettingsFileName'
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(Program.LocalSettingsFileName, FileMode.Create))
{
using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
{
using (MemoryStream mStream = new MemoryStream())
{
using (var writer = new StreamWriter(mStream))
{
/// Serialize and write settings to a memory stream
serializer.Serialize(writer, this);
writer.Flush();
mStream.Position = 0;
using (var reader = new StreamReader(mStream))
{
/// Encrypt and write to file 'Program.LocalSettingsFileName'
int data;
while ((data = mStream.ReadByte()) != -1) cs.WriteByte((byte)data);
}
}
}
}
}
}
}
}
catch (Exception e)
{
string msg = e.Message;
}
}
/// <summary>
/// Updates history stored in a string array by a new latest string.
/// </summary>
/// <param name="lastStrValue">Last entered string</param>
/// <returns>true = history updated</returns>
public static bool UpdateHistory(string lastStrValue, ref string[] history)
{
const int MaxHistoryLen = 10;
if (string.IsNullOrEmpty(lastStrValue)) return false;
int currentHistoryLength = (history != null) ? history.Length : 0;
int match = -1;
for (int i = 0; i < currentHistoryLength; i++)
{
if (history[i] == lastStrValue)
{
match = i;
break;
}
}
if (match >= 0 || currentHistoryLength >= MaxHistoryLen)
{
/// History does not have to be extended (because of a match) or should not be extended (because of the lenght)
if (match < 0) match = currentHistoryLength - 1;
for (int j = match; j > 0; j--)
{
history[j] = history[j - 1];
}
history[0] = lastStrValue;
}
else
{
/// History wiil be extended, new item inserted at the beginning
string[] newHistory = new string[currentHistoryLength + 1];
newHistory[0] = lastStrValue;
for (int j = 1; j <= currentHistoryLength; j++)
{
newHistory[j] = history[j - 1];
}
history = newHistory;
}
return true;
}
/// <summary>
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
/// </summary>
/// <param name="comboBox">Puchase order ComboBox</param>
public static void PrepareCombo(string[] history, System.Windows.Forms.ComboBox comboBox)
{
if (history != null)
{
for (int i = 0; i < history.Length; i++)
{
comboBox.Items.Add(history[i]);
}
}
if (comboBox.Items.Count > 0)
{
comboBox.Text = comboBox.Items[0].ToString();
}
}
}
public enum Mode
{
TbfLabelPrinter,
Standalone,
WithDatabase,
}
}

197
LabelPrinting/MainWnd.Designer.cs generated Normal file
View File

@ -0,0 +1,197 @@
namespace LabelPrinting
{
partial class MainWnd
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.snTrailTextBox = new System.Windows.Forms.TextBox();
this.countTextBox = new System.Windows.Forms.TextBox();
this.snTrailLabel = new System.Windows.Forms.Label();
this.countLabel = new System.Windows.Forms.Label();
this.sapNumberLabel = new System.Windows.Forms.Label();
this.separatorLabel = new System.Windows.Forms.Label();
this.startButton = new System.Windows.Forms.Button();
this.sapNumberComboBox = new System.Windows.Forms.ComboBox();
this.separatorComboBox = new System.Windows.Forms.ComboBox();
this.interruptButton = new System.Windows.Forms.Button();
this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mainMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// snTrailTextBox
//
this.snTrailTextBox.Location = new System.Drawing.Point(230, 97);
this.snTrailTextBox.Name = "snTrailTextBox";
this.snTrailTextBox.Size = new System.Drawing.Size(121, 20);
this.snTrailTextBox.TabIndex = 8;
//
// countTextBox
//
this.countTextBox.Location = new System.Drawing.Point(230, 123);
this.countTextBox.Name = "countTextBox";
this.countTextBox.Size = new System.Drawing.Size(72, 20);
this.countTextBox.TabIndex = 1;
//
// snTrailLabel
//
this.snTrailLabel.AutoSize = true;
this.snTrailLabel.Location = new System.Drawing.Point(35, 100);
this.snTrailLabel.Name = "snTrailLabel";
this.snTrailLabel.Size = new System.Drawing.Size(110, 13);
this.snTrailLabel.TabIndex = 7;
this.snTrailLabel.Text = "First S/N trail (9 digits)";
//
// countLabel
//
this.countLabel.AutoSize = true;
this.countLabel.Location = new System.Drawing.Point(35, 126);
this.countLabel.Name = "countLabel";
this.countLabel.Size = new System.Drawing.Size(65, 13);
this.countLabel.TabIndex = 0;
this.countLabel.Text = "S/N-s count";
//
// sapNumberLabel
//
this.sapNumberLabel.AutoSize = true;
this.sapNumberLabel.Location = new System.Drawing.Point(35, 48);
this.sapNumberLabel.Name = "sapNumberLabel";
this.sapNumberLabel.Size = new System.Drawing.Size(111, 13);
this.sapNumberLabel.TabIndex = 3;
this.sapNumberLabel.Text = "SAP number ( 8 digits)";
//
// separatorLabel
//
this.separatorLabel.AutoSize = true;
this.separatorLabel.Location = new System.Drawing.Point(35, 74);
this.separatorLabel.Name = "separatorLabel";
this.separatorLabel.Size = new System.Drawing.Size(124, 13);
this.separatorLabel.TabIndex = 5;
this.separatorLabel.Text = "Separator ( 3 characters)";
//
// startButton
//
this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.startButton.Location = new System.Drawing.Point(439, 63);
this.startButton.Name = "startButton";
this.startButton.Size = new System.Drawing.Size(117, 54);
this.startButton.TabIndex = 2;
this.startButton.Text = "Start printing";
this.startButton.UseVisualStyleBackColor = true;
this.startButton.Click += new System.EventHandler(this.startButton_Click);
//
// sapNumberComboBox
//
this.sapNumberComboBox.FormattingEnabled = true;
this.sapNumberComboBox.Location = new System.Drawing.Point(230, 45);
this.sapNumberComboBox.Name = "sapNumberComboBox";
this.sapNumberComboBox.Size = new System.Drawing.Size(121, 21);
this.sapNumberComboBox.TabIndex = 9;
//
// separatorComboBox
//
this.separatorComboBox.FormattingEnabled = true;
this.separatorComboBox.Location = new System.Drawing.Point(230, 71);
this.separatorComboBox.Name = "separatorComboBox";
this.separatorComboBox.Size = new System.Drawing.Size(72, 21);
this.separatorComboBox.TabIndex = 10;
//
// interruptButton
//
this.interruptButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.interruptButton.Enabled = false;
this.interruptButton.Location = new System.Drawing.Point(590, 63);
this.interruptButton.Name = "interruptButton";
this.interruptButton.Size = new System.Drawing.Size(117, 54);
this.interruptButton.TabIndex = 11;
this.interruptButton.Text = "Interrupt";
this.interruptButton.UseVisualStyleBackColor = true;
this.interruptButton.Click += new System.EventHandler(this.interruptButton_Click);
//
// mainMenuStrip
//
this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.settingsToolStripMenuItem});
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.mainMenuStrip.Name = "mainMenuStrip";
this.mainMenuStrip.Size = new System.Drawing.Size(742, 24);
this.mainMenuStrip.TabIndex = 12;
this.mainMenuStrip.Text = "mainMenuStrip";
//
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.settingsToolStripMenuItem.Text = "Settings";
this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click);
//
// MainWnd
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(742, 168);
this.Controls.Add(this.interruptButton);
this.Controls.Add(this.separatorComboBox);
this.Controls.Add(this.sapNumberComboBox);
this.Controls.Add(this.startButton);
this.Controls.Add(this.separatorLabel);
this.Controls.Add(this.sapNumberLabel);
this.Controls.Add(this.countLabel);
this.Controls.Add(this.snTrailLabel);
this.Controls.Add(this.countTextBox);
this.Controls.Add(this.snTrailTextBox);
this.Controls.Add(this.mainMenuStrip);
this.MainMenuStrip = this.mainMenuStrip;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainWnd";
this.Text = "S/N Printing";
this.Load += new System.EventHandler(this.MainWnd_Load);
this.mainMenuStrip.ResumeLayout(false);
this.mainMenuStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox snTrailTextBox;
private System.Windows.Forms.TextBox countTextBox;
private System.Windows.Forms.Label snTrailLabel;
private System.Windows.Forms.Label countLabel;
private System.Windows.Forms.Label sapNumberLabel;
private System.Windows.Forms.Label separatorLabel;
private System.Windows.Forms.Button startButton;
private System.Windows.Forms.ComboBox sapNumberComboBox;
private System.Windows.Forms.ComboBox separatorComboBox;
private System.Windows.Forms.Button interruptButton;
private System.Windows.Forms.MenuStrip mainMenuStrip;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
}
}

480
LabelPrinting/MainWnd.cs Normal file
View File

@ -0,0 +1,480 @@
///
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using DataMatrix4Net;
using SharedDatabase.Entities;
using LabelPrinting.Resources;
using TBF.Rig.Output.Printers.Label;
using NHibernate;
using Common;
using Results.Entities;
namespace LabelPrinting
{
public partial class MainWnd : Form
{
private static readonly ILog log = LogManager.GetLogger(typeof(MainWnd));
private readonly Factory factory;
private readonly Printer printer;
string programNameAndVer;
string prefix; /// S/N prefix after parsing/verification by the UI
string separator; /// Separator after parsing/verification by the UI
int currentSNTrail; /// Current S/N trai (1st S/N trail after parsing/verification by the UI)
int totalCount; /// Total S/N count after parsing/verification by the UI
int remainingCount; /// Remaining S/N-s count
IList<OrderInfo> orderInfos; /// null in Standalone mode
Timer timer;
bool interrupt;
public MainWnd()
{
InitializeComponent();
Text = programNameAndVer = string.Format("{0} v.{1}", Program.ProgramName, Program.Version); ;
factory = new Factory();
}
public MainWnd(IList<OrderInfo> orderInfos)
: this()
{
this.orderInfos = orderInfos;
if (Program.LocalSettings.Mode == Mode.TbfLabelPrinter)
{
try
{
var cmpntEntity = Config.Entities.Component.CreateFromCfg("Printer", factory.ClassName, string.Empty, 1,
DebugMode.Normal, LogLevel.Off,
Program.LocalSettings.LabelPrinterCfg);
printer = factory.GetComponent(factory.CmpntCfgFromCmpntEntity(cmpntEntity), null) as Printer;
printer.Initialize();
}
catch (Exception)
{
MessageBox.Show("Cannot create or initialize a printer",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
try
{
string culture = Program.LocalSettings.Language.Replace('_', '-');
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
}
catch (Exception)
{
MessageBox.Show("Selected language is not supported.\nUsing English.",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
System.Threading.Thread.CurrentThread.CurrentUICulture =
new System.Globalization.CultureInfo("en");
}
timer = new Timer();
timer.Interval = Program.LocalSettings.DelayBetweenLabels; /// [ms] default = 1000
timer.Tick += new EventHandler(timer_Tick);
}
void Localize()
{
startButton.Text = Strings.Start_printing;
interruptButton.Text = Strings.Interrupt;
settingsToolStripMenuItem.Text = Strings.Settings;
if (Program.LocalSettings.Mode == Mode.TbfLabelPrinter)
{
sapNumberLabel.Text = Strings.Order;
separatorLabel.Text = string.Empty;
separatorComboBox.Visible = false;
snTrailLabel.Text = Strings.Serial_number;
}
else
{
sapNumberLabel.Text = Strings.SAP_number_8_digits;
separatorLabel.Text = Strings.Separator_3_characters;
snTrailLabel.Text = Strings.First_SN_trail_9_digits;
}
countLabel.Text = Strings.Labels_count;
}
private void MainWnd_Load(object sender, EventArgs e)
{
Localize();
LocalSettings.PrepareCombo(Program.LocalSettings.SapNumberHistory, sapNumberComboBox);
LocalSettings.PrepareCombo(Program.LocalSettings.SeparatorHistory, separatorComboBox);
if (Program.LocalSettings.Mode == Mode.TbfLabelPrinter)
{
snTrailTextBox.Text = string.Empty;
countTextBox.Text = Math.Max(Program.LocalSettings.RemainingSNsCount, 1).ToString();
snTrailLabel.Top -= 26;
snTrailTextBox.Top -= 26;
countLabel.Top -= 26;
countTextBox.Top -= 26;
this.ActiveControl = snTrailTextBox;
}
else if (Program.LocalSettings.Mode == Mode.Standalone)
{
snTrailTextBox.Text = Program.LocalSettings.CurrentSNTrail.ToString("D9");
countTextBox.Text = Math.Max(Program.LocalSettings.RemainingSNsCount, 1).ToString();
}
else
{
if (orderInfos == null) throw new Exception("Missing OrderInfo-s from production tracing database");
currentSNTrail = 0;
foreach (var oi in orderInfos)
{
if (oi.BaseNr1 + oi.PiecesCount + Cnst.ExtraPieces > currentSNTrail)
{
currentSNTrail = oi.BaseNr1 + oi.PiecesCount + Cnst.ExtraPieces;
}
}
snTrailTextBox.Text = currentSNTrail.ToString("D9");
snTrailTextBox.Enabled = false;
}
}
/// <summary>
/// Start printing labels
/// </summary>
private void startButton_Click(object sender, EventArgs e)
{
if (!int.TryParse(countTextBox.Text, out totalCount) || totalCount <= 0)
{
MessageBox.Show(Strings.Invalid_SNs_count);
return;
}
remainingCount = totalCount;
if (Program.LocalSettings.Mode == Mode.TbfLabelPrinter)
{
var wm = new Results.Entities.WaterMeter();
wm.PurchaseOrder = string.IsNullOrEmpty(sapNumberComboBox.Text) ? string.Empty : sapNumberComboBox.Text;
wm.SerialNr = string.IsNullOrEmpty(snTrailTextBox.Text) ? string.Empty : snTrailTextBox.Text;
LocalSettings.UpdateHistory(sapNumberComboBox.Text, ref Program.LocalSettings.SapNumberHistory);
//Program.LocalSettings.CurrentSNTrail = snTrailTextBox.Text;
Program.LocalSettings.RemainingSNsCount = remainingCount;
Program.LocalSettings.Save();
startButton.Enabled = false;
interruptButton.Enabled = true;
interrupt = false;
printer.PrintResults(wm, "document name");
remainingCount--;
IncrementSN(snTrailTextBox);
}
else
{
/// Program.LocalSettings.Mode == Mode.Standalone || Program.LocalSettings.Mode == Mode.WithDatabase
int sapNumber;
if (sapNumberComboBox.Text.Length != 8 || !int.TryParse(sapNumberComboBox.Text, out sapNumber) || sapNumber <= 0 || sapNumber > 99999999)
{
MessageBox.Show(Strings.Invalid_SAP_number);
return;
}
if (separatorComboBox.Text.Length != 3)
{
MessageBox.Show(Strings.Invalid_separator);
return;
}
if (snTrailTextBox.Text.Length != 9 || !int.TryParse(snTrailTextBox.Text, out currentSNTrail))
{
MessageBox.Show(Strings.Invalid_first_SN_trail);
return;
}
else if (Program.LocalSettings.Mode == Mode.Standalone && currentSNTrail < Program.LocalSettings.CurrentSNTrail)
{
MessageBox.Show(string.Format("{0}, {1} {2:D9}", Strings.Invalid_first_SN_trail, Strings.min, Program.LocalSettings.CurrentSNTrail));
return;
}
if (Program.LocalSettings.Mode == Mode.Standalone && currentSNTrail > Program.LocalSettings.CurrentSNTrail)
{
if (MessageBox.Show(string.Format("{0} {1:D9}{2}{3}{4}",
Strings.You_are_skipping,
Program.LocalSettings.CurrentSNTrail,
(currentSNTrail == Program.LocalSettings.CurrentSNTrail + 1) ? "" : string.Format(" ... {0:D9}", currentSNTrail - 1),
Environment.NewLine,
Strings.Are_you_sure),
string.Empty,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.No)
{
return;
}
}
if (Program.LocalSettings.Mode == Mode.WithDatabase)
{
SaveNewOrderInfo(ref currentSNTrail, totalCount);
}
prefix = sapNumberComboBox.Text;
separator = separatorComboBox.Text;
sapNumberComboBox.Enabled = false;
separatorComboBox.Enabled = false;
snTrailTextBox.Enabled = false;
countTextBox.Enabled = false;
LocalSettings.UpdateHistory(sapNumberComboBox.Text, ref Program.LocalSettings.SapNumberHistory);
LocalSettings.UpdateHistory(separatorComboBox.Text, ref Program.LocalSettings.SeparatorHistory);
Program.LocalSettings.CurrentSNTrail = currentSNTrail;
Program.LocalSettings.RemainingSNsCount = remainingCount;
Program.LocalSettings.Save();
startButton.Enabled = false;
interruptButton.Enabled = true;
interrupt = false;
PrintOneLabel();
}
if (remainingCount > 0)
{
timer.Start();
}
else
{
Text = string.Format("{0} ... {1}", programNameAndVer, Strings.completed);
MessageBox.Show(string.Format(Strings.x_labels_printed, totalCount));
SaveSettingsUpdateAndEnableUI();
}
}
/// <summary>
/// Save a record tp OrderInfo table that coresponds to printed labels
/// </summary>
/// <param name="currentSNTrail">Start S/N trail number</param>
/// <param name="totalCount">Printed labels count</param>
/// <returns>true when successful</returns>
bool SaveNewOrderInfo(ref int currentSNTrail, int totalCount)
{
ISession session = SharedDatabase.TracingDB.CreateSession(Program.LocalSettings.TracingDBConnString);
ITransaction transaction = session.BeginTransaction();
OrderInfo oi = new OrderInfo();
bool successfullySaved = false;
try
{
var orders = session.QueryOver<OrderInfo>().List();
/// Determine current S/N trail once again
int snTrail = 0;
foreach (var o in orders)
{
if (o.BaseNr1 + o.PiecesCount + Cnst.ExtraPieces > snTrail)
{
snTrail = o.BaseNr1 + o.PiecesCount + Cnst.ExtraPieces;
}
}
/// Compare current S/N trail with the newly obtained one, update if necessary
if (snTrail > currentSNTrail) currentSNTrail = snTrail;
oi.POName = "0000000";
oi.PiecesCount = totalCount;
oi.TestProcedure = string.Empty;
oi.BaseNr1 = currentSNTrail;
oi.BaseNr2 = 0;
oi.BaseNr3 = 0;
oi.BaseNr4 = 0;
oi.BaseNr5 = 0;
oi.Remark = "Manual S/N printing";
oi.Workflow = null;
orders.Add(oi);
session.SaveOrUpdate(oi);
transaction.Commit();
successfullySaved = true;
}
catch (Exception exc)
{
log.ErrorFormat("MySQL database transaction rolled back, data not comitted: {0}", exc.Message);
transaction.Rollback();
}
return successfullySaved;
}
void timer_Tick(object sender, EventArgs args)
{
timer.Stop();
if (interrupt)
{
Text = string.Format("{0} ... {1}", programNameAndVer, Strings.interrupted);
MessageBox.Show(string.Format(Strings.x_labels_printed, totalCount - remainingCount));
SaveSettingsUpdateAndEnableUI();
}
else if (Program.LocalSettings.Mode == Mode.TbfLabelPrinter)
{
var wm = new Results.Entities.WaterMeter();
wm.PurchaseOrder = string.IsNullOrEmpty(sapNumberComboBox.Text) ? string.Empty : sapNumberComboBox.Text;
wm.SerialNr = string.IsNullOrEmpty(snTrailTextBox.Text) ? string.Empty : snTrailTextBox.Text;
printer.PrintResults(wm, "document name");
remainingCount--;
IncrementSN(snTrailTextBox);
if (remainingCount > 0)
{
timer.Enabled = true;
}
else
{
Text = string.Format("{0} ... {1}", programNameAndVer, Strings.completed);
MessageBox.Show(string.Format(Strings.x_labels_printed, totalCount));
SaveSettingsUpdateAndEnableUI();
}
}
else
{
/// Program.LocalSettings.Mode == Mode.Standalone || Program.LocalSettings.Mode == Mode.WithDatabase
PrintOneLabel();
if (remainingCount > 0)
{
timer.Enabled = true;
}
else
{
Text = string.Format("{0} ... {1}", programNameAndVer, Strings.completed);
MessageBox.Show(string.Format(Strings.x_labels_printed, totalCount));
SaveSettingsUpdateAndEnableUI();
}
}
}
char[] digits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
///
void IncrementSN(TextBox tb)
{
if (tb != null)
{
string currentSN = tb.Text;
int currentSnNr;
int startIx = currentSN.IndexOfAny(digits);
if (startIx >= 0)
{
int lastDigitPosPlus1 = startIx + 1;
var listOfDigits = new List<char>(digits);
while (lastDigitPosPlus1 < currentSN.Length && listOfDigits.Contains(currentSN[lastDigitPosPlus1]))
{
lastDigitPosPlus1++;
}
int digitsCount = lastDigitPosPlus1 - startIx;
if (int.TryParse(currentSN.Substring(startIx, digitsCount), out currentSnNr) && currentSnNr >= 0)
{
currentSnNr++;
string newSN = currentSnNr.ToString();
int len = newSN.Length;
if (len <= digitsCount)
{
tb.Text = currentSN.Substring(0, startIx + digitsCount - len) + newSN + currentSN.Substring(startIx + digitsCount);
}
else
{
tb.Text = currentSN.Substring(0, startIx) + newSN + currentSN.Substring(startIx + digitsCount); ;
}
}
}
}
}
void PrintOneLabel()
{
if (remainingCount > 0)
{
string code = string.Format("{0}{1}{2:D9}", prefix, separator, currentSNTrail);
Text = string.Format("{0} ... {1} ... {2} / {3}", programNameAndVer, code, totalCount - remainingCount + 1, totalCount);
DataMatrix matrix = new DataMatrix(code, SymbolSize.SquareAuto);
new Printers.DataMatrixAndTextPrintDoc(matrix.Matrix, code.Replace(separator.Substring(0, 2), "\n")).Print();
currentSNTrail++;
remainingCount--;
}
}
void SaveSettingsUpdateAndEnableUI()
{
if (Program.LocalSettings.Mode != Mode.TbfLabelPrinter) snTrailTextBox.Text = currentSNTrail.ToString("D9");
countTextBox.Text = remainingCount.ToString();
Program.LocalSettings.CurrentSNTrail = currentSNTrail;
Program.LocalSettings.RemainingSNsCount = remainingCount;
Program.LocalSettings.Save();
sapNumberComboBox.Enabled = true;
separatorComboBox.Enabled = true;
snTrailTextBox.Enabled = (Program.LocalSettings.Mode == Mode.TbfLabelPrinter || Program.LocalSettings.Mode == Mode.Standalone);
countTextBox.Enabled = true;
startButton.Enabled = true;
interruptButton.Enabled = false;
}
private void interruptButton_Click(object sender, EventArgs e)
{
interrupt = true;
}
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
/// Connect to the database of users and log in a user
try
{
SharedDatabase.UsersDB.ConnectionString = Program.LocalSettings.UsersDBConnString;
SharedDatabase.UsersDB.DbType = Common.DBType.MySql;
DialogResult dr = new SharedDatabase.Forms.LoginDlg().ShowDialog();
if (dr != DialogResult.OK) return;
}
catch (Exception exc)
{
string msg = string.Format("Failed to connect to the database of users:{0}{1}", Environment.NewLine, exc.Message);
log.Error(msg);
MessageBox.Show(msg);
return;
}
/// Modify program settings
try
{
DialogResult dr = new SettingsDlg(Program.LocalSettings).ShowDialog();
if (dr == DialogResult.OK)
{
Program.LocalSettings.Save();
MessageBox.Show(Strings.Program_restart_is_required);
Close();
}
}
catch (Exception exc)
{
string msg = string.Format("Error occurred, settings were not modified:{0}{1}", Environment.NewLine, exc.Message);
log.Error(msg);
MessageBox.Show(msg);
}
}
}
}

123
LabelPrinting/MainWnd.resx Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,120 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using Gma.QrCodeNet.Encoding;
using DataMatrix4Net;
namespace LabelPrinting.Printers
{
public class DataMatrixAndTextPrintDoc : PrintDocument
{
const float mm = 1 / 0.254F; /// 1 mm expressed in 1/100 inch
int printWidth;
int printHeight;
int leftMargin;
int topMargin;
BitMatrix bitMatrix;
string text;
/// <summary>
/// Constructor
/// </summary>
/// <param name="bitmap">Bitmap to be printed</param>
/// <param name="paperWidth">Label width</param>
/// <param name="paperHeight">Label height</param>
/// <param name="landscape">true = landscape</param>
public DataMatrixAndTextPrintDoc(BitMatrix bitMatrix, string text, bool landscape = false)
{
this.bitMatrix = bitMatrix;
this.text = text;
DefaultPageSettings.Landscape = landscape;
/// Set print area size and margins (in dots using 80 dpi)
if (landscape)
{
printWidth = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
printHeight = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
leftMargin = base.DefaultPageSettings.Margins.Top; /// X
topMargin = base.DefaultPageSettings.Margins.Left; /// Y
}
else
{
printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
leftMargin = base.DefaultPageSettings.Margins.Left; /// X
topMargin = base.DefaultPageSettings.Margins.Top; /// Y
}
}
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
{
base.OnBeginPrint(e); /// Run base code
}
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
{
base.OnPrintPage(e); /// Run base code
DrawLabel(e.Graphics, bitMatrix, text);
e.HasMorePages = false;
}
public static void DrawLabel(Graphics g, BitMatrix bitMatrix, string text)
{
string[] lines = text.Split(new char[] { '\n' });
/// Assuming 100 dpi (printer), drawing size: 2 inch (width) x 1 inch (height)
const float W = 18 * mm;
const float H = 10 * mm;
const float L1 = 7.0f * mm;
const float L2 = 7.0f * mm;
const float T1 = 3.5f * mm;
const float T2 = 5.5f * mm;
const float QRL = 1.0f * mm;
const float QRT = 2.5f * mm;
const float QrSize = 5.5f * mm;
string fontFamily = "Arial";
Font font = new Font(fontFamily, 4.5f, FontStyle.Bold);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.Clear(Color.White);
if (lines.Length > 0)
{
g.DrawString(lines[0], font, Brushes.Black, new RectangleF(L1, T1, W - L1, H - T1));
}
if (lines.Length > 1)
{
g.DrawString(lines[1], font, Brushes.Black, new RectangleF(L2, T2, W - L2, H - T2));
}
g.Flush();
float QrPixSize = QrSize / bitMatrix.Width;
for (int i = 0; i < bitMatrix.Height; i++)
{
for (int j = 0; j < bitMatrix.Width; j++)
{
if (bitMatrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(QRL + QrPixSize * j, QRT + QrPixSize * i, QrPixSize, QrPixSize));
}
}
}
}
}
}

251
LabelPrinting/Program.cs Normal file
View File

@ -0,0 +1,251 @@
///
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using log4net;
using NHibernate;
using Common;
using SharedDatabase;
using SharedDatabase.Entities;
using LabelPrinting.Resources;
namespace LabelPrinting
{
static class Program
{
/// Constants
public static GID[] SettingsAccessLevel = new GID[] { GID.TraceabilityManagement }; /// Group membership to access settings
public const string ProgramName = "LabelPrinting";
public const string ConfigFName = "config.xml";
public const string BackupConfigFName = "config.backup.xml";
public const string Log4NetConfigFName = "log4netConfig.xml";
/// Program information
public static readonly string Version; /// version string
public static readonly DateTime BuildDateTime; /// date and time of program build
public static readonly string ExeDirectory;
public static readonly string ConfigDirectory;
public static readonly string LogDirectory;
public static readonly string LocalSettingsFileName;
public static readonly string LocalSettingsBackupName;
/// Local settings
public static LocalSettings LocalSettings;
/// log4net
static ILog log;
static Program()
{
/// Program version string
Assembly thisAssembly = Assembly.GetExecutingAssembly();
Version ver = thisAssembly.GetName().Version;
Version = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
BuildDateTime = new FileInfo(thisAssembly.Location).LastWriteTime;
/// Local program configuration directory including the trailing backslash
ExeDirectory = Path.GetDirectoryName(thisAssembly.Location);
ConfigDirectory = Path.Combine(ExeDirectory, "..\\Cfg");
LogDirectory = Path.Combine(ExeDirectory, "..", "Logs");
LocalSettingsFileName = Path.Combine(ConfigDirectory, ConfigFName);
LocalSettingsBackupName = Path.Combine(ConfigDirectory, BackupConfigFName);
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
///
/// Check if another instance is running
///
Assembly thisAssembly = Assembly.GetExecutingAssembly();
string processName = Path.GetFileNameWithoutExtension(thisAssembly.Location);
if (System.Diagnostics.Process.GetProcessesByName(processName).Length > 1)
{
MessageBox.Show(string.Format("{0}{1}{2}", string.Format(Strings.Program_0_is_running_already, ProgramName),
Environment.NewLine,
Strings.Close_it_please),
Strings.Error,
MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
return;
}
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
bool configDirectoryCreated = false;
if (!Directory.Exists(ConfigDirectory) || new DirectoryInfo(ConfigDirectory).GetFileSystemInfos().Length == 0)
{
MessageBox.Show(string.Format("{0}{1}{2}", Strings.Program_is_running_for_the_1st_time_on_this_PC,
Environment.NewLine,
Strings.Default_settings_are_used),
Strings.Warning,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
///
/// Create a new config subdirectory
///
Directory.CreateDirectory(ConfigDirectory);
configDirectoryCreated = true;
LocalSettings = new LocalSettings(true);
LocalSettings.Save();
if (File.Exists(Path.Combine(ExeDirectory, "SampleConfig", Log4NetConfigFName)))
{
File.Copy(Path.Combine(ExeDirectory, "SampleConfig", Log4NetConfigFName),
Path.Combine(ConfigDirectory, Log4NetConfigFName));
}
File.SetAttributes(Path.Combine(ConfigDirectory, Log4NetConfigFName), FileAttributes.Normal);
}
///
/// Configue and start logging
///
log4net.Config.XmlConfigurator.Configure(new FileInfo(Path.Combine(ConfigDirectory, Log4NetConfigFName)));
log = LogManager.GetLogger(typeof(Program));
log.Fatal("--------------------------------------------------------------------------------");
log.FatalFormat("{0} ver.{1}", ProgramName, Version);
log.FatalFormat("Executable directory is {0}", ExeDirectory);
if (configDirectoryCreated)
{
log.Fatal("A new config directory and configuration files created !");
}
///
/// Load the local settings
///
LocalSettings = LocalSettings.Load(LocalSettingsFileName);
if (LocalSettings == null)
{
/// Loading local seetings from regular config file failed. Use the backup
LocalSettings = LocalSettings.Load(LocalSettingsBackupName);
if (LocalSettings == null)
{
log.FatalFormat("Local settings: Could not load file {0}, nor {1}.", ConfigFName, BackupConfigFName);
log.Fatal("Application terminated.");
MessageBox.Show(string.Format("Could not load file {0}, nor {1}.", ConfigFName, BackupConfigFName), "Fatal error");
return; /// Fatal error
}
else
{
LocalSettings.Save(); /// Save the settings to overwrite the wrong file
log.FatalFormat("Local settings: Could not load file {0}, successfully loaded {1}", ConfigFName, BackupConfigFName);
}
}
else
{
/// Loading local seetings from the regular config file was successful. Update the backup
File.Copy(LocalSettingsFileName, LocalSettingsBackupName, true);
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
///
/// User login
///
if (LocalSettings.IsUserLoginRequired && !string.IsNullOrEmpty(LocalSettings.UsersDBConnString))
{
try
{
UsersDB.ConnectionString = LocalSettings.UsersDBConnString;
UsersDB.DbType = DBType.MySql;
DialogResult dr = new SharedDatabase.Forms.LoginDlg().ShowDialog();
if (dr != DialogResult.OK) return;
}
catch (Exception exc)
{
log.ErrorFormat("Failed to connect to database of users: {0}", exc.Message);
}
}
IList<OrderInfo> orderInfos = null;
while (LocalSettings.Mode == Mode.WithDatabase)
{
try
{
ISession session = TracingDB.CreateSession(LocalSettings.TracingDBConnString);
orderInfos = session.QueryOver<OrderInfo>().List();
break;
}
catch (Exception exc)
{
log.FatalFormat("Failed to connect to production tracing database: {0}", exc.Message);
if (exc.InnerException != null)
{
log.FatalFormat("InnerException: {0}", exc.InnerException.Message);
}
MessageBox.Show(string.Format("Failed to connect to production tracing database:{0}{1}", Environment.NewLine, exc.Message));
if (new SettingsDlg(LocalSettings).ShowDialog() == DialogResult.OK)
{
LocalSettings.Save();
}
else
{
return;
}
}
}
try
{
MainWnd dlg = new MainWnd(orderInfos);
Application.Run(dlg);
}
catch (Exception e)
{
LogException(log, "Exception in Application.Run(MainWnd)", e);
MessageBox.Show("Program crashed:" +
Environment.NewLine + Environment.NewLine + e.Message +
((e.InnerException == null) ? string.Empty : (Environment.NewLine + e.InnerException.Message)) +
Environment.NewLine + e.StackTrace,
"Fatal error",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
static void MyHandler(object sender, UnhandledExceptionEventArgs args)
{
Exception e = args.ExceptionObject as Exception;
if (e == null) return;
LogException(log, "Unhandled exception", e);
MessageBox.Show("Program crashed:" +
Environment.NewLine + Environment.NewLine + e.Message +
((e.InnerException == null) ? string.Empty : (Environment.NewLine + e.InnerException.Message)) +
Environment.NewLine + e.StackTrace,
"Fatal error",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
static void LogException(ILog log, string description, Exception e)
{
log.FatalFormat("---------------( {0} )---------------", description);
log.FatalFormat("Message : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
log.Fatal("--------------------------------------");
}
}
}

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LabelPrinting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LabelPrinting")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("270db60d-5938-40be-b15c-e2bc3c7ddb86")]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.6.0")]
[assembly: AssemblyFileVersion("1.0.6.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LabelPrinting.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SNPrinting.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LabelPrinting.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,414 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LabelPrinting.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Strings() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LabelPrinting.Resources.Strings", typeof(Strings).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Are you sure?.
/// </summary>
internal static string Are_you_sure {
get {
return ResourceManager.GetString("Are_you_sure", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
internal static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close it please using &apos;Task manager&apos;..
/// </summary>
internal static string Close_it_please {
get {
return ResourceManager.GetString("Close_it_please", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to completed.
/// </summary>
internal static string completed {
get {
return ResourceManager.GetString("completed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connection string for production tracing database.
/// </summary>
internal static string Connection_string_tracing_DB {
get {
return ResourceManager.GetString("Connection_string_tracing_DB", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connection string for database of users.
/// </summary>
internal static string Connection_string_users_DB {
get {
return ResourceManager.GetString("Connection_string_users_DB", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Database.
/// </summary>
internal static string Database {
get {
return ResourceManager.GetString("Database", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Default settings are used..
/// </summary>
internal static string Default_settings_are_used {
get {
return ResourceManager.GetString("Default_settings_are_used", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Delay between labels.
/// </summary>
internal static string Delay_between_labes {
get {
return ResourceManager.GetString("Delay_between_labes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error.
/// </summary>
internal static string Error {
get {
return ResourceManager.GetString("Error", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to First S/N trail (9 digits).
/// </summary>
internal static string First_SN_trail_9_digits {
get {
return ResourceManager.GetString("First_SN_trail_9_digits", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Interrupt.
/// </summary>
internal static string Interrupt {
get {
return ResourceManager.GetString("Interrupt", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to interrupted.
/// </summary>
internal static string interrupted {
get {
return ResourceManager.GetString("interrupted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid.
/// </summary>
internal static string Invalid {
get {
return ResourceManager.GetString("Invalid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid first S/N trail.
/// </summary>
internal static string Invalid_first_SN_trail {
get {
return ResourceManager.GetString("Invalid_first_SN_trail", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid language.
/// </summary>
internal static string Invalid_language {
get {
return ResourceManager.GetString("Invalid_language", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid SAP number.
/// </summary>
internal static string Invalid_SAP_number {
get {
return ResourceManager.GetString("Invalid_SAP_number", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid separator.
/// </summary>
internal static string Invalid_separator {
get {
return ResourceManager.GetString("Invalid_separator", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid labels count.
/// </summary>
internal static string Invalid_SNs_count {
get {
return ResourceManager.GetString("Invalid_SNs_count", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Labels count.
/// </summary>
internal static string Labels_count {
get {
return ResourceManager.GetString("Labels_count", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Language, Sprache, Jazyk.
/// </summary>
internal static string Language_etc {
get {
return ResourceManager.GetString("Language_etc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to min..
/// </summary>
internal static string min {
get {
return ResourceManager.GetString("min", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Mode.
/// </summary>
internal static string Mode {
get {
return ResourceManager.GetString("Mode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Order.
/// </summary>
internal static string Order {
get {
return ResourceManager.GetString("Order", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Program &apos;{0}&apos; is running already..
/// </summary>
internal static string Program_0_is_running_already {
get {
return ResourceManager.GetString("Program_0_is_running_already", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Program is running for the 1st time on this PC..
/// </summary>
internal static string Program_is_running_for_the_1st_time_on_this_PC {
get {
return ResourceManager.GetString("Program_is_running_for_the_1st_time_on_this_PC", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Program restart is required.
/// </summary>
internal static string Program_restart_is_required {
get {
return ResourceManager.GetString("Program_restart_is_required", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SAP number (8 digits).
/// </summary>
internal static string SAP_number_8_digits {
get {
return ResourceManager.GetString("SAP_number_8_digits", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save.
/// </summary>
internal static string Save {
get {
return ResourceManager.GetString("Save", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Separator (3 characters).
/// </summary>
internal static string Separator_3_characters {
get {
return ResourceManager.GetString("Separator_3_characters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Serial number.
/// </summary>
internal static string Serial_number {
get {
return ResourceManager.GetString("Serial_number", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Settings.
/// </summary>
internal static string Settings {
get {
return ResourceManager.GetString("Settings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Standalone.
/// </summary>
internal static string Standalone {
get {
return ResourceManager.GetString("Standalone", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Start printing.
/// </summary>
internal static string Start_printing {
get {
return ResourceManager.GetString("Start_printing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User login is required.
/// </summary>
internal static string User_login_is_required {
get {
return ResourceManager.GetString("User_login_is_required", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning.
/// </summary>
internal static string Warning {
get {
return ResourceManager.GetString("Warning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to With a database.
/// </summary>
internal static string With_database {
get {
return ResourceManager.GetString("With_database", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} labels printed.
/// </summary>
internal static string x_labels_printed {
get {
return ResourceManager.GetString("x_labels_printed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You are skipping.
/// </summary>
internal static string You_are_skipping {
get {
return ResourceManager.GetString("You_are_skipping", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,234 @@
<?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>
<data name="Cancel" xml:space="preserve">
<value>Zrušit</value>
</data>
<data name="Close_it_please" xml:space="preserve">
<value>Zavřete ho prosím 'Správcem úloh' (Task manager).</value>
</data>
<data name="completed" xml:space="preserve">
<value>dokončeno</value>
</data>
<data name="Connection_string_tracing_DB" xml:space="preserve">
<value>Konfigurace databáze sledování výroby</value>
</data>
<data name="Connection_string_users_DB" xml:space="preserve">
<value>Konfigurace databáze uživatelů</value>
</data>
<data name="Database" xml:space="preserve">
<value>Databáze</value>
</data>
<data name="Default_settings_are_used" xml:space="preserve">
<value>Použijí sa výchozí nastavení</value>
</data>
<data name="Delay_between_labes" xml:space="preserve">
<value>Zpoždění mezi tiskemm štítků</value>
</data>
<data name="Error" xml:space="preserve">
<value>Chyba</value>
</data>
<data name="Interrupt" xml:space="preserve">
<value>Prerušit</value>
</data>
<data name="interrupted" xml:space="preserve">
<value>prerušeno</value>
</data>
<data name="Invalid_first_SN_trail" xml:space="preserve">
<value>Neplatný konec sériového čísla</value>
</data>
<data name="Invalid_SAP_number" xml:space="preserve">
<value>Neplatné číslo součástky (SAP číslo)</value>
</data>
<data name="Invalid_separator" xml:space="preserve">
<value>Neplatný oddělovač</value>
</data>
<data name="Invalid_SNs_count" xml:space="preserve">
<value>Neplatný počet štítků</value>
</data>
<data name="Language_etc" xml:space="preserve">
<value>Language, Sprache, Jazyk</value>
</data>
<data name="min." xml:space="preserve">
<value>min.</value>
</data>
<data name="Mode" xml:space="preserve">
<value>Režim činnosti</value>
</data>
<data name="Program_0_is_running_already" xml:space="preserve">
<value>Program '{0}' už běží.</value>
</data>
<data name="Program_is_running_for_the_1st_time_on_this_PC" xml:space="preserve">
<value>Program byl spuštěn na tomto počítači poprvé.</value>
</data>
<data name="Save" xml:space="preserve">
<value>Uložit</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Nastavení</value>
</data>
<data name="Standalone" xml:space="preserve">
<value>Samostatný</value>
</data>
<data name="Start_printing" xml:space="preserve">
<value>Spustit tisk</value>
</data>
<data name="User_login_is_required" xml:space="preserve">
<value>Vyžaduje se prihlášení užívatele</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Upozornení</value>
</data>
<data name="With_database" xml:space="preserve">
<value>S databází</value>
</data>
<data name="You_are_skipping" xml:space="preserve">
<value>Vynechávate</value>
</data>
<data name="First_SN_trail_9_digits" xml:space="preserve">
<value>První konec sériového čísla (9 číslic)</value>
</data>
<data name="SAP_number_8_digits" xml:space="preserve">
<value>SAP číslo (8 číslic)</value>
</data>
<data name="Separator_3_characters" xml:space="preserve">
<value>Oddělovač (3 znaky)</value>
</data>
<data name="Labels_count" xml:space="preserve">
<value>Počet štítků</value>
</data>
<data name="Program_restart_is_required" xml:space="preserve">
<value>Je potřebný restart programu</value>
</data>
<data name="x_labels_printed" xml:space="preserve">
<value>Bylo vytištěných {0} štítků</value>
</data>
<data name="Invalid" xml:space="preserve">
<value>Neplatný</value>
</data>
<data name="Invalid_language" xml:space="preserve">
<value>Neplatný jazyk</value>
</data>
<data name="Order" xml:space="preserve">
<value>Objednávka</value>
</data>
<data name="Serial_number" xml:space="preserve">
<value>Sériové číslo</value>
</data>
</root>

View File

@ -0,0 +1,237 @@
<?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>
<data name="Close_it_please" xml:space="preserve">
<value>Close it please using 'Task manager'.</value>
</data>
<data name="Default_settings_are_used" xml:space="preserve">
<value>Default settings are used.</value>
</data>
<data name="Error" xml:space="preserve">
<value>Error</value>
</data>
<data name="Interrupt" xml:space="preserve">
<value>Interrupt</value>
</data>
<data name="Invalid_first_SN_trail" xml:space="preserve">
<value>Invalid first S/N trail</value>
</data>
<data name="Invalid_SAP_number" xml:space="preserve">
<value>Invalid SAP number</value>
</data>
<data name="Invalid_separator" xml:space="preserve">
<value>Invalid separator</value>
</data>
<data name="Invalid_SNs_count" xml:space="preserve">
<value>Invalid labels count</value>
</data>
<data name="Program_0_is_running_already" xml:space="preserve">
<value>Program '{0}' is running already.</value>
</data>
<data name="Program_is_running_for_the_1st_time_on_this_PC" xml:space="preserve">
<value>Program is running for the 1st time on this PC.</value>
</data>
<data name="Start_printing" xml:space="preserve">
<value>Start printing</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="completed" xml:space="preserve">
<value>completed</value>
</data>
<data name="interrupted" xml:space="preserve">
<value>interrupted</value>
</data>
<data name="Are_you_sure" xml:space="preserve">
<value>Are you sure?</value>
</data>
<data name="min" xml:space="preserve">
<value>min.</value>
</data>
<data name="You_are_skipping" xml:space="preserve">
<value>You are skipping</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Connection_string_tracing_DB" xml:space="preserve">
<value>Connection string for production tracing database</value>
</data>
<data name="Connection_string_users_DB" xml:space="preserve">
<value>Connection string for database of users</value>
</data>
<data name="Database" xml:space="preserve">
<value>Database</value>
</data>
<data name="Delay_between_labes" xml:space="preserve">
<value>Delay between labels</value>
</data>
<data name="Language_etc" xml:space="preserve">
<value>Language, Sprache, Jazyk</value>
</data>
<data name="Mode" xml:space="preserve">
<value>Mode</value>
</data>
<data name="Save" xml:space="preserve">
<value>Save</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Settings</value>
</data>
<data name="Standalone" xml:space="preserve">
<value>Standalone</value>
</data>
<data name="User_login_is_required" xml:space="preserve">
<value>User login is required</value>
</data>
<data name="With_database" xml:space="preserve">
<value>With a database</value>
</data>
<data name="First_SN_trail_9_digits" xml:space="preserve">
<value>First S/N trail (9 digits)</value>
</data>
<data name="SAP_number_8_digits" xml:space="preserve">
<value>SAP number (8 digits)</value>
</data>
<data name="Separator_3_characters" xml:space="preserve">
<value>Separator (3 characters)</value>
</data>
<data name="Labels_count" xml:space="preserve">
<value>Labels count</value>
</data>
<data name="Program_restart_is_required" xml:space="preserve">
<value>Program restart is required</value>
</data>
<data name="x_labels_printed" xml:space="preserve">
<value>{0} labels printed</value>
</data>
<data name="Invalid" xml:space="preserve">
<value>Invalid</value>
</data>
<data name="Invalid_language" xml:space="preserve">
<value>Invalid language</value>
</data>
<data name="Order" xml:space="preserve">
<value>Order</value>
</data>
<data name="Serial_number" xml:space="preserve">
<value>Serial number</value>
</data>
</root>

View File

@ -0,0 +1,234 @@
<?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>
<data name="Cancel" xml:space="preserve">
<value>Zrušiť</value>
</data>
<data name="Close_it_please" xml:space="preserve">
<value>Zavrite ho prosím 'Správcom úloh' (Task manager).</value>
</data>
<data name="completed" xml:space="preserve">
<value>dokončené</value>
</data>
<data name="Connection_string_tracing_DB" xml:space="preserve">
<value>Konfigurácia databáze sledovania výroby</value>
</data>
<data name="Connection_string_users_DB" xml:space="preserve">
<value>Konfigurácia databáze užívateľov</value>
</data>
<data name="Database" xml:space="preserve">
<value>Databáza</value>
</data>
<data name="Default_settings_are_used" xml:space="preserve">
<value>Použijú sa základné nastavenia</value>
</data>
<data name="Delay_between_labes" xml:space="preserve">
<value>Oneskorenie medzi tlačením štítkov</value>
</data>
<data name="Error" xml:space="preserve">
<value>Chyba</value>
</data>
<data name="Interrupt" xml:space="preserve">
<value>Prerušiť</value>
</data>
<data name="interrupted" xml:space="preserve">
<value>prerušené</value>
</data>
<data name="Invalid_first_SN_trail" xml:space="preserve">
<value>Neplatný chvost sériového čísla</value>
</data>
<data name="Invalid_SAP_number" xml:space="preserve">
<value>Neplatné číslo súčiastky (SAP číslo)</value>
</data>
<data name="Invalid_separator" xml:space="preserve">
<value>Neplatný oddelovač</value>
</data>
<data name="Invalid_SNs_count" xml:space="preserve">
<value>Neplatný počet štítkov</value>
</data>
<data name="Language_etc" xml:space="preserve">
<value>Language, Sprache, Jazyk</value>
</data>
<data name="min." xml:space="preserve">
<value>min.</value>
</data>
<data name="Mode" xml:space="preserve">
<value>Režim činnosti</value>
</data>
<data name="Program_0_is_running_already" xml:space="preserve">
<value>Program '{0}' už beží.</value>
</data>
<data name="Program_is_running_for_the_1st_time_on_this_PC" xml:space="preserve">
<value>Program bol spustený na tomto počítači prvý krát.</value>
</data>
<data name="Save" xml:space="preserve">
<value>Uložiť</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Nastavenia</value>
</data>
<data name="Standalone" xml:space="preserve">
<value>Samostatný</value>
</data>
<data name="Start_printing" xml:space="preserve">
<value>Začať tlačiť</value>
</data>
<data name="User_login_is_required" xml:space="preserve">
<value>Vyžaduje sa prihlásenie používateľa</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Upozornenie</value>
</data>
<data name="With_database" xml:space="preserve">
<value>S databázou</value>
</data>
<data name="You_are_skipping" xml:space="preserve">
<value>Vynechávate</value>
</data>
<data name="First_SN_trail_9_digits" xml:space="preserve">
<value>Prvý chvost sériového čísla (9 číslic)</value>
</data>
<data name="SAP_number_8_digits" xml:space="preserve">
<value>SAP číslo (8 číslic)</value>
</data>
<data name="Separator_3_characters" xml:space="preserve">
<value>Oddeľovač (3 znaky)</value>
</data>
<data name="Labels_count" xml:space="preserve">
<value>Počet štítkov</value>
</data>
<data name="Program_restart_is_required" xml:space="preserve">
<value>Je potrebný reštart programu</value>
</data>
<data name="x_labels_printed" xml:space="preserve">
<value>Bolo vytlačených {0} štítkov</value>
</data>
<data name="Invalid" xml:space="preserve">
<value>Neplatný</value>
</data>
<data name="Invalid_language" xml:space="preserve">
<value>Neplatný jazyk</value>
</data>
<data name="Order" xml:space="preserve">
<value>Objednávka</value>
</data>
<data name="Serial_number" xml:space="preserve">
<value>Sériové číslo</value>
</data>
</root>

View File

@ -0,0 +1,23 @@
<log4net>
<!-- Program log appenders -->
<appender name="LabelPrintingLog" type="log4net.Appender.RollingFileAppender">
<file value="..\Logs\LabelPrintingLog.txt" />
<appendToFile value="true" />
<rollingMode value="Date" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %logger - %message%newline" />
</layout>
</appender>
<!-- Set root logger -->
<root>
<level value="WARN" />
</root>
<!-- Set program loggers -->
<logger name="LabelPrinting"> <appender-ref ref="LabelPrintingLog" /> <level value="WARN" /> </logger>
<!-- Set program logging levels -->
<logger name="LabelPrinting.MainWnd"> <level value="INFO" /> </logger>
</log4net>

283
LabelPrinting/SettingsDlg.Designer.cs generated Normal file
View File

@ -0,0 +1,283 @@
namespace LabelPrinting
{
partial class SettingsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.modeGroupBox = new System.Windows.Forms.GroupBox();
this.tbfLabelPrinterRadioButton = new System.Windows.Forms.RadioButton();
this.standaloneRadioButton = new System.Windows.Forms.RadioButton();
this.withDBRadioButton = new System.Windows.Forms.RadioButton();
this.commonGroupBox = new System.Windows.Forms.GroupBox();
this.labelPrinterConfigButton = new System.Windows.Forms.Button();
this.msLabel = new System.Windows.Forms.Label();
this.delayTextBox = new System.Windows.Forms.TextBox();
this.delayLabel = new System.Windows.Forms.Label();
this.loginRequiredCheckBox = new System.Windows.Forms.CheckBox();
this.languageComboBox = new System.Windows.Forms.ComboBox();
this.languageLabel = new System.Windows.Forms.Label();
this.connStrForTracingGroupBox = new System.Windows.Forms.GroupBox();
this.tracingDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.connStrForUsersGroupBox = new System.Windows.Forms.GroupBox();
this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.saveButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.modeGroupBox.SuspendLayout();
this.commonGroupBox.SuspendLayout();
this.connStrForTracingGroupBox.SuspendLayout();
this.connStrForUsersGroupBox.SuspendLayout();
this.SuspendLayout();
//
// modeGroupBox
//
this.modeGroupBox.Controls.Add(this.tbfLabelPrinterRadioButton);
this.modeGroupBox.Controls.Add(this.standaloneRadioButton);
this.modeGroupBox.Controls.Add(this.withDBRadioButton);
this.modeGroupBox.Location = new System.Drawing.Point(12, 12);
this.modeGroupBox.Name = "modeGroupBox";
this.modeGroupBox.Size = new System.Drawing.Size(197, 105);
this.modeGroupBox.TabIndex = 15;
this.modeGroupBox.TabStop = false;
this.modeGroupBox.Text = "Mode";
//
// tbfLabelPrinterRadioButton
//
this.tbfLabelPrinterRadioButton.AutoSize = true;
this.tbfLabelPrinterRadioButton.Location = new System.Drawing.Point(19, 23);
this.tbfLabelPrinterRadioButton.Name = "tbfLabelPrinterRadioButton";
this.tbfLabelPrinterRadioButton.Size = new System.Drawing.Size(156, 17);
this.tbfLabelPrinterRadioButton.TabIndex = 0;
this.tbfLabelPrinterRadioButton.TabStop = true;
this.tbfLabelPrinterRadioButton.Text = "TBF compatible label printer";
this.tbfLabelPrinterRadioButton.UseVisualStyleBackColor = true;
//
// standaloneRadioButton
//
this.standaloneRadioButton.AutoSize = true;
this.standaloneRadioButton.Location = new System.Drawing.Point(18, 46);
this.standaloneRadioButton.Name = "standaloneRadioButton";
this.standaloneRadioButton.Size = new System.Drawing.Size(143, 17);
this.standaloneRadioButton.TabIndex = 1;
this.standaloneRadioButton.TabStop = true;
this.standaloneRadioButton.Text = "20 char s/n - Standalone";
this.standaloneRadioButton.UseVisualStyleBackColor = true;
//
// withDBRadioButton
//
this.withDBRadioButton.AutoSize = true;
this.withDBRadioButton.Location = new System.Drawing.Point(18, 69);
this.withDBRadioButton.Name = "withDBRadioButton";
this.withDBRadioButton.Size = new System.Drawing.Size(158, 17);
this.withDBRadioButton.TabIndex = 2;
this.withDBRadioButton.TabStop = true;
this.withDBRadioButton.Text = "20 char s/n - With database";
this.withDBRadioButton.UseVisualStyleBackColor = true;
//
// commonGroupBox
//
this.commonGroupBox.Controls.Add(this.labelPrinterConfigButton);
this.commonGroupBox.Controls.Add(this.msLabel);
this.commonGroupBox.Controls.Add(this.delayTextBox);
this.commonGroupBox.Controls.Add(this.delayLabel);
this.commonGroupBox.Controls.Add(this.loginRequiredCheckBox);
this.commonGroupBox.Controls.Add(this.languageComboBox);
this.commonGroupBox.Controls.Add(this.languageLabel);
this.commonGroupBox.Location = new System.Drawing.Point(222, 12);
this.commonGroupBox.Name = "commonGroupBox";
this.commonGroupBox.Size = new System.Drawing.Size(316, 105);
this.commonGroupBox.TabIndex = 16;
this.commonGroupBox.TabStop = false;
//
// labelPrinterConfigButton
//
this.labelPrinterConfigButton.Location = new System.Drawing.Point(198, 73);
this.labelPrinterConfigButton.Name = "labelPrinterConfigButton";
this.labelPrinterConfigButton.Size = new System.Drawing.Size(93, 23);
this.labelPrinterConfigButton.TabIndex = 6;
this.labelPrinterConfigButton.Text = "TBF label config";
this.labelPrinterConfigButton.UseVisualStyleBackColor = true;
this.labelPrinterConfigButton.Click += new System.EventHandler(this.labelPrinterConfigButton_Click);
//
// msLabel
//
this.msLabel.AutoSize = true;
this.msLabel.Location = new System.Drawing.Point(262, 51);
this.msLabel.Name = "msLabel";
this.msLabel.Size = new System.Drawing.Size(20, 13);
this.msLabel.TabIndex = 5;
this.msLabel.Text = "ms";
//
// delayTextBox
//
this.delayTextBox.Location = new System.Drawing.Point(198, 46);
this.delayTextBox.Name = "delayTextBox";
this.delayTextBox.Size = new System.Drawing.Size(52, 20);
this.delayTextBox.TabIndex = 4;
//
// delayLabel
//
this.delayLabel.AutoSize = true;
this.delayLabel.Location = new System.Drawing.Point(19, 51);
this.delayLabel.Name = "delayLabel";
this.delayLabel.Size = new System.Drawing.Size(108, 13);
this.delayLabel.TabIndex = 3;
this.delayLabel.Text = "Delay between labels";
//
// loginRequiredCheckBox
//
this.loginRequiredCheckBox.AutoSize = true;
this.loginRequiredCheckBox.Location = new System.Drawing.Point(22, 79);
this.loginRequiredCheckBox.Name = "loginRequiredCheckBox";
this.loginRequiredCheckBox.Size = new System.Drawing.Size(114, 17);
this.loginRequiredCheckBox.TabIndex = 2;
this.loginRequiredCheckBox.Text = "User login required";
this.loginRequiredCheckBox.UseVisualStyleBackColor = true;
//
// languageComboBox
//
this.languageComboBox.FormattingEnabled = true;
this.languageComboBox.Location = new System.Drawing.Point(198, 17);
this.languageComboBox.Name = "languageComboBox";
this.languageComboBox.Size = new System.Drawing.Size(93, 21);
this.languageComboBox.TabIndex = 1;
//
// languageLabel
//
this.languageLabel.AutoSize = true;
this.languageLabel.Location = new System.Drawing.Point(19, 20);
this.languageLabel.Name = "languageLabel";
this.languageLabel.Size = new System.Drawing.Size(134, 13);
this.languageLabel.TabIndex = 0;
this.languageLabel.Text = "Language, Sprache, Jazyk";
//
// connStrForTracingGroupBox
//
this.connStrForTracingGroupBox.Controls.Add(this.tracingDBConnStringTextBox);
this.connStrForTracingGroupBox.Location = new System.Drawing.Point(12, 127);
this.connStrForTracingGroupBox.Name = "connStrForTracingGroupBox";
this.connStrForTracingGroupBox.Size = new System.Drawing.Size(709, 50);
this.connStrForTracingGroupBox.TabIndex = 17;
this.connStrForTracingGroupBox.TabStop = false;
this.connStrForTracingGroupBox.Text = "Connection string for production tracing records";
//
// tracingDBConnStringTextBox
//
this.tracingDBConnStringTextBox.Location = new System.Drawing.Point(19, 18);
this.tracingDBConnStringTextBox.Name = "tracingDBConnStringTextBox";
this.tracingDBConnStringTextBox.Size = new System.Drawing.Size(672, 20);
this.tracingDBConnStringTextBox.TabIndex = 0;
//
// connStrForUsersGroupBox
//
this.connStrForUsersGroupBox.Controls.Add(this.usersDBConnStringTextBox);
this.connStrForUsersGroupBox.Location = new System.Drawing.Point(12, 186);
this.connStrForUsersGroupBox.Name = "connStrForUsersGroupBox";
this.connStrForUsersGroupBox.Size = new System.Drawing.Size(709, 50);
this.connStrForUsersGroupBox.TabIndex = 18;
this.connStrForUsersGroupBox.TabStop = false;
this.connStrForUsersGroupBox.Text = "Connection string for central DB of users";
//
// usersDBConnStringTextBox
//
this.usersDBConnStringTextBox.Location = new System.Drawing.Point(19, 18);
this.usersDBConnStringTextBox.Name = "usersDBConnStringTextBox";
this.usersDBConnStringTextBox.Size = new System.Drawing.Size(672, 20);
this.usersDBConnStringTextBox.TabIndex = 0;
//
// saveButton
//
this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.saveButton.Location = new System.Drawing.Point(559, 18);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(74, 47);
this.saveButton.TabIndex = 19;
this.saveButton.Text = "Save";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.Location = new System.Drawing.Point(649, 18);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(71, 47);
this.cancelButton.TabIndex = 20;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// SettingsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(737, 250);
this.ControlBox = false;
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.connStrForUsersGroupBox);
this.Controls.Add(this.connStrForTracingGroupBox);
this.Controls.Add(this.commonGroupBox);
this.Controls.Add(this.modeGroupBox);
this.Name = "SettingsDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "`";
this.Load += new System.EventHandler(this.SettingsDlg_Load);
this.modeGroupBox.ResumeLayout(false);
this.modeGroupBox.PerformLayout();
this.commonGroupBox.ResumeLayout(false);
this.commonGroupBox.PerformLayout();
this.connStrForTracingGroupBox.ResumeLayout(false);
this.connStrForTracingGroupBox.PerformLayout();
this.connStrForUsersGroupBox.ResumeLayout(false);
this.connStrForUsersGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox modeGroupBox;
private System.Windows.Forms.RadioButton standaloneRadioButton;
private System.Windows.Forms.RadioButton withDBRadioButton;
private System.Windows.Forms.GroupBox commonGroupBox;
private System.Windows.Forms.ComboBox languageComboBox;
private System.Windows.Forms.Label languageLabel;
private System.Windows.Forms.Label msLabel;
private System.Windows.Forms.TextBox delayTextBox;
private System.Windows.Forms.Label delayLabel;
private System.Windows.Forms.CheckBox loginRequiredCheckBox;
private System.Windows.Forms.GroupBox connStrForTracingGroupBox;
private System.Windows.Forms.TextBox tracingDBConnStringTextBox;
private System.Windows.Forms.GroupBox connStrForUsersGroupBox;
private System.Windows.Forms.TextBox usersDBConnStringTextBox;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.RadioButton tbfLabelPrinterRadioButton;
private System.Windows.Forms.Button labelPrinterConfigButton;
}
}

View File

@ -0,0 +1,170 @@
///
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Common;
using TBF.Rig.Output.Printers.Label;
using LabelPrinting.Resources;
namespace LabelPrinting
{
public partial class SettingsDlg : Form
{
private readonly LocalSettings ls;
private readonly Factory factory;
public SettingsDlg()
{
InitializeComponent();
factory = new Factory();
}
public SettingsDlg(LocalSettings localSettings)
: this()
{
this.ls = localSettings;
}
void Localize()
{
Text = Strings.Settings;
modeGroupBox.Text = Strings.Mode;
standaloneRadioButton.Text = "20 char s/n - " + Strings.Standalone;
withDBRadioButton.Text = "20 char s/n - " + Strings.With_database;
languageLabel.Text = Strings.Language_etc;
delayLabel.Text = Strings.Delay_between_labes;
loginRequiredCheckBox.Text = Strings.User_login_is_required;
saveButton.Text = Strings.Save;
cancelButton.Text = Strings.Cancel;
connStrForTracingGroupBox.Text = Strings.Connection_string_tracing_DB;
connStrForUsersGroupBox.Text = Strings.Connection_string_users_DB;
}
private void SettingsDlg_Load(object sender, EventArgs e)
{
Localize();
languageComboBox.Items.Add("CS");
languageComboBox.Items.Add("DE");
languageComboBox.Items.Add("EN");
languageComboBox.Items.Add("SK");
languageComboBox.Items.Add("ZH_CN");
languageComboBox.Text = ls.Language;
if (ls == null) return;
tbfLabelPrinterRadioButton.Checked = (ls.Mode == Mode.TbfLabelPrinter);
standaloneRadioButton.Checked = (ls.Mode == Mode.Standalone);
withDBRadioButton.Checked = (ls.Mode == Mode.WithDatabase);
loginRequiredCheckBox.Checked = ls.IsUserLoginRequired;
delayTextBox.Text = ls.DelayBetweenLabels.ToString();
tracingDBConnStringTextBox.Text = ls.TracingDBConnString;
usersDBConnStringTextBox.Text = ls.UsersDBConnString;
}
/// <summary>
/// Verifies UI content
/// </summary>
/// <returns>None-empty string (message) when invalid</returns>
string IsUIContentValid()
{
if (!languageComboBox.Items.Contains(languageComboBox.Text))
{
return Strings.Invalid_language;
}
int idummy;
if (!int.TryParse(delayTextBox.Text, out idummy) || idummy < 0 || idummy > 5000)
{
return string.Format("{0} {1}", Strings.Invalid, delayLabel.Text);
}
return null;
}
/// <summary>
/// Updates settings, checks for differences compared to previous setrtings
/// </summary>
/// <returns>true when settings are different</returns>
bool UpdateSettings()
{
if (ls == null) return false;
bool isDifferent = false;
Mode mode = tbfLabelPrinterRadioButton.Checked ? Mode.TbfLabelPrinter : standaloneRadioButton.Checked ? Mode.Standalone : Mode.WithDatabase;
if (ls.Mode != mode)
{
ls.Mode = mode;
isDifferent = true;
}
if (ls.Language != languageComboBox.Text)
{
ls.Language = languageComboBox.Text;
isDifferent = true;
}
if (ls.IsUserLoginRequired != loginRequiredCheckBox.Checked)
{
ls.IsUserLoginRequired = loginRequiredCheckBox.Checked;
isDifferent = true;
}
if (ls.TracingDBConnString != tracingDBConnStringTextBox.Text)
{
ls.TracingDBConnString = tracingDBConnStringTextBox.Text;
isDifferent = true;
}
if (ls.UsersDBConnString != usersDBConnStringTextBox.Text)
{
ls.UsersDBConnString = usersDBConnStringTextBox.Text;
isDifferent = true;
}
return isDifferent;
}
private void saveButton_Click(object sender, EventArgs e)
{
string message = IsUIContentValid();
if (string.IsNullOrEmpty(message))
{
UpdateSettings();
DialogResult = DialogResult.OK;
Close();
}
else
{
MessageBox.Show(message);
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void labelPrinterConfigButton_Click(object sender, EventArgs e)
{
var cmpntEntity = Config.Entities.Component.CreateFromCfg("Printer", factory.ClassName, string.Empty, 1,
DebugMode.Normal, LogLevel.Off, ls.LabelPrinterCfg);
var cfgForm = new TBF.UI.Bench.Components.ComponentParametersDlg(this);
cfgForm.ComponentCfgCtrl = new PrinterCfgCtrl();
cfgForm.ComponentCfgCtrl.Config = factory.CmpntCfgFromCmpntEntity(cmpntEntity);
cfgForm.UnlockAfterStart = true;
if (cfgForm.ShowDialog() == DialogResult.OK)
{
ls.LabelPrinterCfg = cfgForm.ComponentCfgCtrl.Config.CreateDbEntity().Parameters;
}
}
}
}

View File

@ -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>

View File

@ -28,7 +28,6 @@ namespace Results.Output.Printers.Label
readonly Font font;
/// Data to print
Results.Entities.Batch batch;
LabelPrinterCfg cfg;
Results.Entities.WaterMeter wm;
@ -36,11 +35,10 @@ namespace Results.Output.Printers.Label
/// Constructor
/// </summary>
/// <param name="textToPrint">Text to be printed</param>
public LabelPrintDocument(Results.Entities.Batch batch, LabelPrinterCfg cfg, Results.Entities.WaterMeter wm, string documentName)
public LabelPrintDocument(LabelPrinterCfg cfg, Results.Entities.WaterMeter wm, string documentName)
{
DocumentName = documentName;
this.batch = batch;
this.cfg = cfg;
this.wm = wm;
this.itemsToPrint = WMeterRsltItemSpec.FromStrArray(cfg.ItemsToPrint);

14
TBF.sln
View File

@ -98,6 +98,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProductionTracing", "Produc
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S640TestApp", "S640TestApp\S640TestApp.csproj", "{EE097B5A-8162-45B1-9643-4969FC3A8921}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LabelPrinting", "LabelPrinting\LabelPrinting.csproj", "{E4531D13-317C-4D9F-809F-5533B5C3C8BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -432,6 +434,18 @@ Global
{EE097B5A-8162-45B1-9643-4969FC3A8921}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{EE097B5A-8162-45B1-9643-4969FC3A8921}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EE097B5A-8162-45B1-9643-4969FC3A8921}.Release|x86.ActiveCfg = Release|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Debug|x86.ActiveCfg = Debug|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Debug|x86.Build.0 = Debug|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Release|Any CPU.Build.0 = Release|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Release|x86.ActiveCfg = Release|Any CPU
{E4531D13-317C-4D9F-809F-5533B5C3C8BF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -148,7 +148,7 @@ namespace TBF.Rig.Output.Printers.Label
{
if (wm != null && !wm.Disabled && wm.PrintLabel && (!printerCfg.GoodOnly || wm.Passed))
{
PrintResults(batch, wm, string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition));
PrintResults(wm, string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition));
}
}
@ -176,7 +176,7 @@ namespace TBF.Rig.Output.Printers.Label
}
void PrintResults(Results.Entities.Batch batch, Results.Entities.WaterMeter wm, string documentName)
public void PrintResults(Results.Entities.WaterMeter wm, string documentName)
{
LabelPrinterCfg cfg = new LabelPrinterCfg
{
@ -199,8 +199,8 @@ namespace TBF.Rig.Output.Printers.Label
for (int i = 1; i <= printerCfg.NrOfCopies; i++)
{
string docNameEx = string.Format(((printerCfg.NrOfCopies == 1) ? "{0}" : "{0}_{1}"), documentName, i);
var pd = new Results.Output.Printers.Label.LabelPrintDocument(batch, cfg, wm, docNameEx);
string docNameEx = string.Format((printerCfg.NrOfCopies == 1) ? "{0}" : "{0}_{1}", documentName, i);
var pd = new LabelPrintDocument(cfg, wm, docNameEx);
if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName;
pd.Print();
}

View File

@ -26,6 +26,8 @@ rmdir /s /q GenericTest\bin
rmdir /s /q GenericTest\obj
rmdir /s /q GraphLib\bin
rmdir /s /q GraphLib\obj
rmdir /s /q LabelPrinting\bin
rmdir /s /q LabelPrinting\obj
rmdir /s /q MergeResultsDBs\bin
rmdir /s /q MergeResultsDBs\obj
rmdir /s /q OrderManagement\bin\Debug