-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 973faa6
Showing
49 changed files
with
8,495 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# Roslyn cache directories | ||
*.ide/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
#NUNIT | ||
*.VisualState.xml | ||
TestResult.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
*_i.c | ||
*_p.c | ||
*_i.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# TFS 2012 Local Workspace | ||
$tf/ | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# JustCode is a .NET coding addin-in | ||
.JustCode | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
_NCrunch_* | ||
.*crunch*.local.xml | ||
|
||
# MightyMoose | ||
*.mm.* | ||
AutoTest.Net/ | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
## TODO: Comment the next line if you want to checkin your | ||
## web deploy settings but do note that will include unencrypted | ||
## passwords | ||
*.pubxml | ||
|
||
# NuGet Packages | ||
packages/* | ||
*.nupkg | ||
## TODO: If the tool you use requires repositories.config | ||
## uncomment the next line | ||
#!packages/repositories.config | ||
|
||
# Enable "build/" folder in the NuGet Packages folder since | ||
# NuGet packages use it for MSBuild targets. | ||
# This line needs to be after the ignore of the build folder | ||
# (and the packages folder if the line above has been uncommented) | ||
!packages/build/ | ||
|
||
# Windows Azure Build Output | ||
csx/ | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
sql/ | ||
*.Cache | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.pfx | ||
*.publishsettings | ||
node_modules/ | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
|
||
# Business Intelligence projects | ||
*.rdl.data | ||
*.bim.layout | ||
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual C# Express 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XiconfLabelPrinter", "XiconfLabelPrinter\XiconfLabelPrinter.csproj", "{61785524-5B33-42EF-B242-38357667D9C0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{61785524-5B33-42EF-B242-38357667D9C0}.Debug|x86.ActiveCfg = Debug|x86 | ||
{61785524-5B33-42EF-B242-38357667D9C0}.Debug|x86.Build.0 = Debug|x86 | ||
{61785524-5B33-42EF-B242-38357667D9C0}.Release|x86.ActiveCfg = Release|x86 | ||
{61785524-5B33-42EF-B242-38357667D9C0}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Copyright (c) 2014, Łukasz Walukiewicz <[email protected]>. Some Rights Reserved. | ||
// Licensed under CC BY-NC-SA 4.0 <http://creativecommons.org/licenses/by-nc-sa/4.0/>. | ||
// Part of the XiconfLabelPrinter project <http://lukasz.walukiewicz.eu/p/XiconfLabelPrinter> | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
using Seagull.BarTender.Print; | ||
|
||
namespace MSYS.Xiconf.LabelPrinter | ||
{ | ||
abstract public class APrintJob : IPrintJob | ||
{ | ||
abstract public string LabelFormatType { get; } | ||
|
||
abstract public string AdditionalInfo { get; } | ||
|
||
abstract protected void SetSubStrings(LabelFormat labelFormat); | ||
|
||
private static int JOB_COUNTER = 1; | ||
|
||
private int jobId = 0; | ||
|
||
public string PrinterName { get; set; } | ||
|
||
public int LabelQuantity { get; set; } | ||
|
||
public int SeriesNo { get; set; } | ||
|
||
public int SeriesGroup { get; set; } | ||
|
||
public string SeriesId | ||
{ | ||
get | ||
{ | ||
return SeriesNo == 0 ? "0" : Convert.ToChar(64 + SeriesGroup).ToString() + SeriesNo; | ||
} | ||
} | ||
|
||
public string PrintJobName | ||
{ | ||
get | ||
{ | ||
if (jobId == 0) | ||
{ | ||
jobId = JOB_COUNTER++; | ||
} | ||
|
||
return LabelFormatType + "-" + jobId; | ||
} | ||
} | ||
|
||
public void Print(LabelFormatDocument labelFormat) | ||
{ | ||
SetPrintSetup(labelFormat); | ||
SetSubStrings(labelFormat); | ||
|
||
Messages messages; | ||
|
||
var result = labelFormat.Print(PrintJobName, out messages); | ||
|
||
if (result == Result.Success) | ||
{ | ||
return; | ||
} | ||
|
||
if (result == Result.Timeout) | ||
{ | ||
throw new PrintException("Upłynął czas oczekiwania na odpowiedź."); | ||
} | ||
|
||
HandleFailure(messages); | ||
} | ||
|
||
protected virtual void SetPrintSetup(LabelFormatDocument labelFormat) | ||
{ | ||
labelFormat.PrintSetup.PrinterName = PrinterName; | ||
labelFormat.PrintSetup.IdenticalCopiesOfLabel = LabelQuantity; | ||
} | ||
|
||
private void HandleFailure(Messages messages) | ||
{ | ||
var errorList = messages.Where(message => message.Severity == MessageSeverity.Error); | ||
var errorCount = errorList.Count(); | ||
|
||
if (errorCount == 0) | ||
{ | ||
throw new PrintException(); | ||
} | ||
|
||
var errorMessage = new StringBuilder(); | ||
var i = 0; | ||
|
||
foreach (var error in errorList) | ||
{ | ||
if (++i == errorCount) | ||
{ | ||
errorMessage.Append(error.Text); | ||
} | ||
else | ||
{ | ||
errorMessage.AppendLine(error.Text); | ||
} | ||
} | ||
|
||
throw new PrintException(errorMessage.ToString()); | ||
} | ||
} | ||
} |
Oops, something went wrong.