├── .gitignore ├── .nuget ├── NuGet.Config ├── NuGet.exe ├── NuGet.targets └── packages.config ├── BarcodePrinter.sln ├── BarcodePrinter ├── App.config ├── App.xaml ├── App.xaml.cs ├── AppBootstrapper.cs ├── BarcodeLabel.cs ├── BarcodePrinter.csproj ├── BarcodePrinter.nuspec ├── ClassDiagram1.cd ├── Logging │ ├── DebugLogger.cs │ └── NLogLogger.cs ├── NLog.config ├── NLog.xsd ├── PhysionBarcodePrinter │ └── app-1.0.0.0 │ │ ├── BarcodeLib.dll │ │ ├── BarcodePrinter.exe │ │ ├── Caliburn.Micro.Platform.dll │ │ ├── Caliburn.Micro.dll │ │ ├── Com.SharpZebra.dll │ │ ├── DeltaCompressionDotNet.MsDelta.dll │ │ ├── DeltaCompressionDotNet.PatchApi.dll │ │ ├── DeltaCompressionDotNet.dll │ │ ├── ICSharpCode.SharpZipLib.dll │ │ ├── Microsoft.Web.XmlTransform.dll │ │ ├── Mono.Cecil.Mdb.dll │ │ ├── Mono.Cecil.Pdb.dll │ │ ├── Mono.Cecil.Rocks.dll │ │ ├── Mono.Cecil.dll │ │ ├── NLog.dll │ │ ├── Newtonsoft.Json.dll │ │ ├── NuGet.Core.dll │ │ ├── QuantityTypes.dll │ │ ├── Splat.dll │ │ ├── Squirrel.dll │ │ └── System.Windows.Interactivity.dll ├── Printing │ ├── ApplicationPrinter.cs │ └── PrintCompletion.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── app.manifest ├── Resources │ └── obc_icon.ico ├── ViewModels │ └── MainViewModel.cs ├── Views │ ├── MainView.xaml │ └── MainView.xaml.cs ├── lib │ └── net45 │ │ ├── BarcodeLib.dll │ │ └── Com.SharpZebra.dll ├── obc_icon.ico ├── packages.config ├── releasify.ps1 └── test.obc ├── LICENSE ├── README.md ├── SharpZebra README.txt ├── epl2-pm-en.pdf └── zpl-zbi2-pm-en.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | *.publishproj 131 | 132 | # NuGet Packages Directory 133 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 134 | #packages/ 135 | 136 | # Windows Azure Build Output 137 | csx 138 | *.build.csdef 139 | 140 | # Windows Store app package directory 141 | AppPackages/ 142 | 143 | # Others 144 | sql/ 145 | *.Cache 146 | ClientBin/ 147 | [Ss]tyle[Cc]op.* 148 | ~$* 149 | *~ 150 | *.dbmdl 151 | *.[Pp]ublish.xml 152 | *.pfx 153 | *.publishsettings 154 | 155 | # RIA/Silverlight projects 156 | Generated_Code/ 157 | 158 | # Backup & report files from converting an old project file to a newer 159 | # Visual Studio version. Backup files are not needed, because we have git ;-) 160 | _UpgradeReport_Files/ 161 | Backup*/ 162 | UpgradeLog*.XML 163 | UpgradeLog*.htm 164 | 165 | # SQL Server files 166 | App_Data/*.mdf 167 | App_Data/*.ldf 168 | 169 | ############# 170 | ## Windows detritus 171 | ############# 172 | 173 | # Windows image file caches 174 | Thumbs.db 175 | ehthumbs.db 176 | 177 | # Folder config file 178 | Desktop.ini 179 | 180 | # Recycle Bin used on file shares 181 | $RECYCLE.BIN/ 182 | 183 | # Mac crap 184 | .DS_Store 185 | 186 | 187 | ############# 188 | ## Python 189 | ############# 190 | 191 | *.py[cod] 192 | 193 | # Packages 194 | *.egg 195 | *.egg-info 196 | dist/ 197 | build/ 198 | eggs/ 199 | parts/ 200 | var/ 201 | sdist/ 202 | develop-eggs/ 203 | .installed.cfg 204 | 205 | # Installer logs 206 | pip-log.txt 207 | 208 | # Unit test / coverage reports 209 | .coverage 210 | .tox 211 | 212 | #Translations 213 | *.mo 214 | 215 | #Mr Developer 216 | .mr.developer.cfg 217 | 218 | 219 | ############ 220 | ## PROJECT 221 | ############ 222 | packages/ 223 | *.nupkg 224 | BarcodePrinter/Releases -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/.nuget/NuGet.exe -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 "$(NuGetExePath)" 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir) " 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /.nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BarcodePrinter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{634564DF-5D3B-4212-836D-E081E0FE8791}" 7 | ProjectSection(SolutionItems) = preProject 8 | .nuget\NuGet.Config = .nuget\NuGet.Config 9 | .nuget\NuGet.exe = .nuget\NuGet.exe 10 | .nuget\NuGet.targets = .nuget\NuGet.targets 11 | EndProjectSection 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarcodePrinter", "BarcodePrinter\BarcodePrinter.csproj", "{20C1DE39-CB12-4028-810D-2B24E367F96D}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug Webpage|Any CPU = Debug Webpage|Any CPU 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {20C1DE39-CB12-4028-810D-2B24E367F96D}.Debug Webpage|Any CPU.ActiveCfg = Debug|Any CPU 23 | {20C1DE39-CB12-4028-810D-2B24E367F96D}.Debug Webpage|Any CPU.Build.0 = Debug|Any CPU 24 | {20C1DE39-CB12-4028-810D-2B24E367F96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {20C1DE39-CB12-4028-810D-2B24E367F96D}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {20C1DE39-CB12-4028-810D-2B24E367F96D}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {20C1DE39-CB12-4028-810D-2B24E367F96D}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /BarcodePrinter/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /BarcodePrinter/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /BarcodePrinter/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace BarcodePrinter 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BarcodePrinter/AppBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Caliburn.Micro; 5 | using BarcodePrinter.ViewModels; 6 | using System.Windows; 7 | using System.ComponentModel.Composition; 8 | using System.ComponentModel.Composition.Hosting; 9 | using System.ComponentModel.Composition.Primitives; 10 | using BarcodePrinter.Printing; 11 | using System.IO; 12 | using Newtonsoft.Json.Linq; 13 | using Newtonsoft.Json; 14 | using BarcodePrinter.Logging; 15 | using System.Threading.Tasks; 16 | using System.Windows.Threading; 17 | 18 | namespace BarcodePrinter 19 | { 20 | sealed class AppBootstrapper : BootstrapperBase, IHandle 21 | { 22 | private WindowManager _windowManager; 23 | private readonly IEventAggregator _eventAggregator = new EventAggregator(); 24 | 25 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 26 | public AppBootstrapper() 27 | { 28 | StartRuntime(); 29 | #if (DEBUG==false) 30 | LogManager.GetLog = type => (ILog)new NLogLogger(type); 31 | #endif 32 | } 33 | 34 | 35 | protected override void OnStartup(object sender, StartupEventArgs e) 36 | { 37 | ILog logger = LogManager.GetLog(GetType()); 38 | 39 | 40 | logger.Info("Starting barcode printer"); 41 | 42 | if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null) 43 | { 44 | string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData; 45 | if (activationData != null && activationData.Length >= 1) 46 | { 47 | var path = new Uri(activationData[0]).LocalPath; 48 | OpenLabel(path); 49 | } 50 | else 51 | { 52 | #if DEBUG 53 | 54 | 55 | OpenLabel("../../test.obc"); 56 | #else 57 | logger.Info("No input file found. Exiting."); 58 | Application.Current.Shutdown(); 59 | #endif 60 | } 61 | } 62 | else 63 | { 64 | #if DEBUG 65 | 66 | 67 | OpenLabel("../../test.obc"); 68 | #else 69 | logger.Info("No input file found. Exiting."); 70 | Application.Current.Shutdown(); 71 | #endif 72 | } 73 | 74 | } 75 | 76 | 77 | private void OpenLabel(string path) 78 | { 79 | ILog logger = LogManager.GetLog(GetType()); 80 | 81 | logger.Info("Opening {0} for printing", path); 82 | try 83 | { 84 | using (StreamReader reader = File.OpenText(path)) 85 | { 86 | dynamic o = JToken.ReadFrom(new JsonTextReader(reader))[0]; 87 | 88 | ShowPrintLabel((string)o.label, (string)o.epl); 89 | } 90 | } 91 | catch (FileNotFoundException ex) 92 | { 93 | logger.Error(ex); 94 | MessageBox.Show("Unable to open label file:\n" + ex.Message, "Oops!", MessageBoxButton.OK, MessageBoxImage.Error); 95 | Application.Current.Shutdown(); 96 | } 97 | 98 | } 99 | 100 | private void ShowPrintLabel(string label, string epl) 101 | { 102 | _eventAggregator.Subscribe(this); 103 | _windowManager.ShowWindow(new MainViewModel(new BarcodeLabel(label, epl), new ApplicationPrinter(), _eventAggregator)); 104 | } 105 | 106 | 107 | protected override void Configure() 108 | { 109 | _windowManager = new WindowManager(); 110 | } 111 | 112 | public void Handle(PrintCompletion message) 113 | { 114 | Application.Current.Shutdown(); 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /BarcodePrinter/BarcodeLabel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.ComponentModel.Composition; 7 | using System.Windows.Media; 8 | using System.Windows.Media.Imaging; 9 | using System.Drawing; 10 | using System.Runtime.InteropServices; 11 | using System.ComponentModel; 12 | using System.Windows; 13 | using Com.SharpZebra.Printing; 14 | using Com.SharpZebra.Commands; 15 | using Com.SharpZebra; 16 | using Com.SharpZebra.Commands.Codes; 17 | 18 | 19 | namespace BarcodePrinter 20 | { 21 | 22 | [Export(typeof(BarcodeLabel))] 23 | class BarcodeLabel 24 | { 25 | 26 | public BarcodeLabel(String contents, String epl) 27 | { 28 | this.Contents = contents; 29 | this.Epl = epl; 30 | this.Width = 1.75 * QuantityTypes.Length.Inch; 31 | this.Height = 0.6 * QuantityTypes.Length.Inch; 32 | } 33 | 34 | public string Contents { get; private set; } 35 | public string Epl { get; private set; } 36 | 37 | public string BarcodeType { get; private set; } 38 | 39 | public QuantityTypes.IQuantity Width { get; private set; } 40 | public QuantityTypes.IQuantity Height { get; private set; } 41 | 42 | public ImageSource Image 43 | { 44 | get 45 | { 46 | return RenderImage().ToBitmapSource(); 47 | } 48 | } 49 | 50 | public Image RenderImage() 51 | { 52 | BarcodeLib.Barcode b = new BarcodeLib.Barcode(Contents, BarcodeLib.TYPE.CODE128); 53 | b.ForeColor = System.Drawing.Color.Black; 54 | b.BackColor = System.Drawing.Color.White; 55 | b.Width = (int)Math.Ceiling(Width.ConvertTo(QuantityTypes.Length.Inch) * 96); //96 DPI 56 | b.Height = (int)Math.Ceiling(Height.ConvertTo(QuantityTypes.Length.Inch) * 96); //96 DPI 57 | b.IncludeLabel = true; 58 | 59 | 60 | return b.Encode(BarcodeLib.TYPE.CODE128, Contents); 61 | } 62 | 63 | public static int dpi = 203; 64 | 65 | public void Print(string printer) 66 | { 67 | new ZebraPrinter(printer).Print(String.Format(this.Epl, Contents)); 68 | } 69 | } 70 | 71 | 72 | public static class BitmapSourceHelper 73 | { 74 | /// 75 | /// FxCop requires all Marshalled functions to be in a class called NativeMethods. 76 | /// 77 | internal static class NativeMethods 78 | { 79 | [DllImport("gdi32.dll")] 80 | [return: MarshalAs(UnmanagedType.Bool)] 81 | internal static extern bool DeleteObject(IntPtr hObject); 82 | } 83 | 84 | /// 85 | /// Converts a into a WPF . 86 | /// 87 | /// The source image. 88 | /// A BitmapSource 89 | public static BitmapSource ToBitmapSource(this System.Drawing.Image source) 90 | { 91 | System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(source); 92 | 93 | var bitSrc = bitmap.ToBitmapSource(); 94 | 95 | bitmap.Dispose(); 96 | bitmap = null; 97 | 98 | return bitSrc; 99 | } 100 | 101 | /// 102 | /// Converts a into a WPF . 103 | /// 104 | /// Uses GDI to do the conversion. Hence the call to the marshalled DeleteObject. 105 | /// 106 | /// The source bitmap. 107 | /// A BitmapSource 108 | public static BitmapSource ToBitmapSource(this System.Drawing.Bitmap source) 109 | { 110 | BitmapSource bitSrc = null; 111 | 112 | var hBitmap = source.GetHbitmap(); 113 | 114 | try 115 | { 116 | bitSrc = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( 117 | hBitmap, 118 | IntPtr.Zero, 119 | Int32Rect.Empty, 120 | BitmapSizeOptions.FromEmptyOptions()); 121 | } 122 | catch (Win32Exception) 123 | { 124 | bitSrc = null; 125 | } 126 | finally 127 | { 128 | NativeMethods.DeleteObject(hBitmap); 129 | } 130 | 131 | return bitSrc; 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /BarcodePrinter/BarcodePrinter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {20C1DE39-CB12-4028-810D-2B24E367F96D} 8 | WinExe 9 | Properties 10 | BarcodePrinter 11 | BarcodePrinter 12 | v4.5.1 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | true 17 | ..\ 18 | true 19 | true 20 | 21 | true 22 | publish\ 23 | true 24 | Web 25 | true 26 | Background 27 | 1 28 | Days 29 | true 30 | false 31 | true 32 | https://s3.amazonaws.com/clickonce-ovation-io/BarcodePrinter/ 33 | https://ovation.io/ 34 | BarcodePrinter 35 | Physion LLC 36 | Ovation Complete 37 | true 38 | publish.htm 39 | false 40 | 1 41 | 1.2.0.%2a 42 | false 43 | true 44 | true 45 | 46 | 47 | AnyCPU 48 | true 49 | full 50 | false 51 | bin\Debug\ 52 | DEBUG;TRACE 53 | prompt 54 | 4 55 | true 56 | true 57 | 58 | 59 | AnyCPU 60 | pdbonly 61 | true 62 | bin\Release\ 63 | TRACE 64 | prompt 65 | 4 66 | true 67 | true 68 | 69 | 70 | Internet 71 | 72 | 73 | true 74 | 75 | 76 | Properties\app.manifest 77 | 78 | 79 | true 80 | 81 | 82 | false 83 | 84 | 85 | E73E95D3B67C68C254D8CA87447038E65F2EA255 86 | 87 | 88 | 89 | 90 | 91 | 92 | http://timestamp.digicert.com 93 | 94 | 95 | BarcodePrinter_TemporaryKey.pfx 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | lib\net45\BarcodeLib.dll 104 | 105 | 106 | ..\packages\Caliburn.Micro.Core.2.0.1\lib\net45\Caliburn.Micro.dll 107 | 108 | 109 | ..\packages\Caliburn.Micro.2.0.1\lib\net45\Caliburn.Micro.Platform.dll 110 | 111 | 112 | False 113 | lib\net45\Com.SharpZebra.dll 114 | 115 | 116 | ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll 117 | 118 | 119 | ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll 120 | 121 | 122 | ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll 123 | 124 | 125 | ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll 126 | 127 | 128 | ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll 129 | 130 | 131 | ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Mdb.dll 132 | 133 | 134 | ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Pdb.dll 135 | 136 | 137 | ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Rocks.dll 138 | 139 | 140 | False 141 | ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll 142 | 143 | 144 | ..\packages\NLog.3.2.0.0\lib\net45\NLog.dll 145 | 146 | 147 | ..\packages\NLog.Targets.Syslog.2.1.5491.28378\lib\net35\NLog.Targets.Syslog.dll 148 | 149 | 150 | False 151 | ..\packages\NuGet.Core.2.8.3\lib\net40-Client\NuGet.Core.dll 152 | 153 | 154 | False 155 | ..\packages\QuantityTypes.1.0.40\lib\portable-net40+net45+sl5+windowsphone8+windows8\QuantityTypes.dll 156 | 157 | 158 | ..\packages\Splat.1.5.1\lib\Net45\Splat.dll 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | ..\packages\Caliburn.Micro.2.0.1\lib\net45\System.Windows.Interactivity.dll 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 4.0 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | MSBuild:Compile 183 | Designer 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | App.xaml 194 | Code 195 | 196 | 197 | MainView.xaml 198 | 199 | 200 | 201 | 202 | Code 203 | 204 | 205 | True 206 | True 207 | Resources.resx 208 | 209 | 210 | True 211 | Settings.settings 212 | True 213 | 214 | 215 | 216 | PreserveNewest 217 | 218 | 219 | ResXFileCodeGenerator 220 | Resources.Designer.cs 221 | 222 | 223 | Always 224 | 225 | 226 | 227 | 228 | Designer 229 | 230 | 231 | 232 | 233 | SettingsSingleFileGenerator 234 | Settings.Designer.cs 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | False 244 | Microsoft .NET Framework 4.5.1 %28x86 and x64%29 245 | true 246 | 247 | 248 | False 249 | .NET Framework 3.5 SP1 Client Profile 250 | false 251 | 252 | 253 | False 254 | .NET Framework 3.5 SP1 255 | false 256 | 257 | 258 | 259 | 260 | Designer 261 | MSBuild:Compile 262 | 263 | 264 | 265 | 266 | False 267 | Ovation barcode description file 268 | C789339B-D0D4-4866-8088-40184F54432C 269 | obc_icon.ico 270 | 271 | 272 | 273 | 274 | 275 | 276 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 291 | -------------------------------------------------------------------------------- /BarcodePrinter/BarcodePrinter.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PhysionBarcodePrinter 5 | $version$ 6 | $title$ 7 | $author$ 8 | $author$ 9 | http://opensource.org/licenses/Apache-2.0 10 | https://github.com/physion/BarcodePrinter 11 | 12 | false 13 | $description$ 14 | Initial release supporting Code128 labels. 15 | Copyright 2015 16 | Zebra Barcode 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /BarcodePrinter/ClassDiagram1.cd: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /BarcodePrinter/Logging/DebugLogger.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace BarcodePrinter.Logging 10 | { 11 | class DebugLogger : ILog 12 | { 13 | #region Fields 14 | private readonly Type _type; 15 | #endregion 16 | 17 | #region Constructors 18 | public DebugLogger(Type type) 19 | { 20 | _type = type; 21 | } 22 | #endregion 23 | 24 | #region Helper Methods 25 | private string CreateLogMessage(string format, params object[] args) 26 | { 27 | return string.Format("[{0}] {1}", 28 | DateTime.Now.ToString(), 29 | string.Format(format, args)); 30 | } 31 | #endregion 32 | 33 | #region ILog Members 34 | public void Error(Exception exception) 35 | { 36 | Debug.WriteLine(CreateLogMessage(exception.ToString()), "ERROR"); 37 | } 38 | public void Info(string format, params object[] args) 39 | { 40 | Debug.WriteLine(CreateLogMessage(format, args), "INFO"); 41 | } 42 | public void Warn(string format, params object[] args) 43 | { 44 | Debug.WriteLine(CreateLogMessage(format, args), "WARN"); 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /BarcodePrinter/Logging/NLogLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BarcodePrinter.Logging 8 | { 9 | class NLogLogger : Caliburn.Micro.ILog 10 | { 11 | #region Fields 12 | private readonly NLog.Logger _innerLogger; 13 | #endregion 14 | 15 | #region Constructors 16 | public NLogLogger(Type type) 17 | { 18 | _innerLogger = NLog.LogManager.GetLogger(type.Name); 19 | } 20 | #endregion 21 | 22 | #region ILog Members 23 | public void Error(Exception exception) 24 | { 25 | _innerLogger.ErrorException(exception.Message, exception); 26 | } 27 | public void Info(string format, params object[] args) 28 | { 29 | _innerLogger.Info(format, args); 30 | } 31 | public void Warn(string format, params object[] args) 32 | { 33 | _innerLogger.Warn(format, args); 34 | } 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BarcodePrinter/NLog.config: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/BarcodeLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/BarcodeLib.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/BarcodePrinter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/BarcodePrinter.exe -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Caliburn.Micro.Platform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Caliburn.Micro.Platform.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Caliburn.Micro.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Caliburn.Micro.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Com.SharpZebra.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Com.SharpZebra.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/DeltaCompressionDotNet.MsDelta.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/DeltaCompressionDotNet.MsDelta.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/DeltaCompressionDotNet.PatchApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/DeltaCompressionDotNet.PatchApi.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/DeltaCompressionDotNet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/DeltaCompressionDotNet.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/ICSharpCode.SharpZipLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/ICSharpCode.SharpZipLib.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Microsoft.Web.XmlTransform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Microsoft.Web.XmlTransform.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.Mdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.Mdb.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.Pdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.Pdb.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.Rocks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.Rocks.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Mono.Cecil.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/NLog.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/NLog.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/NuGet.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/NuGet.Core.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/QuantityTypes.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/QuantityTypes.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Splat.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Splat.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Squirrel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/Squirrel.dll -------------------------------------------------------------------------------- /BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/PhysionBarcodePrinter/app-1.0.0.0/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /BarcodePrinter/Printing/ApplicationPrinter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing.Printing; 4 | using System.Linq; 5 | using System.Management; 6 | using Caliburn.Micro; 7 | 8 | namespace BarcodePrinter.Printing 9 | { 10 | public class ApplicationPrinter 11 | { 12 | ILog logger = LogManager.GetLog(typeof(ApplicationPrinter)); 13 | 14 | public IList InstalledPrinters 15 | { 16 | get 17 | { 18 | if (PrinterSettings.InstalledPrinters.Count == 0) 19 | { 20 | logger.Info("InstalledPrinters list is empty. Trying via System.Management"); 21 | 22 | var query = new ObjectQuery("SELECT * FROM Win32_Printer"); 23 | var searcher = new ManagementObjectSearcher(query); 24 | 25 | List result = new List(); 26 | foreach (ManagementObject mo in searcher.Get()) 27 | { 28 | result.Add((string)mo["Name"]); 29 | } 30 | 31 | result.Sort(StringComparer.Ordinal); 32 | 33 | return result; 34 | 35 | } 36 | 37 | 38 | return ToSortedStringArray(PrinterSettings.InstalledPrinters); 39 | } 40 | } 41 | 42 | public IList InstalledZebraPrinters 43 | { 44 | get 45 | { 46 | return InstalledPrinters.Where(IsZebraPrinter).ToList(); 47 | } 48 | } 49 | 50 | public string DefaultZebraPrinter 51 | { 52 | get { return InstalledZebraPrinters.FirstOrDefault(); } 53 | } 54 | 55 | private static bool IsZebraPrinter(string printer) 56 | { 57 | return !string.IsNullOrEmpty(printer) 58 | && (printer.ToUpper().Contains("ZEBRA") || printer.ToUpper().Contains("ZDESIGNER")); 59 | } 60 | 61 | private IList ToSortedStringArray(PrinterSettings.StringCollection printers) 62 | { 63 | List stringList = new List(); 64 | foreach (string printer in printers) 65 | { 66 | stringList.Add(printer); 67 | } 68 | stringList.Sort(StringComparer.Ordinal); 69 | return stringList; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /BarcodePrinter/Printing/PrintCompletion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Caliburn.Micro; 7 | 8 | namespace BarcodePrinter.Printing 9 | { 10 | class PrintCompletion 11 | { 12 | public IScreen Screen { get; private set; } 13 | 14 | public PrintCompletion(IScreen sender) 15 | { 16 | Screen = sender; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BarcodePrinter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Physion.BarcodePrinter")] 11 | [assembly: AssemblyDescription("Barcode printer for Zebra thermal printers")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Physion LLC")] 14 | [assembly: AssemblyProduct("BarcodePrinter")] 15 | [assembly: AssemblyCopyright("Copyright © 2015")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.2.0.1")] 55 | [assembly: AssemblyFileVersion("1.2.0.1")] 56 | -------------------------------------------------------------------------------- /BarcodePrinter/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace BarcodePrinter.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BarcodePrinter.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /BarcodePrinter/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /BarcodePrinter/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace BarcodePrinter.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("")] 29 | public string DefaultPrinterName { 30 | get { 31 | return ((string)(this["DefaultPrinterName"])); 32 | } 33 | set { 34 | this["DefaultPrinterName"] = value; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /BarcodePrinter/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BarcodePrinter/Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 54 | -------------------------------------------------------------------------------- /BarcodePrinter/Resources/obc_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/physion/BarcodePrinter/9182f683704ecaa4ebfa1796bad96da722dc3dcd/BarcodePrinter/Resources/obc_icon.ico -------------------------------------------------------------------------------- /BarcodePrinter/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.ComponentModel.Composition; 7 | using System.Net; 8 | using System.Threading; 9 | using BarcodePrinter.Printing; 10 | using System.Windows.Media; 11 | using System.Windows; 12 | using Caliburn.Micro; 13 | using NLog; 14 | using LogManager = Caliburn.Micro.LogManager; 15 | 16 | namespace BarcodePrinter.ViewModels 17 | { 18 | [Export(typeof(MainViewModel))] 19 | class MainViewModel : Screen 20 | { 21 | private const string WindowTitleDefault = "Ovation Barcode"; 22 | 23 | private string _windowTitle = WindowTitleDefault; 24 | private IEventAggregator eventAggregator; 25 | 26 | [ImportingConstructor] 27 | public MainViewModel(BarcodeLabel label, ApplicationPrinter printer, IEventAggregator eventAggregator) 28 | { 29 | this.Label = label; 30 | this.AppPrinter = printer; 31 | string printerName; 32 | if (BarcodePrinter.Properties.Settings.Default.DefaultPrinterName == null || BarcodePrinter.Properties.Settings.Default.DefaultPrinterName.Length == 0) 33 | { 34 | printerName = printer.DefaultZebraPrinter; 35 | } else { 36 | printerName = BarcodePrinter.Properties.Settings.Default.DefaultPrinterName; 37 | } 38 | this.SelectedPrinter = printerName; 39 | this.eventAggregator = eventAggregator; 40 | logger = LogManager.GetLog(GetType()); 41 | 42 | } 43 | 44 | 45 | public BarcodeLabel Label { get; private set; } 46 | 47 | private string _selectedPrinter; 48 | 49 | public string SelectedPrinter 50 | { 51 | get { return _selectedPrinter; } 52 | set 53 | { 54 | _selectedPrinter = value; 55 | BarcodePrinter.Properties.Settings.Default.DefaultPrinterName = _selectedPrinter; 56 | BarcodePrinter.Properties.Settings.Default.Save(); 57 | NotifyOfPropertyChange(() => SelectedPrinter); 58 | NotifyOfPropertyChange(() => CanPrint); 59 | } 60 | } 61 | 62 | private ApplicationPrinter AppPrinter { get; set; } 63 | public IList AvailablePrinters 64 | { 65 | get { return AppPrinter.InstalledPrinters; } 66 | } 67 | 68 | int _printProgress = 0; 69 | private ILog logger; 70 | 71 | public int Progress 72 | { 73 | get 74 | { 75 | return _printProgress; 76 | } 77 | 78 | set 79 | { 80 | _printProgress = value; 81 | NotifyOfPropertyChange(() => Progress); 82 | } 83 | } 84 | 85 | 86 | 87 | public string WindowTitle 88 | { 89 | get { return _windowTitle; } 90 | set 91 | { 92 | _windowTitle = value; 93 | NotifyOfPropertyChange(() => WindowTitle); 94 | } 95 | } 96 | 97 | public ImageSource LabelImage 98 | { 99 | get 100 | { 101 | return Label.Image; 102 | } 103 | } 104 | 105 | public void Print() 106 | { 107 | try 108 | { 109 | //await Task.Run(() => Label.Print(SelectedPrinter)); 110 | Label.Print(SelectedPrinter); 111 | 112 | eventAggregator.PublishOnUIThread(new PrintCompletion(this)); 113 | 114 | } 115 | catch (Exception e) 116 | { 117 | logger.Error(e); 118 | MessageBox.Show("Unable to print label:\n" + e.Message, "Oops!", MessageBoxButton.OK, MessageBoxImage.Error); 119 | } 120 | } 121 | 122 | public bool CanPrint 123 | { 124 | get { return SelectedPrinter != null; } 125 | } 126 | 127 | 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /BarcodePrinter/Views/MainView.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 29 |