Commit 511814a6 刘韬

接入zebra printer sdk

1 个父辈 8c307787
正在显示 116 个修改的文件 包含 7017 行增加58 行删除
......@@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintLabel", "PrintLabel\Pr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintLabel_Test", "PrintLabel_Test\PrintLabel_Test.csproj", "{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZebraPrinterHelper", "ZebraPrinterHelper\ZebraPrinterHelper.csproj", "{E4F7AFC7-2F6D-4685-8350-3C05697428EA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeveloperDemo_Windows", "ZebraDemoSource\DeveloperDemo_Windows.csproj", "{8B42A994-831D-4EAF-B40F-436166CD5B6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -21,6 +25,14 @@ Global
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{857ACBBF-F326-4AD0-AD6F-B7F7479AFE2C}.Release|Any CPU.Build.0 = Release|Any CPU
{E4F7AFC7-2F6D-4685-8350-3C05697428EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4F7AFC7-2F6D-4685-8350-3C05697428EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4F7AFC7-2F6D-4685-8350-3C05697428EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4F7AFC7-2F6D-4685-8350-3C05697428EA}.Release|Any CPU.Build.0 = Release|Any CPU
{8B42A994-831D-4EAF-B40F-436166CD5B6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B42A994-831D-4EAF-B40F-436166CD5B6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B42A994-831D-4EAF-B40F-436166CD5B6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B42A994-831D-4EAF-B40F-436166CD5B6A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -14,7 +14,7 @@ namespace PrintLabel
/// <summary>
/// 像素毫米转换的倍数
/// </summary>
internal const float MULTIPLE = 100f;
internal static float MULTIPLE = 203f;
/// <summary>
/// 添加标签时初始的大小,mm
/// </summary>
......
......@@ -63,6 +63,12 @@ namespace Asa
Common.LabelPrint.PrinterName = name;
Common.LabelPrint.PrintLandscape = landscape;
}
public void SetResolution(int printerDPI)
{
Common.MULTIPLE = printerDPI;
}
public bool Rotate180 { set => Common.LabelPrint.Rotate180 = value; get => Common.LabelPrint.Rotate180; }
/// <summary>
......@@ -79,7 +85,7 @@ namespace Asa
}
public Bitmap PrintPreview(Dictionary<string, string> key)
{
Common.LabelPrint.labelIdx = 1;
//Common.LabelPrint.labelIdx = 1;
Bitmap bmp = Common.LabelPrint.PrintPreview(key, out string[] code);
return bmp;
}
......
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
</configuration>
\ No newline at end of file
</configuration>
......@@ -48,6 +48,7 @@ namespace PrintLabel_Test
text.Add("aa", "123");
text.Add("bb", "yumtrj");
print.Print(text);
}
private void button4_Click(object sender, EventArgs e)
......

namespace PrintLabel_Test
{
partial class Form2
{
/// <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.button3 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button3
//
this.button3.Location = new System.Drawing.Point(483, 142);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(123, 49);
this.button3.TabIndex = 5;
this.button3.Text = "打印";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(27, 20);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(123, 49);
this.button1.TabIndex = 4;
this.button1.Text = "编辑标签";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(253, 157);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(153, 20);
this.comboBox1.TabIndex = 6;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(253, 17);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(153, 21);
this.textBox1.TabIndex = 7;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(224, 20);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 12);
this.label1.TabIndex = 8;
this.label1.Text = "IP:";
//
// button2
//
this.button2.Location = new System.Drawing.Point(483, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(123, 49);
this.button2.TabIndex = 5;
this.button2.Text = "连接";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(251, 142);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 12);
this.label2.TabIndex = 8;
this.label2.Text = "选择标签:";
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button3);
this.Controls.Add(this.button1);
this.Name = "Form2";
this.Text = "Form2";
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label2;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PrintLabel_Test
{
public partial class Form2 : Form
{
private Asa.PrintLabel print;
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
print = new Asa.PrintLabel(Application.StartupPath + "\\Label");
reloadlabel();
ConfigHelper.Config.PropertyBind("IP", textBox1, "Text", "TextChanged");
ConfigHelper.Config.PropertyBind<int>("labelindex", comboBox1, "SelectedIndex", "SelectedIndexChanged");
}
private void button1_Click(object sender, EventArgs e)
{
print.EditLabel();
reloadlabel();
}
void reloadlabel() {
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.Items.Clear();
comboBox1.Items.AddRange(print.GetLabelName());
comboBox1.SelectedIndex = 0;
}
private void button3_Click(object sender, EventArgs e)
{
print.LoadLabel(comboBox1.Text);
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("aa", "123");
text.Add("bb", "yumtrj");
var bmp = print.PrintPreview(text);
if (!zebraManger.PrintImage(bmp, out string msg)) {
MessageBox.Show(msg);
}
bmp.Dispose();
}
ZebraPrinterHelper.ZebraManger zebraManger = new ZebraPrinterHelper.ZebraManger();
private void button2_Click(object sender, EventArgs e)
{
zebraManger.Init(textBox1.Text, ZebraPrinterHelper.ConnectionType.Network);
if (!zebraManger.Connection(out string msg)) {
MessageBox.Show(msg);
}else
MessageBox.Show("连接成功");
}
}
}
<?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>
\ No newline at end of file
......@@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType>
<RootNamespace>PrintLabel_Test</RootNamespace>
<AssemblyName>PrintLabel_Test</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -33,6 +34,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Core" />
......@@ -53,11 +57,20 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -66,6 +79,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......@@ -85,6 +99,10 @@
<Project>{b8f25ece-dee6-41d6-8ef0-8afbf2577c17}</Project>
<Name>PrintLabel</Name>
</ProjectReference>
<ProjectReference Include="..\ZebraPrinterHelper\ZebraPrinterHelper.csproj">
<Project>{e4f7afc7-2f6d-4685-8350-3c05697428ea}</Project>
<Name>ZebraPrinterHelper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -16,7 +16,7 @@ namespace PrintLabel_Test
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new Form2());
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace PrintLabel_Test.Properties
{
namespace PrintLabel_Test.Properties {
using System;
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
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()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrintLabel_Test.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace PrintLabel_Test.Properties
{
namespace PrintLabel_Test.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
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.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
{
public static Settings Default {
get {
return defaultInstance;
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{8B42A994-831D-4EAF-B40F-436166CD5B6A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Zebra.Windows.DevDemo</RootNamespace>
<AssemblyName>DeveloperDemo.Windows</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</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>
<ApplicationIcon>Zebra\Windows\DevDemo\zebralogo.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto">
<HintPath>Sdk\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="Csv, Version=1.0.31.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\Csv.dll</HintPath>
</Reference>
<Reference Include="FluentFTP">
<HintPath>Sdk\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="Microsoft.DotNet.PlatformAbstractions">
<HintPath>Sdk\Microsoft.DotNet.PlatformAbstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyModel">
<HintPath>Sdk\Microsoft.Extensions.DependencyModel.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Core">
<HintPath>Sdk\SdkApi.Core.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop">
<HintPath>Sdk\SdkApi.Desktop.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop.Usb">
<HintPath>Sdk\SdkApi.Desktop.Usb.dll</HintPath>
</Reference>
<Reference Include="SharpSnmpLib">
<HintPath>Sdk\SharpSnmpLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Common, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Data.Common.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.StackTrace, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Diagnostics.StackTrace.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.Tracing, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Diagnostics.Tracing.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Globalization.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Globalization.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Sockets, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Net.Sockets.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>Sdk\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization.Primitives, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Runtime.Serialization.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.SecureString, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Security.SecureString.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Overlapped, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Threading.Overlapped.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.XPath.XDocument, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\System.Xml.XPath.XDocument.dll</HintPath>
</Reference>
<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Sdk\Windows.winmd</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Zebra\Windows\DevDemo\App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Zebra\Windows\DevDemo\Demos\ConnectionBuilder\ConnectionBuilderView.xaml.cs">
<DependentUpon>ConnectionBuilderView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\ConnectionBuilder\ConnectionBuilderViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\ConnectionBuilder\ConnectionPrefix.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\ImagePrint\ImagePrintView.xaml.cs">
<DependentUpon>ImagePrintView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\ImagePrint\ImagePrintViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\ListFormats\ListFormatsView.xaml.cs">
<DependentUpon>ListFormatsView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\ListFormats\ListFormatsViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\MagCard\MagCardView.xaml.cs">
<DependentUpon>MagCardView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\MagCard\MagCardViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\PrinterStatus\PrinterStatusView.xaml.cs">
<DependentUpon>PrinterStatusView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\PrinterStatus\PrinterStatusViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\Profile\ProfileView.xaml.cs">
<DependentUpon>ProfileView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\Profile\ProfileViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\SendFile\SendFileView.xaml.cs">
<DependentUpon>SendFileView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\SendFile\SendFileViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\Settings\Setting.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\Settings\SettingsView.xaml.cs">
<DependentUpon>SettingsView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\Settings\SettingsViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\SmartCard\SmartCardView.xaml.cs">
<DependentUpon>SmartCardView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\SmartCard\SmartCardViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\StoredFormat\FormatVariable.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\StoredFormat\StoredFormatView.xaml.cs">
<DependentUpon>StoredFormatView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\StoredFormat\StoredFormatViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Dialogs\StoredFormatDialog.xaml.cs">
<DependentUpon>StoredFormatDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Dialogs\StoredFormatDialogViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Enums\ConnectionState.cs" />
<Compile Include="Zebra\Windows\DevDemo\Enums\DiscoveryMethod.cs" />
<Compile Include="Zebra\Windows\DevDemo\UserControls\ConnectionSelectorViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Enums\ConnectionType.cs" />
<Compile Include="Zebra\Windows\DevDemo\UserControls\ConnectionSelectorView.xaml.cs">
<DependentUpon>ConnectionSelectorView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\UserControls\FileSelectorView.xaml.cs">
<DependentUpon>FileSelectorView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\UserControls\FileSelectorViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Utils\BluetoothHelper.cs" />
<Compile Include="Zebra\Windows\DevDemo\Utils\ConnectionTypeDescriptionValueConverter.cs" />
<Compile Include="Zebra\Windows\DevDemo\Utils\DemoViewModelNameValueConverter.cs" />
<Compile Include="Zebra\Windows\DevDemo\Utils\DiscoveryMethodDescriptionValueConverter.cs" />
<Compile Include="Zebra\Windows\DevDemo\Utils\MessageBoxCreator.cs" />
<Page Include="Zebra\Windows\DevDemo\Demos\ConnectionBuilder\ConnectionBuilderView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\Connectivity\ConnectivityView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\Discovery\DiscoveryView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\ImagePrint\ImagePrintView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\ListFormats\ListFormatsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\MagCard\MagCardView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\PrinterStatus\PrinterStatusView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\Profile\ProfileView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\SendFile\SendFileView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\Settings\SettingsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\SmartCard\SmartCardView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Demos\StoredFormat\StoredFormatView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\Dialogs\StoredFormatDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="Zebra\Windows\DevDemo\App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\Connectivity\ConnectivityView.xaml.cs">
<DependentUpon>ConnectivityView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\Connectivity\ConnectivityViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\Discovery\DiscoveryView.xaml.cs">
<DependentUpon>DiscoveryView.xaml</DependentUpon>
</Compile>
<Compile Include="Zebra\Windows\DevDemo\Demos\Discovery\DiscoveryViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\Demos\IDemoViewModel.cs" />
<Compile Include="Zebra\Windows\DevDemo\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Zebra\Windows\DevDemo\UserControls\ConnectionSelectorView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Zebra\Windows\DevDemo\UserControls\FileSelectorView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Zebra\Windows\DevDemo\MainWindowViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest">
<SubType>Designer</SubType>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Zebra\Windows\DevDemo\zebralogo.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\Zebra_Logo_W.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("DeveloperDemo.Windows")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeveloperDemo.Windows")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <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 Zebra.Windows.DevDemo.Properties {
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", "15.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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Zebra.Windows.DevDemo.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;
}
}
}
}
<?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>
\ No newline at end of file
//------------------------------------------------------------------------------
// <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 Zebra.Windows.DevDemo.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.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;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件的差异太大,无法显示。
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>SdkApi.Desktop</name>
</assembly>
<members>
<member name="M:Zebra.Sdk.CommandLine.Commands.Internal.Command.Run(Zebra.Sdk.CommandLine.Internal.ParsedArguments)">
<summary>
</summary>
<param name="opts"></param>
<exception cref="T:System.Exception"></exception>
</member>
<member name="P:Zebra.Sdk.CommandLine.Commands.Internal.Command.ExpectedArgRange">
<summary>
Gets the expected bare word arguments.
</summary>
</member>
<member name="M:Zebra.Sdk.CommandLine.Commands.Internal.ConfigureWeblinkCommand.CreateConnection(System.String)">
<summary>
</summary>
<param name="connectionDetails"></param>
<returns></returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.CommandLine.Commands.Internal.ConvertCertificateCommand.Run(Zebra.Sdk.CommandLine.Internal.ParsedArguments)">
<summary>
</summary>
<param name="opts"></param>
<exception cref="T:System.Exception"></exception>
</member>
<member name="M:Zebra.Sdk.CommandLine.Commands.Internal.ConvertCertificateCommand.WriteCertificatesToFile(Zebra.Sdk.Certificate.ZebraCertificateInfo,System.String,System.String)">
<summary>
</summary>
<param name="certificateInfo"></param>
<param name="password"></param>
<param name="outputFilePath"></param>
<exception cref="T:System.ArgumentException"></exception>
<exception cref="T:System.IO.IOException"></exception>
</member>
<member name="M:Zebra.Sdk.CommandLine.Commands.Internal.ConvertCertificateCommand.SendCertificatesToPrinter(Zebra.Sdk.Comm.Connection,Zebra.Sdk.Certificate.ZebraCertificateInfo,System.String)">
<summary>
</summary>
<param name="connection"></param>
<param name="certificateInfo"></param>
<param name="password"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
<exception cref="T:Zebra.Sdk.Device.ZebraIllegalArgumentException"></exception>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.CommandLine.Commands.Internal.ConvertFontCommand.SendFontToPrinter(Zebra.Sdk.CommandLine.Internal.ParsedArguments,System.String,System.IO.Stream,System.String)">
<summary>
</summary>
<param name="opts"></param>
<param name="fontType"></param>
<param name="fontInput"></param>
<param name="connectionString"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
<exception cref="T:Zebra.Sdk.Printer.ZebraPrinterLanguageUnknownException"></exception>
<exception cref="T:Zebra.Sdk.Printer.NotALinkOsPrinterException"></exception>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.#ctor(System.String,System.String)">
<summary>
Max length of optionTitle is 12 characters.
</summary>
<param name="optionTitle"></param>
<param name="description"></param>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.#ctor(System.String,System.String,System.String)">
<summary>
Max length of optionTitle is 12 characters.
</summary>
<param name="optionTitle"></param>
<param name="longTitle"></param>
<param name="description"></param>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.AddArg(System.String,System.Boolean)">
<summary>
Max length of optionTitle is 12 characters.
</summary>
<param name="arg"></param>
<param name="required"></param>
<returns></returns>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.SetHidden(System.Boolean)">
<summary>
</summary>
<param name="hidden">Hide the option so it does not appear on the help menu.</param>
<returns>Option object.</returns>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.SetLongTitle(System.String)">
<summary>
</summary>
<param name="title"></param>
<returns>Option object.</returns>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.Matches(System.String)">
<exception cref="T:System.ArgumentException"/>
<exception cref="T:System.ArgumentNullException"/>
<exception cref="T:System.ArgumentOutOfRangeException"/>
<exception cref="T:System.Text.RegularExpressions.RegexMatchTimeoutException"/>
</member>
<member name="P:Zebra.Sdk.CommandLine.Internal.Option.Hidden">
<summary>
True if the Option is hidden from the help menu.
</summary>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Option.ToString">
<exception cref="T:System.ArgumentOutOfRangeException"/>
</member>
<member name="P:Zebra.Sdk.CommandLine.Internal.Option.ArgName">
<summary>
Argument name if there is one.
</summary>
</member>
<member name="P:Zebra.Sdk.CommandLine.Internal.Option.HasArg">
<summary>
Whether command has arg.
</summary>
</member>
<member name="P:Zebra.Sdk.CommandLine.Internal.Option.LongName">
<summary>
Long option.
</summary>
</member>
<member name="P:Zebra.Sdk.CommandLine.Internal.Option.Name">
<summary>
Short option.
</summary>
</member>
<member name="P:Zebra.Sdk.CommandLine.Internal.Option.Description">
<summary>
Description.
</summary>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.OptionGroup.IsValid(Zebra.Sdk.CommandLine.Internal.ParsedArguments)">
<exception cref="T:System.ArgumentException"/>
<exception cref="T:System.ArgumentNullException"/>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.OptionGroup.GetErrorMessage">
<exception cref="T:System.ArgumentOutOfRangeException"/>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.ParsedArguments.ContainsOption(Zebra.Sdk.CommandLine.Internal.Option)">
<summary>
</summary>
<param name="opt"></param>
<returns></returns>
<exception cref="T:System.ArgumentException"/>
<exception cref="T:System.ArgumentNullException"/>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.ParsedArguments.IsArgumentDuplicated(Zebra.Sdk.CommandLine.Internal.Option)">
<exception cref="T:System.ArgumentNullException"/>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.ParsedArguments.GetOptionArgument(Zebra.Sdk.CommandLine.Internal.Option)">
<exception cref="T:System.ArgumentNullException"/>
</member>
<member name="M:Zebra.Sdk.CommandLine.Internal.Parser.Parse(System.String[])">
<exception cref="T:System.ArgumentNullException"/>
<exception cref="T:System.Text.RegularExpressions.RegexMatchTimeoutException"/>
</member>
<member name="T:Zebra.Sdk.Comm.BluetoothConnection">
<summary>
Establishes a Bluetooth&#174; connection to a printer. (Windows 10 only)
</summary>
<remarks>
In order to connect to a device with Bluetooth&#174;, the device must be discoverable, authentication must be enabled,
and the authentication pin must be set (1-16 alphanumeric characters).<br/>
The encryption type and whether or not it is used is determined by the device initiating the connection and not
the device being connected to.
</remarks>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/BluetoothConnectionExample.cs"/></example>
</member>
<member name="F:Zebra.Sdk.Comm.BluetoothConnection.friendlyName">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="F:Zebra.Sdk.Comm.BluetoothConnection.macAddress">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.#ctor">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="connectionInfo"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Printer connection error or unsupported operating system.</exception>
<exception cref="T:Zebra.Sdk.Comm.Internal.NotMyConnectionDataException">For internal use of the Zebra Printer API only.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.#ctor(System.String)">
<summary>
Constructs a new Bluetooth&#174; connection with the given <c>macAddress</c>.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The default timeout is a maximum of 10
seconds for any data to be received. If no more data is available after 500 milliseconds the read operation is assumed to be
complete.<br/>
To specify timeouts other than the defaults, use:<br/>
<see cref="M:Zebra.Sdk.Comm.BluetoothConnection.#ctor(System.String,System.Int32,System.Int32)"/>
</remarks>
<param name="macAddress">The device's MAC address.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Constructs a new Bluetooth&#174; connection with the given<c>macAddress</c> and timeout values.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The timeout is a maximum of
<c>maxTimeoutForRead</c> milliseconds for any data to be received. If no more data is available after <c>timeToWaitForMoreData</c>
milliseconds the read operation is assumed to be complete.
</remarks>
<param name="macAddress">The device's MAC address.</param>
<param name="maxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received.</param>
<param name="timeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the initial read.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.#ctor(Zebra.Sdk.Comm.Internal.ZebraConnector,System.String,System.Int32,System.Int32)">
<summary>
Exposed this protected constructor for testing. We can pass in a mock Connector rather than the BT specific one.
The MAC address is a hexadecimal string with no separators between the octets (e.g. 0011BBDD55FF).
</summary>
<param name="zebraConnector"></param>
<param name="macAddress"></param>
<param name="maxTimeoutForRead"></param>
<param name="timeToWaitForMoreData"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.Open">
<summary>
Opens a Bluetooth&#174; connection as specified in the constructor.
</summary>
<see cref="M:Zebra.Sdk.Comm.ConnectionA.Open"/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.Close">
<summary>
Closes the Bluetooth&#174; connection.
</summary>
<see cref="M:Zebra.Sdk.Comm.Connection.Close"/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.ToString">
<summary>
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.
</summary>
<returns><c>Bluetooth</c>:[MAC Address]:[Friendly Name].</returns>
<see cref="M:Zebra.Sdk.Comm.Connection.ToString"/>
</member>
<member name="P:Zebra.Sdk.Comm.BluetoothConnection.SimpleConnectionName">
<summary>
Gets the MAC address and the friendly name as the description.
</summary>
<returns>[MAC Address]:[Friendly Name]</returns>
<see cref="P:Zebra.Sdk.Comm.Connection.SimpleConnectionName"/>
</member>
<member name="P:Zebra.Sdk.Comm.BluetoothConnection.MACAddress">
<summary>
Gets the MAC address which was passed into the constructor. The MAC address is a hexadecimal string with
separators between the octets (e.g. 00:11:BB:DD:55:FF).
</summary>
</member>
<member name="P:Zebra.Sdk.Comm.BluetoothConnection.FriendlyName">
<summary>
Gets the friendly name of the Bluetooth&#174; connection. The friendly name is obtained from the device when
this connection is opened. If the friendly name changes on the device, it will not be refreshed until the
connection is closed and reopened.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.GetConnectionReestablisher(System.Int64)">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.BytesAvailable">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.ReadChar">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnection.Read(System.Int32)">
<inheritdoc/>
</member>
<member name="T:Zebra.Sdk.Comm.BluetoothConnectionInsecure">
<summary>
Establishes an insecure Bluetooth&#174; connection to a printer. Insecure Bluetooth&#174; connections do not require
the device and the printer to be paired. (Windows 10 only)
</summary>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/BluetoothConnectionInsecureExample.cs"/></example>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnectionInsecure.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
For Zebra Internal Use Only.
</summary>
<param name="connectionInfo"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnectionInsecure.#ctor(System.String)">
<summary>
Constructs a new insecure Bluetooth&#174; connection with the given <c>macAddress</c>.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The default timeout is a maximum of 5 seconds for
any data to be received. If no more data is available after 500 milliseconds the read operation is assumed to be complete.<br/>
To specify timeouts other than the defaults, use:<br/>
<see cref="M:Zebra.Sdk.Comm.BluetoothConnectionInsecure.#ctor(System.String,System.Int32,System.Int32)"/>.
</remarks>
<param name="macAddress">The device's MAC address.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothConnectionInsecure.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Constructs a new insecure Bluetooth&#174; connection with the given <c>macAddress</c> and timeout values.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The timeout is a maximum of <c>maxTimeoutForRead</c>
milliseconds for any data to be received. If no more data is available after <c>timeToWaitForMoreData</c> milliseconds the read operation
is assumed to be complete.<br/>
</remarks>
<param name="macAddress">The device's MAC address.</param>
<param name="maxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received.</param>
<param name="timeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the initial read.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="T:Zebra.Sdk.Comm.BluetoothStatusConnection">
<summary>
Establishes a Bluetooth&#174; status only connection to a Link-OS printer. (Windows 10 only)
</summary>
<remarks>
A <see cref="T:Zebra.Sdk.Comm.BluetoothConnection"/> must be actively open before this connection can be used.<br/>
This connection requires Link-OS firmware 2.5 or higher. This channel will not block the printing channel,
nor can it print. If you wish to print, see <see cref="T:Zebra.Sdk.Comm.BluetoothConnection"/>.<br/>
<b>Note:</b> In order to connect to a device with Bluetooth&#174;, the device must be discoverable, authentication
must be enabled, and the authentication pin must be set (1-16 alphanumeric characters).<br/>
The encryption type and whether or not it is used is determined by the device initiating the connection and not the
device being connected to.
</remarks>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/BluetoothStatusConnectionExample.cs"/></example>
</member>
<member name="F:Zebra.Sdk.Comm.BluetoothStatusConnection.CONNECTION_STRING_ID">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="F:Zebra.Sdk.Comm.BluetoothStatusConnection.friendlyName">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="F:Zebra.Sdk.Comm.BluetoothStatusConnection.macAddress">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="connectionInfo"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Printer connection error or unsupported soperating system.</exception>
<exception cref="T:Zebra.Sdk.Comm.Internal.NotMyConnectionDataException">For internal use of the Zebra Printer API only.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.#ctor(System.String)">
<summary>
Constructs a new Bluetooth&#174; connection with the given <c>macAddress</c>.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The default timeout is a maximum of 5
seconds for any data to be received. If no more data is available after 500 milliseconds the read operation is
assumed to be complete.<br/>
To specify timeouts other than the defaults, use:<br/>
<see cref="M:Zebra.Sdk.Comm.BluetoothStatusConnection.#ctor(System.String,System.Int32,System.Int32)"/>
</remarks>
<param name="macAddress">The device's MAC address.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Constructs a new status only Bluetooth&#174; connection with the given <c>macAddress</c> and timeout values.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The timeout is a maximum of
<c>maxTimeoutForRead</c> milliseconds for any data to be received. If no more data is available after <c>timeToWaitForMoreData</c>
milliseconds the read operation is assumed to be complete.
</remarks>
<param name="macAddress">The device's MAC address.</param>
<param name="maxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received.</param>
<param name="timeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the initial read.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.#ctor(Zebra.Sdk.Comm.Internal.ZebraConnector,System.String,System.Int32,System.Int32)">
<summary>
Exposed this protected constructor for testing. We can pass in a mock Connector rather than the BT specific one.
The MAC address is a hexadecimal string with no separators between the octets (e.g. 0011BBDD55FF).
</summary>
<param name="zebraConnector"></param>
<param name="macAddress"></param>
<param name="maxTimeoutForRead"></param>
<param name="timeToWaitForMoreData"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.Open">
<summary>
Opens a status only Bluetooth&#174; connection as specified in the constructor.
</summary>
<remarks>
If the device does not support status connections (that is, if it is not a Link-OS 2.5 or higher device) calling
open will throw a ConnectionException.
</remarks>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.Close">
<summary>
Closes the Bluetooth&#174; connection.
</summary>
<see cref="M:Zebra.Sdk.Comm.Connection.Close"/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.ToString">
<summary>
Returns <c>Bluetooth_STATUS</c>:[MAC Address]:[Friendly Name].
</summary>
<remarks>
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.<br/>
<see cref="M:Zebra.Sdk.Comm.Connection.ToString"/>
</remarks>
<returns><c>Bluetooth_STATUS</c>:[MAC Address]:[Friendly Name].</returns>
</member>
<member name="P:Zebra.Sdk.Comm.BluetoothStatusConnection.SimpleConnectionName">
<summary>
Return the MAC address and friendly name of the status port as the description.
</summary>
<returns>[MAC Address]:[Friendly Name]</returns>
<see cref="P:Zebra.Sdk.Comm.Connection.SimpleConnectionName"/>
</member>
<member name="P:Zebra.Sdk.Comm.BluetoothStatusConnection.MACAddress">
<summary>
Returns the MAC address which was passed into the constructor.
</summary>
<remarks>
The MAC address is a hexadecimal string with separators between the octets (e.g. 00:11:BB:DD:55:FF).
</remarks>
</member>
<member name="P:Zebra.Sdk.Comm.BluetoothStatusConnection.FriendlyName">
<summary>
Returns the friendly name of the Bluetooth&#174; connection.
</summary>
<remarks>
The friendly name is obtained from the device when this connection is opened. If the friendly name
changes on the device, it will not be refreshed until the connection is closed and reopened.
</remarks>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.BytesAvailable">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.ReadChar">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnection.Read(System.Int32)">
<inheritdoc/>
</member>
<member name="T:Zebra.Sdk.Comm.BluetoothStatusConnectionInsecure">
<summary>
Establishes a status only insecure Bluetooth&#174; connection to a Link-OS printer. (Windows 10 only)
</summary>
<remarks>
A <see cref="T:Zebra.Sdk.Comm.BluetoothConnection"/> must be actively open before this connection can be used.<br/>
This connection requires Link-OS firmware 2.5 or higher. This channel will not block the printing channel, nor can it print.
If you wish to print, see <see cref="T:Zebra.Sdk.Comm.BluetoothConnection"/>. Insecure Bluetooth&#174; connections do not require the device
and the printer to be paired.
</remarks>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/BluetoothStatusConnectionInsecureExample.cs"/></example>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnectionInsecure.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="connectionInfo"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
<exception cref="T:Zebra.Sdk.Comm.Internal.NotMyConnectionDataException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnectionInsecure.#ctor(System.String)">
<summary>
Constructs a new status only insecure Bluetooth&#174; connection with the given <c>macAddress</c>.
</summary>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the default timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The default timeout is a maximum of 5
seconds for any data to be received. If no more data is available after 500 milliseconds the read operation is
assumed to be complete.<br/>
To specify timeouts other than the defaults, use:<br/>
<see cref="M:Zebra.Sdk.Comm.BluetoothStatusConnectionInsecure.#ctor(System.String,System.Int32,System.Int32)"/>
<param name="macAddress"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.BluetoothStatusConnectionInsecure.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Constructs a new status only insecure Bluetooth&#174; connection with the given <c>macAddress</c> and timeout values.
</summary>
<remarks>
The MAC address is a hexadecimal string with or without separators between the octets (e.g. 00:11:BB:DD:55:FF or 0011BBDD55FF).
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The timeout is a maximum of
<c>maxTimeoutForRead</c> milliseconds for any data to be received. If no more data is available after <c>timeToWaitForMoreData</c>
milliseconds the read operation is assumed to be complete.
</remarks>
<param name="macAddress">The device's MAC address.</param>
<param name="maxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received.</param>
<param name="timeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the initial read.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="T:Zebra.Sdk.Comm.ConnectionBuilder">
<summary>
Builds a Connection from a description string. The description string is used to specify a connection to a specific
device over TCP, USB, or Bluetooth® (Windows 10 only).
</summary><remarks>
<para>
The description string may be of the explicit forms:<br /><br />
"TCP:192.168.1.4:6101" -- creates a TCP connection to the device with IP address 192.168.1.4 on port 6101.<br />
"TCP:192.168.1.4" -- creates a TCP connection to the device with IP address 192.168.1.4 on default port 9100.<br />
"TCP:dnsName:6101" -- creates a TCP connection to the device with 'dnsName' on port 6101.<br />
"TCP:dnsName" -- creates a TCP connection to the device with 'dnsName' on default port 9100.<br />
"TCP_MULTI:192.168.1.4" -- creates a Multichannel TCP connection to the device with '192.168.1.4' using the default ports for both the printing channel(9100) and the status channel(9200).<br />
"TCP_MULTI:192.168.1.4:1234" -- creates a Multichannel TCP connection to the device with '192.168.1.4' using the given port for the printing channel(1234) and the default port for the status channel(9200).<br />
"TCP_MULTI:192.168.1.4:1234:5678" -- creates a Multichannel TCP connection to the device with '192.168.1.4' using the given ports for the printing channel(1234) and the status channel(5678).<br />
"TCP_MULTI:dnsName:1234:5678" -- creates a Multichannel TCP connection to the device with 'dnsName' using the given ports for the printing channel(1234) and the status channel(5678).<br />
"TCP_STATUS:192.168.1.4:1234" -- creates a TCP status only connection to the device with IP address 192.168.1.4 on port 1234.<br />
"TCP_STATUS:192.168.1.4" -- creates a TCP status only connection to the device with IP address 192.168.1.4 on the default status port 9200.<br />
"USB:deviceName" -- creates a USB connection (through the ZebraDesigner driver) to the device with printer name 'deviceName'.<br />
"USB_DIRECT:\\?\usb#vid_0a5f&amp;pid_00bd#qln320#..." -- creates a USB connection (direct) to the device using '\\?\usb#vid_0a5f&amp;pid_00bd#qln320#...' as the USB symbolic name.<br />
"BT:11:22:33:44:55:66" -- creates a Bluetooth® connection to the device using '11:22:33:44:55:66' as the MAC address. (Windows 10 only)<br />
"BT_MULTI:11:22:33:44:55:66" -- creates a multichannel Bluetooth® connection to the device using '11:22:33:44:55:66' as the MAC address. (Link-OS 2.5 or higher for the status channel, Windows 10 only)<br />
"BT_STATUS:11:22:33:44:55:66" -- creates a status only Bluetooth® connection to the device using '11:22:33:44:55:66' as the MAC address. (Link-OS 2.5 or higher, Windows 10 only)<br />
</para>
Generic text may also be used to attempt to specify a device. For example a description string of "genericText" will
attempt to connect to a device using the following priority:
<list type="bullet">
<item>
<description>TCP_MULTI</description>
</item>
<item>
<description>TCP</description>
</item>
<item>
<description>TCP_STATUS</description>
</item>
<item>
<description>USB</description>
</item>
<item>
<description>USB_DIRECT</description>
</item>
<item>
<description>BT_MULTI</description>
</item>
<item>
<description>BT</description>
</item>
<item>
<description>BT_STATUS</description>
</item>
</list>
If you supply the string 'MyString'. This could be interpreted to be either a DNS name, or a USB device name.
ConnectionBuilder will attempt to connect to this string given the above priority order.
If you supply a more specific string, such as '192.168.2.3', ConnectionBuilder will more efficiently interpret this
string as being an IP address and, therefore, only attempt the TCP connections.<br />
Note: Colon (':') characters are not supported in dnsName, friendlyName, uniqueId, deviceName, or genericText fields.<br /><br />
The following is an example of building a connection from a string:
</remarks><example>
<code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/ConnectionBuilderExample.cs" />
</example>
</member>
<member name="M:Zebra.Sdk.Comm.ConnectionBuilder.#ctor">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.ConnectionBuilder.InitializeClasses">
<summary>
For internal use of the Zebra Printer API only.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.ConnectionBuilder.AddConnectionType(System.Object)">
<summary>
Add a connection type to the ConnectionBuilder.
</summary>
<param name="c">Connection class.</param>
</member>
<member name="M:Zebra.Sdk.Comm.ConnectionBuilder.Build(System.String)">
<summary>
Creates a Connection type based on the contents of <c>descriptionString</c>.
</summary><example>"TCP:192.168.1.2:9100"</example><param name="descriptionString">
The format of the input string is: [prefix:] address [: port_number(s)].<br /><br />
<ul>
<li>
Prefix is either TCP_MULTI, TCP, TCP_STATUS, USB (if applicable), USB_DIRECT (if applicable), BT_MULTI (if applicable),
BT (if applicable), or BT_STATUS (if applicable).
</li>
<li>
The format of address depends on the prefix
<ul>
<li>USB : address is the printer driver name.</li>
<li>USB_DIRECT : address is the USB symbolic name.</li>
<li>TCP : address is either a DNS name or an IPv4 address.</li>
<li>BT : address is the MAC address. (Windows 10 only)</li>
</ul>
</li>
<li>port_number(s) is optional, and only applicable for TCP connections.</li>
<li>
Examples:
<ul>
<li>TCP:ZBR3054027:9100</li>
<li>TCP_MULTI:ZBR3054027:9100:9200</li>
<li>USB:ZDesigner Qln320</li>
<li>USB_DIRECT:\\?\usb#vid_0a5f&amp;pid_00bd#qln320#...</li>
<li>BT:11:22:33:44:55:66</li>
<li>10.1.2.3</li>
</ul>
</li>
</ul>
</param><returns>Connection derived from the contents of descriptionString.</returns><exception cref="T:Zebra.Sdk.Comm.ConnectionException">If a connection could not be established for the given descriptionString.</exception>
</member>
<member name="T:Zebra.Sdk.Comm.DriverPrinterConnection">
<summary>
Establishes a USB connection to a printer.
</summary>
<remarks>This class is only supported on Windows PC platforms.</remarks>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/DriverPrinterConnectionExample.cs"/></example>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="connectionInfo">Information required to instantiate a DriverPrinterConnection</param>
<exception cref="T:Zebra.Sdk.Comm.Internal.NotMyConnectionDataException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.#ctor(System.String)">
<summary>
Initializes a new instance of the <c>DriverPrinterConnection</c> class.
</summary>
<remarks>
This constructor will use the default timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>.
The default timeout is a maximum of 5 seconds for any data to be received. If no more
data is available after 500 milliseconds the read operation is assumed to be complete.<br/>
To specify timeouts other than the defaults, use:<br/>
<see cref="M:Zebra.Sdk.Comm.DriverPrinterConnection.#ctor(System.String,System.Int32,System.Int32)"/>.
</remarks>
<param name="printerName">The printer name.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Initializes a new instance of the <c>DriverPrinterConnection</c> class.
</summary>
<remarks>
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>.
The timeout is a maximum of maxTimeoutForRead milliseconds for any data to be received.
If no more data is available after timeToWaitForMoreData milliseconds the read operation
is assumed to be complete.
</remarks>
<param name="printerName">The printer name.</param>
<param name="maxTimeoutForRead">The maximum milliseconds to wait for the initial data to be received.</param>
<param name="timeToWaitForMoreData">The maximum milliseconds to wait for additional data to be received.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="P:Zebra.Sdk.Comm.DriverPrinterConnection.PrinterName">
<summary>
Returns the name of the printer.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.Open">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.Close">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.Read">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.ReadChar">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.Write(System.Byte[],System.Int32,System.Int32)">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.BytesAvailable">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.ReadFromPrinter">
<summary>
</summary>
<returns></returns>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.ToString">
<summary>
Returns <c>USB</c>:[PrinterName].
</summary>
<remarks>The <c>PrinterName</c> is the parameter which was passed into the constructor.</remarks>
</member>
<member name="P:Zebra.Sdk.Comm.DriverPrinterConnection.SimpleConnectionName">
<summary>
Return the printer name as the description.
</summary>
<see cref="P:Zebra.Sdk.Comm.Connection.SimpleConnectionName"/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.GetConnectionReestablisher(System.Int64)">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.Dispose(System.Boolean)">
<summary>
</summary>
<param name="disposing"></param>
</member>
<member name="M:Zebra.Sdk.Comm.DriverPrinterConnection.Dispose">
<summary>
Releases all resources used by the <see cref="T:Zebra.Sdk.Comm.DriverPrinterConnection"/>
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothConnectionReestablisher.ReestablishConnection(Zebra.Sdk.Printer.PrinterReconnectionHandler)">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothDeviceHelper.GetBluetoothDevice(System.UInt64)">
<summary>
</summary>
<param name="btAddress"></param>
<returns></returns>
<exception cref="T:System.AggregateException"></exception>
<exception cref="T:System.ArgumentException"></exception>
<exception cref="T:System.ObjectDisposedException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothDeviceHelper.OpenConnection(System.String,System.Guid,Windows.Networking.Sockets.SocketProtectionLevel)">
<summary>
</summary>
<param name="macAddress"></param>
<param name="channelId"></param>
<param name="protectionLevel"></param>
<returns></returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothDeviceHelper.CheckRadioStatus">
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothDeviceHelper.GetFriendlyNameFromDevice(System.String)">
<summary>
</summary>
<param name="macAddress"></param>
<returns></returns>
<exception cref="T:System.ArgumentException"></exception>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothDeviceHelper.GetMacAddressFromDevice(Windows.Devices.Bluetooth.BluetoothDevice)">
<exception cref="T:System.ArgumentException"></exception>
<exception cref="T:System.Text.RegularExpressions.RegexMatchTimeoutException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothHelper.ConvertMacAddressToUlong(System.String)">
<summary>
</summary>
<param name="macAddress"></param>
<returns></returns>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothInsecureZebraConnectorImpl.Open">
<summary>
</summary>
<returns></returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothRadioHelper.IsEnabled">
<summary>
This does not work at the moment so do not use
</summary>
<returns></returns>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothRadioHelper.IsConnectable">
<summary>
This sort of works on desktop but only worked on tablet if the bt devices window was open
so do not use
</summary>
<returns></returns>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.BluetoothZebraConnectorImpl.Open">
<summary>
</summary>
<returns></returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.DriverConnectionReestablisher.ReestablishConnection(Zebra.Sdk.Printer.PrinterReconnectionHandler)">
<see cref="M:Zebra.Sdk.Comm.ConnectionReestablisher.ReestablishConnection(Zebra.Sdk.Printer.PrinterReconnectionHandler)"/>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbConnectionReestablisher.#ctor(Zebra.Sdk.Comm.Connection,System.Int64)">
<summary>
</summary>
<param name="c"></param>
<param name="thresholdTime"></param>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbConnectionReestablisher.ReestablishConnection(Zebra.Sdk.Printer.PrinterReconnectionHandler)">
<see cref="M:Zebra.Sdk.Comm.ConnectionReestablisher.ReestablishConnection(Zebra.Sdk.Printer.PrinterReconnectionHandler)"/>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbConnectionReestablisher.WaitForUsbPrinterToComeOnlineViaSgdAndGetFwVer">
<summary>
</summary>
<returns></returns>
<exception cref="T:System.TimeoutException"></exception>
<exception cref="T:Zebra.Sdk.Printer.ZebraPrinterLanguageUnknownException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.EnumeratePrinters">
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.EnumeratePrinters(Zebra.Sdk.Printer.Discovery.DiscoveredPrinterFilter)">
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.GetDiscoveredPrinter(System.String)">
<summary>
</summary>
<param name="symbolicName"></param>
<returns></returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.LoadDeviceIdMap(System.String,Zebra.Sdk.Comm.Usb.Direct.UsbDevice)">
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.LoadDeviceIdMap(System.String,Zebra.Sdk.Comm.Connection)">
<summary>
</summary>
<param name="symbolicName"></param>
<param name="connection"></param>
<returns></returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.AddSymbolicNameAttributesToMap(System.String,System.Collections.Generic.Dictionary{System.String,System.String}@)">
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.GetSerialNumberFromSymbolicName(System.String)">
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.GetProductId(System.String)">
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.Internal.UsbUtils.GetVendorId(System.String)">
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="F:Zebra.Sdk.Comm.Internal.ZebraBluetoothSocket.MAX_TIMEOUT">
<summary>
35 seconds was chosen for a Max Timeout so that if the pairing request is
ignored it will close and deny the pair before we hit the Max Timeout and close.
</summary>
</member>
<member name="T:Zebra.Sdk.Comm.MultichannelBluetoothConnection">
<summary>
Establishes a Bluetooth&#174; label and status connection to a printer. (Windows 10 only)
</summary>
<remarks>
In order to connect to a device with Bluetooth&#174;, the device must be discoverable,
authentication must be enabled, and the authentication pin must be set (1-16 alphanumeric characters).<br/>
The encryption type and whether or not it is used is determined by the device initiating the connection and not
the device being connected to.
</remarks>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Comm/Examples/BluetoothMultichannelConnectionExample.cs"/></example>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="connectionInfo"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(System.String)">
<summary>
Initializes a new instance of the <c>MultichannelBluetoothConnection</c> class.
</summary>
<remarks>
This constructor will use the default timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/>. The default timeout is a
maximum of 5 seconds for any data to be received. If no more data is available after 500 milliseconds the read
operation is assumed to be complete.<br/>
To specify timeouts other than the defaults, use:<br/>
<see cref="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(System.String,System.Int32,System.Int32)"/> or
<see cref="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(System.String,System.Int32,System.Int32,System.Int32,System.Int32)"/>.
</remarks>
<param name="macAddress">The MAC Address of the Printer.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Initializes a new instance of the <c>MultichannelBluetoothConnection</c> class.
</summary>
<remarks>
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/> for both channels.
The timeout is a maximum of <c>maxTimeoutForRead</c> milliseconds for any data to be received. If no more
data is available after <c>timeToWaitForMoreData</c> milliseconds the read operation is assumed to be complete.
If you wish to specify different timeouts for each channel, use
<see cref="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(System.String,System.Int32,System.Int32,System.Int32,System.Int32)"/>}.
</remarks>
<param name="macAddress">The MAC Address of the Printer.</param>
<param name="maxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received.</param>
<param name="timeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the initial read.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.#ctor(System.String,System.Int32,System.Int32,System.Int32,System.Int32)">
<summary>
Initializes a new instance of the <c>MultichannelBluetoothConnection</c> class.
</summary>
<remarks>
This constructor will use the specified timeouts for <see cref="M:Zebra.Sdk.Comm.Connection.Read"/> for the channels.
The timeout is a maximum of <c>printingChannelMaxTimeoutForRead/statusChannelMaxTimeoutForRead</c> milliseconds
for any data to be received on the printing/status channels respectively. If no more data is available after
<c>printingChannelTimeToWaitForMoreData/statusChannelTimeToWaitForMoreData</c> milliseconds on the printing/status
channels respectively the read operation is assumed to be complete.
</remarks>
<param name="macAddress">The MAC Address of the Printer.</param>
<param name="printingChannelMaxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received on
the printing channel.</param>
<param name="printingChannelTimeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the
initial read on the printing channel.</param>
<param name="statusChannelMaxTimeoutForRead">The maximum time, in milliseconds, to wait for any data to be received on
the status channel.</param>
<param name="statusChannelTimeToWaitForMoreData">The maximum time, in milliseconds, to wait in-between reads after the
initial read on the status channel.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.Open">
<summary>
Opens both the printing and status channel of this Multichannel connection.
</summary>
<remarks>
If neither channel can be opened, then a <see cref="T:Zebra.Sdk.Comm.ConnectionException"/> is thrown. When this Multichannel connection
is no longer needed, you must call <see cref="M:Zebra.Sdk.Comm.Connection.Close"/> to free up system resources.
</remarks>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If the connection cannot be established.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.Close">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.ToString">
<summary>
Returns <c>Bluetooth_MULTI</c>:[MAC Address]:[Friendly Name].
</summary>
<remarks>
The friendly name is obtained from the device when this connection is opened. If the friendly name changes on the
device, it will not be refreshed until the connection is closed and reopened.
</remarks>
<returns>Bluetooth_MULTI:[MAC Address]:[Friendly Name].</returns>
</member>
<member name="P:Zebra.Sdk.Comm.MultichannelBluetoothConnection.SimpleConnectionName">
<summary>
Return the MAC address as the description.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.MultichannelBluetoothConnection.Init(System.String,System.Int32,System.Int32,System.Int32,System.Int32)">
<summary>
</summary>
<param name="macAddress"></param>
<param name="printingChannelMaxTimeoutForRead"></param>
<param name="printingChannelTimeToWaitForMoreData"></param>
<param name="statusChannelMaxTimeoutForRead"></param>
<param name="statusChannelTimeToWaitForMoreData"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Unsupported operating system.</exception>
</member>
<member name="T:Zebra.Sdk.Comm.UsbConnection">
<summary>
Establishes a direct connection to an attached Zebra USB printer without requiring the presence of a USB driver.
</summary>
</member>
<member name="F:Zebra.Sdk.Comm.UsbConnection.symbolicName">
<summary>
The symbolic name of the printer.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.#ctor(System.String)">
<summary>
Initializes a new instance of the <c>UsbConnection</c> class.
</summary>
<remarks>This constructor will attempt a connection to the printer specified in the symbolic name.</remarks>
<param name="symbolicName">The USB symbolic name for the device returned by the UsbDiscoverer.GetZebraUsbPrinters() member function.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If the system is not running the Windows operating system or if the device cannot be found.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.#ctor(System.String,System.Int32,System.Int32)">
<summary>
Initializes a new instance of the <c>UsbConnection</c> class.
</summary>
<remarks>This constructor will attempt a connection to the printer specified in the symbolic name.</remarks>
<param name="symbolicName">The USB symbolic name for the device returned by the UsbDiscoverer.GetZebraUsbPrinters() member function.</param>
<param name="maxTimeoutForRead">Maximum time to wait for read data</param>
<param name="timeToWaitForMoreData">Maximum time to wait for more data after intial data is sent from printer</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If the system is not running the Windows operating system or if the device cannot be found.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.CreateUsbConnection(System.String,System.Int32,System.Int32)">
<summary>
</summary>
<param name="symbolicName"></param>
<param name="maxTimeoutForRead"></param>
<param name="timeToWaitForMoreData"></param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.#ctor(Zebra.Sdk.Comm.Internal.ConnectionInfo)">
<summary>
Initializes a new instance of the <c>UsbConnection</c> class.
</summary>
<remarks>This constructor will attempt a connection to a printer that meets the connectionInfo criteria</remarks>
<param name="connectionInfo">Printer serial number or model number</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">Printer connection error</exception>
<exception cref="T:Zebra.Sdk.Comm.Internal.NotMyConnectionDataException">Cannot find specified device among attached devices</exception>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.Open">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.OpenPrinter">
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.Close">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.Write(System.Byte[])">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.Write(System.Byte[],System.Int32,System.Int32)">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.ReadChar">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.Read(System.Int32)">
<summary>
Reads up to maxBytesToRead into byte array
</summary>
<param name="maxBytesToRead">The maximum number of bytes to read.</param>
<remarks>Performing reads using DriverPrinterConnection and UsbConnection concurrently could cause indeterminate reads.</remarks>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.BytesAvailable">
<summary>
Returns number of bytes currently read from printer.
</summary>
<returns>Number of bytes currently read from printer.</returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If an I/O error occurs.</exception>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.LoadDeviceMap">
<exception cref="T:Zebra.Sdk.Comm.ConnectionException"></exception>
</member>
<member name="P:Zebra.Sdk.Comm.UsbConnection.SimpleConnectionName">
<inheritdoc/>
</member>
<member name="P:Zebra.Sdk.Comm.UsbConnection.SerialNumber">
<summary>
Gets the printer's serial number.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.ToString">
<summary>
Returns the Connection Builder name of the USB device.
</summary>
</member>
<member name="M:Zebra.Sdk.Comm.UsbConnection.GetConnectionReestablisher(System.Int64)">
<inheritdoc/>
</member>
<member name="P:Zebra.Sdk.Comm.UsbConnection.MaxTimeoutForRead">
<inheritdoc/>
</member>
<member name="P:Zebra.Sdk.Comm.UsbConnection.Manufacturer">
<summary>
Returns printer's manufacturer.
</summary>
</member>
<member name="M:Zebra.Sdk.Graphics.Internal.PngToGrfConverter.PngToGrf(System.IO.Stream)">
<summary>
</summary>
<param name="pngData"></param>
<returns></returns>
<exception cref="T:System.IO.IOException"></exception>
</member>
<member name="M:Zebra.Sdk.Graphics.Internal.ZebraImage.#ctor(System.Drawing.Image)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="image"></param>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:Zebra.Sdk.Graphics.Internal.ZebraImage.#ctor(System.String)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="imageFilePath"></param>
<exception cref="T:System.ArgumentException"></exception>
<exception cref="T:System.IO.IOException"></exception>
</member>
<member name="M:Zebra.Sdk.Graphics.Internal.ZebraImage.#ctor(System.IO.Stream)">
<summary>
For internal use of the Zebra Printer API only.
</summary>
<param name="imageStream"></param>
<exception cref="T:System.ArgumentException"></exception>
<exception cref="T:System.IO.IOException"></exception>
</member>
<member name="T:Zebra.Sdk.Graphics.ZebraImageFactory">
<summary>
A factory used to acquire an instance of a ZebraImageI.
</summary>
</member>
<member name="M:Zebra.Sdk.Graphics.ZebraImageFactory.GetImage(System.Drawing.Image)">
<summary>
Creates an instance of <see cref="T:Zebra.Sdk.Graphics.ZebraImageI"/> from the image specified in <c>image</c>.
</summary>
<param name="image">The image</param>
<returns>An image formatted for Zebra Printers</returns>
<exception cref="T:System.IO.IOException">If the file could not be found, open, or is an unsupported graphic.</exception>
<exception cref="T:System.ArgumentException">If <c>image</c> is null</exception>
</member>
<member name="M:Zebra.Sdk.Graphics.ZebraImageFactory.GetImage(System.String)">
<summary>
Creates an instance of <see cref="T:Zebra.Sdk.Graphics.ZebraImageI"/> from the image specified in <c>fullPath</c>.
</summary>
<param name="fullPath">The full path of the image.</param>
<returns>An image formatted for Zebra Printers</returns>
<exception cref="T:System.IO.IOException">If the file could not be found, open, or is an unsupported graphic.</exception>
<exception cref="T:System.ArgumentException">If <c>fullPath</c> is null</exception>
</member>
<member name="M:Zebra.Sdk.Graphics.ZebraImageFactory.GetImage(System.IO.Stream)">
<summary>
Creates an instance of <see cref="T:Zebra.Sdk.Graphics.ZebraImageI"/> from the image data specified in <c>imageData</c>
</summary>
<param name="imageData">A stream containing the image data.</param>
<returns>An image formatted for Zebra Printers.</returns>
<exception cref="T:System.IO.IOException">If the file could not be found, open, or is an unsupported graphic.</exception>
<exception cref="T:System.ArgumentException">If <c>imageData</c> is null</exception>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.BluetoothDiscoverer">
<summary>
A class that discovers Bluetooth&#174; devices.
</summary>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Discovery/Examples/BluetoothDiscovererExample.cs"/></example>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.BluetoothDiscoverer.FindPrinters(Zebra.Sdk.Printer.Discovery.DiscoveryHandler)">
<summary>
Find Bluetooth&#174; devices that are discoverable.
</summary>
<remarks>This method will return all devices found, not just Zebra printers.</remarks>
<param name="discoveryHandler">A <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveryHandler"/> instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">For communication or discovery errors.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.BluetoothDiscoverer.FindPrinters(Zebra.Sdk.Printer.Discovery.DiscoveryHandler,System.Int32)">
<summary>
Find Bluetooth&#174; devices that are discoverable.
</summary>
<remarks>This method will return all devices found, not just Zebra printers.</remarks>
<param name="discoveryHandler">A <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveryHandler"/> instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).</param>
<param name="waitForResponsesTimeout">Time to wait, in milliseconds, before determining that there are no more discovery responses.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">For communication or discovery errors.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.BluetoothDiscoverer.FindPrinters(Zebra.Sdk.Printer.Discovery.DiscoveryHandler,Zebra.Sdk.Printer.Discovery.DeviceFilter)">
<summary>
Find Bluetooth&#174; devices that are discoverable.
</summary>
<remarks>This method will return all devices found, not just Zebra printers.</remarks>
<param name="discoveryHandler">A <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveryHandler"/> instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).</param>
<param name="deviceFilter">A custom <see cref="T:Zebra.Sdk.Printer.Discovery.DeviceFilter"/> instance used to determine whether or not a discovered device should be ignored.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">For communication or discovery errors.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.BluetoothDiscoverer.FindPrinters(Zebra.Sdk.Printer.Discovery.DiscoveryHandler,Zebra.Sdk.Printer.Discovery.DeviceFilter,System.Int32)">
<summary>
Find Bluetooth&#174; devices that are discoverable.
</summary>
<remarks>This method will return all devices found, not just Zebra printers.</remarks>
<param name="discoveryHandler">A <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveryHandler"/> instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).</param>
<param name="deviceFilter">A custom <see cref="T:Zebra.Sdk.Printer.Discovery.DeviceFilter"/> instance used to determine whether or not a discovered device should be ignored.</param>
<param name="waitForResponsesTimeout">Time to wait, in milliseconds, before determining that there are no more discovery responses.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">For communication or discovery errors.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.BluetoothDiscoverer.FindServices(System.String,Zebra.Sdk.Printer.Discovery.ServiceDiscoveryHandler)">
<summary>
Find services (ConnectionChannels) that are supported by the device at <c>macAddress</c>.
</summary>
<param name="macAddress">MAC address of the device.</param>
<param name="serviceDiscoveryHandler">A <see cref="T:Zebra.Sdk.Printer.Discovery.ServiceDiscoveryHandler"/> instance that is used to handle service discovery events.</param>
<exception cref="T:System.ArgumentException">The Bluetooth MAC address is invalid.</exception>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.DeviceFilter">
<summary>
DeviceFilter is an interface to allow the user to write custom code to determine whether or not the
BluetoothDiscoverer should include a particular BluetoothDevice in it's result set.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DeviceFilter.ShouldAddPrinter(Windows.Devices.Bluetooth.BluetoothDevice)">
<summary>
Method called by a BluetoothDiscoverer to determine whether or not a Bluetooth&#174; device should be added to
it's list of discovered devices.
</summary>
<param name="device">BluetoothDevice to potentially be added to the list of of discovered Bluetooth&#174; devices.</param>
<returns>A bool indicating whether or not a particular BluetoothDevice should be added.</returns>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterBluetooth">
<summary>
Instance of DiscoveredPrinter that is returned when performing a Bluetooth&#174; discovery.
</summary>
</member>
<member name="F:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterBluetooth.friendlyName">
<summary>
The friendly name of the Bluetooth&#174; device.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterBluetooth.#ctor(System.String,System.String)">
<summary>
Returns an instance of a DiscoveredPrinterBluetooth with <c>macAddress</c>.
</summary>
<param name="macAddress">MAC address of the printer.</param>
<param name="friendlyName">Friendly name of the printer.</param>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterBluetooth.GetConnection">
<inheritdoc/>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterDriver">
<summary>
Instance of <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveredPrinter"/> that is returned when performing a Driver Discovery.
</summary>
</member>
<member name="P:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterDriver.PrinterName">
<summary>
Local printer name associated with the driver.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterDriver.#ctor(System.String,System.String,System.Collections.Generic.List{System.String})">
<summary>
Returns an instance of a <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveredPrinter"/> with <c>printerName</c>, <c>driverName</c>,
and <c>portNames</c>.
</summary>
<param name="printerName">The printer name.</param>
<param name="driverName">The name of the ZebraDesigner driver.</param>
<param name="portNames">The port name.</param>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterDriver.ToString">
<summary>
Returns the name of the printer.
</summary>
<returns>The printer name.</returns>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterDriver.GetConnection">
<inheritdoc/>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.DiscoveredUsbPrinter">
<summary>
Instance of <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveredPrinter"/> that is returned when performing a search of currently connected Zebra USB printers.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredUsbPrinter.#ctor(System.String)">
<summary>
Returns an instance of a <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveredUsbPrinter"/> built using built using the provided <c>symbolicName</c>.
</summary>
<param name="symbolicName">The symbolic name for the printer returned by
<see cref="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraUsbPrinters"/> or <see cref="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraUsbPrinters(Zebra.Sdk.Printer.Discovery.DiscoveredPrinterFilter)"/>.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If a connection to the discover USB printer cannot be established.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredUsbPrinter.#ctor(System.String,System.Collections.Generic.Dictionary{System.String,System.String})">
<summary>
Returns an instance of a <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveredUsbPrinter"/> built using the provided <c>symbolicName</c> and
<c>attributes</c>.
</summary>
<param name="symbolicName">The symbolic name for the printer returned by
<see cref="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraUsbPrinters"/> or <see cref="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraUsbPrinters(Zebra.Sdk.Printer.Discovery.DiscoveredPrinterFilter)"/>.</param>
<param name="attributes">A map of attributes associated with the discovered USB printer.</param>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If a connection to the discover USB printer cannot be established.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.DiscoveredUsbPrinter.GetConnection">
<inheritdoc/>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.Internal.DiscoveryUtilities.HasCardPrinterModelPrefix(System.String)">
<exception cref="T:System.ArgumentNullException"/>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.Internal.DiscoveryUtilities.IsCardPrinterCmdId(Zebra.Sdk.Printer.Discovery.DiscoveredPrinter)">
<exception cref="T:System.ArgumentNullException"/>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.ServiceDiscoveryHandler">
<summary>
Interface definition for a callback to be invoked for service discovery events.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.ServiceDiscoveryHandler.FoundService(Zebra.Sdk.Comm.ConnectionChannel)">
<summary>
This method is invoked when a service has been discovered. This method will be invoked for each service that is found.
</summary>
<param name="channel">A discovered channel.</param>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.ServiceDiscoveryHandler.DiscoveryFinished">
<summary>
This method is invoked when discovery is finished.
</summary>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.UrlPrinterDiscoverer">
<summary>
A class used to discover a printer described by a URL. (Windows 10 only)
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UrlPrinterDiscoverer.FindPrinters(System.String,Zebra.Sdk.Printer.Discovery.DiscoveryHandler)">
<summary>
This method will search using a combination of discovery methods to find the printer described by the specified URL. (Windows 10 only)
</summary>
<remarks>
This method will invoke the <see cref="M:Zebra.Sdk.Printer.Discovery.DiscoveryHandler.FoundPrinter(Zebra.Sdk.Printer.Discovery.DiscoveredPrinter)"/> method for each interface that
the specified printer is found. <see cref="M:Zebra.Sdk.Printer.Discovery.DiscoveryHandler.DiscoveryFinished"/> will be invoked when the discovery is
finished and <see cref="M:Zebra.Sdk.Printer.Discovery.DiscoveryHandler.DiscoveryError(System.String)"/> will be invoked when any errors are encountered during
discovery. When <see cref="M:Zebra.Sdk.Printer.Discovery.DiscoveryHandler.DiscoveryError(System.String)"/> is invoked, the discovery will be canceled and
<see cref="M:Zebra.Sdk.Printer.Discovery.DiscoveryHandler.DiscoveryFinished"/> will not be invoked.<br/><br/>
This method will typically be used when reading an NFC tag attached to a Zebra printer. To launch your app when a
Zebra NFC tag is read:<br/>
<ul>
<li>Register to listen for Zebra NFC Tag scans in your application</li>
<li>Handle the NFC scan in your application</li>
</ul>
</remarks>
<param name="url">The URL describing the targeted printer (Typically, this information is encoded on an NFC tag attached
to the printer)<br/>
Example:<br/>
"http://www.zebra.com/apps/r/nfc?mBL=00225832C75F&amp;mW=000000000000&amp;mE=000000000000&amp;c=QN3-AUBA0E01-00&amp;s=XXQLJ112600422&amp;v=0"</param>
<param name="discoveryHandler">A <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveryHandler"/> instance that is used to handle discovery events (e.g. found a
printer, errors, discovery finished).</param>
<exception cref="T:Zebra.Sdk.Printer.Discovery.DiscoveryException">If an error occurs while starting the discovery (errors during discovery will be sent
via <see cref="M:Zebra.Sdk.Printer.Discovery.DiscoveryHandler.DiscoveryError(System.String)"/>).</exception>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Discovery/Examples/UrlPrinterDiscovererExample.cs"/></example>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.UsbDiscoverer">
<summary>
A class used to discover USB connected Zebra printers. Printers can be accessed directly or through a Zebra Designer
printer driver if your printer supports the driver.
</summary>
<example><code source="../SdkApi_Test/Test/Zebra/Sdk/Discovery/Examples/UsbDiscovererExample.cs"/></example>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.#ctor">
<summary>
A class used to discover USB connected Zebra printers. Printers can be accessed either directly or through a USB
printer driver.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraDriverPrinters">
<summary>
Enumerate locally installed Zebra Designer Drivers.
</summary>
<returns>List of ZebraDesigner drivers installed.</returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If the system is not running the Windows operating system or an error occurs during discovery.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraUsbPrinters">
<summary>
Enumerate all currently connected Zebra USB printers.
</summary>
<returns>List of locally connected Zebra USB printers.</returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If the system is not running the Windows operating system or an error occurs during discovery.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.GetZebraUsbPrinters(Zebra.Sdk.Printer.Discovery.DiscoveredPrinterFilter)">
<summary>
Enumerate currently connected Zebra USB printers that meet the specified DiscoveredPrinterFilter criteria.
</summary>
<param name="discoveredPrinterFilter">A custom <see cref="T:Zebra.Sdk.Printer.Discovery.DiscoveredPrinterFilter"/> instance used to determine whether or not a discovered device should be ignored.</param>
<returns>>List of locally connected Zebra USB printers.</returns>
<exception cref="T:Zebra.Sdk.Comm.ConnectionException">If the system is not running the Windows operating system or an error occurs during discovery.</exception>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.PrinterIsOnUsbPort(Zebra.Sdk.Printer.Discovery.DiscoveredPrinterDriver)">
<summary>
For Zebra Internal Use Only.
</summary>
<param name="discoPrinter"></param>
<returns></returns>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.UsbDiscoverer.CreateDiscoveredPrinterDriver(System.String)">
<summary>
For Zebra Internal Use Only.
</summary>
<param name="printer"></param>
<returns></returns>
</member>
<member name="T:Zebra.Sdk.Printer.Discovery.ZebraPrinterFilter">
<summary>
DiscoveredPrinterFilter implementation that filters out all unsupported Zebra Printers.
</summary>
</member>
<member name="M:Zebra.Sdk.Printer.Discovery.ZebraPrinterFilter.ShouldAddPrinter(Zebra.Sdk.Printer.Discovery.DiscoveredPrinter)">
<summary>
Determines if the <c>discoveredPrinter</c> is a supported Zebra Printer.
</summary>
<param name="discoveredPrinter">The discovered printer.</param>
<returns>True if the discoveredPrinter is a supported Zebra Printer.</returns>
</member>
<member name="T:Zebra.Sdk.Remote.Discovery.ConnectionHandlerI">
<summary>
Handler class used to notify of connection status
</summary>
</member>
<member name="M:Zebra.Sdk.Remote.Discovery.ConnectionHandlerI.ConnectionEstablished(Zebra.Sdk.Printer.Discovery.DiscoveredPrinter)">
<summary>
Called when a printer establishes a connection.
</summary>
<param name="printer">Printer which just established a connection.</param>
</member>
<member name="M:Zebra.Sdk.Remote.Discovery.ConnectionHandlerI.ConnectionRemoved(Zebra.Sdk.Printer.Discovery.DiscoveredPrinter)">
<summary>
Called when a printer goes offline.
</summary>
<param name="printer">Printer which just went offline.</param>
</member>
<member name="M:Zebra.Sdk.Remote.Discovery.ConnectionHandlerI.RemoveConnectionHandler">
<summary>
Removes the Connection handler from the runtime.
</summary>
</member>
</members>
</doc>
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<Application x:Class="DeveloperDemo_Windows.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style x:Key="ZebraHeader" TargetType="TextBlock">
<Setter Property="Foreground" Value="#007CB0" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style x:Key="ZebraTextInput" TargetType="TextBox">
<Setter Property="FontSize" Value="12" />
<Setter Property="Height" Value="24" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style TargetType="ComboBox">
<Setter Property="Height" Value="30" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style x:Key="DashedLineFocusVisualStyle">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2"
StrokeThickness="1"
Stroke="Black"
StrokeDashArray="2 2"
SnapsToDevicePixels="true"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button">
<Setter Property="Background" Value="#007CB0" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="Height" Value="24" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FocusVisualStyle" Value="{StaticResource DashedLineFocusVisualStyle}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3396C0" />
<Setter Property="Opacity" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
</Application.Resources>
</Application>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Windows;
namespace Zebra.Windows.DevDemo {
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.ConnectionBuilder.ConnectionBuilderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.ConnectionBuilder"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:ConnectionBuilderViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Grid.ColumnSpan="2" Margin="0,0,0,10">Connection Builder</TextBlock>
<TextBlock Grid.Row="1" Name="AddressTextBlock" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,10">Address:</TextBlock>
<TextBox x:Name="usbDriverIpAddress" Style="{StaticResource ZebraTextInput}" Grid.Row="1" Grid.Column="1" Margin="0,0,0,10" VerticalAlignment="Center" KeyUp="UsbDriverIpAddress_KeyUp" />
<TextBlock Grid.Row="2" Margin="0,0,10,10" VerticalAlignment="Center">Connection Prefix:</TextBlock>
<ComboBox x:Name="connectionPrefixDropdown" ItemsSource="{Binding ConnectionPrefixes}" Width="180" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,10" SelectionChanged="ConnectionPrefixDropdown_SelectionChanged" />
<TextBlock Grid.Row="3" Margin="0,0,10,15" VerticalAlignment="Center">Connection String:</TextBlock>
<TextBlock x:Name="connectionString" Grid.Row="3" Grid.Column="1" Margin="0,0,0,15" VerticalAlignment="Center" />
<Button x:Name="testConnectionStringButton" Grid.Row="4" Grid.ColumnSpan="2" Click="TestConnectionStringButton_Click">Test Connection String</Button>
<Separator Grid.Row="5" Grid.ColumnSpan="2" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="6" Grid.ColumnSpan="2" Margin="0,0,0,10">Log</TextBlock>
<TextBox x:Name="logData" Text="{Binding LogData}" Grid.Row="7" Grid.ColumnSpan="2" AcceptsReturn="True" TextWrapping="NoWrap" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
using ZebraConnectionBuilder = Zebra.Sdk.Comm.ConnectionBuilder;
using ZebraPrinterStatus = Zebra.Sdk.Printer.PrinterStatus;
namespace Zebra.Windows.DevDemo.Demos.ConnectionBuilder {
/// <summary>
/// Interaction logic for ConnectionBuilderView.xaml
/// </summary>
public partial class ConnectionBuilderView : UserControl {
private ConnectionBuilderViewModel viewModel;
private Connection connection = null;
public ConnectionBuilderView() {
InitializeComponent();
viewModel = DataContext as ConnectionBuilderViewModel;
}
private void TestConnectionString() {
Task.Run(() => {
try {
ClearProgress();
connection = ZebraConnectionBuilder.Build(GetConnectionStringForSdk());
PublishProgress("Connection string evaluated as class type " + connection.GetType().Name);
connection.Open();
PublishProgress("Connection opened successfully");
if (IsAttemptingStatusConnection()) {
ZebraPrinterLinkOs printer = ZebraPrinterFactory.GetLinkOsPrinter(connection);
PublishProgress("Created a printer, attempting to retrieve status");
ZebraPrinterStatus status = printer.GetCurrentStatus();
PublishProgress("Is printer ready to print? " + status.isReadyToPrint);
} else {
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);
PublishProgress("Created a printer, attempting to print a config label");
printer.PrintConfigurationLabel();
}
PublishProgress("Closing connection");
} catch (ConnectionException) {
MessageBoxCreator.ShowError("Connection could not be opened", "Error");
} catch (ZebraPrinterLanguageUnknownException) {
MessageBoxCreator.ShowError("Could not create printer", "Error");
} finally {
if (connection != null) {
try {
connection.Close();
} catch (ConnectionException) { } finally {
connection = null;
SetTestButtonState(true);
}
} else {
SetTestButtonState(true);
}
}
});
}
private void SetTestButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
testConnectionStringButton.IsEnabled = state;
});
}
private void ClearProgress() {
Application.Current.Dispatcher.Invoke(() => {
logData.Text = "Log:\nTesting string: " + GetConnectionStringForSdk() + "\n";
});
}
private string GetConnectionStringForSdk() {
string finalConnectionString = "";
Application.Current.Dispatcher.Invoke(() => {
string selectedPrefix = "";
if (connectionPrefixDropdown.SelectedIndex > 0) {
selectedPrefix = connectionPrefixDropdown.SelectedValue + ":";
}
string userSuppliedDescriptionString = usbDriverIpAddress.Text;
finalConnectionString = selectedPrefix + userSuppliedDescriptionString;
});
return finalConnectionString;
}
private bool IsAttemptingStatusConnection() {
return connection.GetType().Name.Contains("Status");
}
private void PublishProgress(string progress) {
Application.Current.Dispatcher.Invoke(() => {
logData.Text = logData.Text + progress + Environment.NewLine;
});
}
private void ConnectionPrefixDropdown_SelectionChanged(object sender, SelectionChangedEventArgs e) {
connectionString.Text = GetConnectionStringForSdk();
SetAddressTextBlock();
}
private void SetAddressTextBlock() {
switch(connectionPrefixDropdown.SelectedValue) {
case ConnectionPrefix.Tcp:
case ConnectionPrefix.TcpMulti:
case ConnectionPrefix.TcpStatus:
AddressTextBlock.Text = "IP Address:";
break;
case ConnectionPrefix.Bluetooth:
case ConnectionPrefix.BluetoothMulti:
AddressTextBlock.Text = "BT Address:";
break;
case ConnectionPrefix.Usb:
AddressTextBlock.Text = "USB Driver:";
break;
case ConnectionPrefix.UsbDirect:
AddressTextBlock.Text = "Symbolic Name:";
break;
default:
AddressTextBlock.Text = "Address:";
break;
};
}
private void TestConnectionStringButton_Click(object sender, RoutedEventArgs e) {
try {
viewModel.LogData = "Log:\n\n";
SetTestButtonState(false);
TestConnectionString();
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Connection Builder Error");
}
}
private void UsbDriverIpAddress_KeyUp(object sender, KeyEventArgs e) {
connectionString.Text = GetConnectionStringForSdk();
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Collections.ObjectModel;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.ConnectionBuilder {
public class ConnectionBuilderViewModel : IDemoViewModel {
private string logData;
private ObservableCollection<string> connectionPrefixes = new ObservableCollection<string>() {
ConnectionPrefix.None,
ConnectionPrefix.TcpMulti,
ConnectionPrefix.Tcp,
ConnectionPrefix.TcpStatus,
ConnectionPrefix.Usb,
ConnectionPrefix.UsbDirect
};
public string LogData {
get => logData;
set {
if (logData != value) {
logData = value;
OnPropertyChanged();
}
}
}
public ObservableCollection<string> ConnectionPrefixes {
get => connectionPrefixes;
}
public ConnectionBuilderViewModel() {
Name = "Connection Builder";
logData = "Log:\n\n";
if(BluetoothHelper.IsBluetoothSupported()) {
connectionPrefixes.Add(ConnectionPrefix.Bluetooth);
connectionPrefixes.Add(ConnectionPrefix.BluetoothMulti);
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.ConnectionBuilder {
public class ConnectionPrefix {
public const string None = "";
public const string TcpMulti = "TCP_MULTI";
public const string Tcp = "TCP";
public const string TcpStatus = "TCP_STATUS";
public const string Usb = "USB";
public const string UsbDirect = "USB_DIRECT";
public const string Bluetooth = "BT";
public const string BluetoothMulti = "BT_MULTI";
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.Connectivity.ConnectivityView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Connectivity</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Margin="0,0,0,15" />
<Button x:Name="testButton" Click="TestButton_Click">Test</Button>
<Separator Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Connection Status</TextBlock>
<TextBlock><Bold><Run x:Name="connectionStatus" Foreground="Red" Text="Not Connected"></Run></Bold></TextBlock>
</StackPanel>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
using Zebra.Sdk.Printer.Discovery;
using Zebra.Windows.DevDemo.Enums;
namespace Zebra.Windows.DevDemo.Demos.Connectivity {
/// <summary>
/// Interaction logic for Connectivity.xaml
/// </summary>
public partial class ConnectivityView : UserControl {
public ConnectivityView() {
InitializeComponent();
}
private async void TestButton_Click(object sender, RoutedEventArgs e) {
SetTestButtonState(false);
Connection printerConnection = null;
if (connectionSelector.ConnectionType == ConnectionType.Network) {
try {
printerConnection = connectionSelector.GetConnection();
} catch (ConnectionException) {
UpdateStatusBarOnGui("Invalid Address and/or Port", ConnectionState.Error);
await Task.Delay(1000);
UpdateStatusBarOnGui("Not Connected", ConnectionState.Error);
return;
}
} else if (connectionSelector.ConnectionType == ConnectionType.Bluetooth) {
try {
printerConnection = connectionSelector.GetConnection();
} catch (ConnectionException) {
UpdateStatusBarOnGui("Invalid Mac Address", ConnectionState.Error);
await Task.Delay(1000);
UpdateStatusBarOnGui("Not Connected", ConnectionState.Error);
}
} else if (connectionSelector.SelectedUsbPrinter is DiscoveredPrinterDriver printer) {
try {
printerConnection = new DriverPrinterConnection(printer.PrinterName);
} catch (ConnectionException) {
return;
}
} else if (connectionSelector.ConnectionType == ConnectionType.UsbDirect) {
try {
printerConnection = connectionSelector.GetConnection();
} catch (ConnectionException) {
UpdateStatusBarOnGui("Invalid Address", ConnectionState.Error);
await Task.Delay(1000);
UpdateStatusBarOnGui("Not Connected", ConnectionState.Error);
return;
}
} else {
return;
}
await Task.Run(async () => {
try {
UpdateStatusBarOnGui("Connecting...", ConnectionState.Progress);
await Task.Delay(1500);
printerConnection.Open();
UpdateStatusBarOnGui("Connected", ConnectionState.Success);
await Task.Delay(1500);
UpdateStatusBarOnGui("Determining Printer Language...", ConnectionState.Progress);
await Task.Delay(1500);
PrinterLanguage printerLanguage = ZebraPrinterFactory.GetInstance(printerConnection).PrinterControlLanguage;
UpdateStatusBarOnGui("Printer Language " + printerLanguage.ToString(), ConnectionState.Info);
await Task.Delay(1500);
UpdateStatusBarOnGui("Sending Data...", ConnectionState.Progress);
printerConnection.Write(GetConfigLabel(printerLanguage));
} catch (ConnectionException) {
UpdateStatusBarOnGui("Communications Error", ConnectionState.Error);
} catch (ZebraPrinterLanguageUnknownException) {
UpdateStatusBarOnGui("Invalid Printer Language", ConnectionState.Error);
} finally {
try {
await Task.Delay(1000);
UpdateStatusBarOnGui("Disconnecting...", ConnectionState.Progress);
if (printerConnection != null) {
printerConnection.Close();
}
await Task.Delay(1000);
UpdateStatusBarOnGui("Not Connected", ConnectionState.Error);
} catch (ConnectionException) {
} finally {
SetTestButtonState(true);
}
}
});
}
private void SetTestButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
testButton.IsEnabled = state;
});
}
private Brush GetBrushFromConnectionState(ConnectionState connectionState) {
switch (connectionState) {
case ConnectionState.Success:
return Brushes.Green;
case ConnectionState.Progress:
return Brushes.Goldenrod;
case ConnectionState.Info:
return Brushes.Blue;
case ConnectionState.Error:
default:
return Brushes.Red;
}
}
private void UpdateStatusBarOnGui(string statusMessage, ConnectionState connectionState) {
Application.Current.Dispatcher.Invoke(() => {
connectionStatus.Foreground = GetBrushFromConnectionState(connectionState);
connectionStatus.Text = statusMessage;
});
}
/*
* Returns the command for a test label depending on the printer control language
* The test label is a box with the word "TEST" inside of it
*
* _________________________
* | |
* | |
* | TEST |
* | |
* | |
* |_______________________|
*
*/
private byte[] GetConfigLabel(PrinterLanguage printerLanguage) {
byte[] configLabel = null;
if (printerLanguage == PrinterLanguage.ZPL) {
configLabel = Encoding.UTF8.GetBytes("^XA^FO17,16^GB379,371,8^FS^FT65,255^A0N,135,134^FDTEST^FS^XZ");
} else if (printerLanguage == PrinterLanguage.CPCL) {
string cpclConfigLabel = "! 0 200 200 406 1\r\n" + "ON-FEED IGNORE\r\n" + "BOX 20 20 380 380 8\r\n" + "T 0 6 137 177 TEST\r\n" + "PRINT\r\n";
configLabel = Encoding.UTF8.GetBytes(cpclConfigLabel);
}
return configLabel;
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.Connectivity {
public class ConnectivityViewModel : IDemoViewModel {
public ConnectivityViewModel() {
Name = "Connectivity";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.Discovery.DiscoveryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.Discovery"
xmlns:utils="clr-namespace:Zebra.Windows.DevDemo.Utils"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:DiscoveryViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<utils:DiscoveryMethodDescriptionValueConverter x:Key="converter" />
</UserControl.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Discovery</TextBlock>
<Grid Grid.Row="1" Margin="0,0,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center">Discovery Method:</TextBlock>
<ComboBox x:Name="discoveryMethodsDropdown" ItemsSource="{Binding DiscoveryMethods}" Grid.Column="1" Width="160" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="DiscoveryMethodsDropdown_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<ContentPresenter Content="{Binding Converter={StaticResource converter}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock x:Name="ipAddressLabel" Grid.Row="1" Margin="0,10,10,0" VerticalAlignment="Center">IP Address:</TextBlock>
<TextBox x:Name="ipAddressInput" Style="{StaticResource ZebraTextInput}" Text="{Binding IpAddress}" Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBlock x:Name="numberOfHopsLabel" Grid.Row="2" Margin="0,10,10,0" VerticalAlignment="Center">Number of Hops:</TextBlock>
<TextBox x:Name="numberOfHopsInput" Style="{StaticResource ZebraTextInput}" Text="{Binding NumberOfHops}" Grid.Row="2" Grid.Column="1" Margin="0,10,0,0" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" PreviewTextInput="NumberOfHopsInput_PreviewTextInput" />
<TextBlock x:Name="subnetRangeLabel" Grid.Row="3" Margin="0,10,10,0" VerticalAlignment="Center">Subnet Range:</TextBlock>
<TextBox x:Name="subnetRangeInput" Style="{StaticResource ZebraTextInput}" Text="{Binding SubnetRange}" Grid.Row="3" Grid.Column="1" Margin="0,10,0,0" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" />
</Grid>
<Button Grid.Row="2" x:Name="discoverPrintersButton" Click="DiscoverPrintersButton_Click">Discover Printers</Button>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Grid.ColumnSpan="2" Margin="0,0,0,10">Discovered Printers</TextBlock>
<ListBox x:Name="discoveredPrintersList" ItemsSource="{Binding DiscoveredPrinters}" Grid.Row="1" Margin="0,0,5,0" SelectionChanged="DiscoveredPrintersList_SelectionChanged">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Copy" Click="DiscoveredPrintersList_Click"/>
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
<TextBox x:Name="discoveredPrinterInfo" Text="{Binding DiscoveredPrinterInfo}" Grid.Row="1" Grid.Column="1" Margin="5,0,0,0" AcceptsReturn="True" TextWrapping="NoWrap" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>
</Grid>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Printer.Discovery;
using Zebra.Windows.DevDemo.Enums;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.Discovery {
/// <summary>
/// Interaction logic for Discovery.xaml
/// </summary>
public partial class DiscoveryView : UserControl {
private DiscoveryViewModel viewModel;
public DiscoveryView() {
InitializeComponent();
viewModel = DataContext as DiscoveryViewModel;
discoveryMethodsDropdown.SelectedIndex = 0;
}
private void ResetDiscoveredPrinterData() {
viewModel.DiscoveredPrinters.Clear();
viewModel.DiscoveredPrinterInfo = "";
}
private void DiscoverPrintersButton_Click(object sender, RoutedEventArgs e) {
try {
ResetDiscoveredPrinterData();
PerformDiscovery();
} catch (Exception ex) {
ShowErrorMessage(ex.Message);
SetDiscoverButtonState(true);
}
}
private void DiscoveryMethodsDropdown_SelectionChanged(object sender, SelectionChangedEventArgs e) {
var selectedItem = (sender as ComboBox).SelectedItem;
if (selectedItem != null) {
DiscoveryMethod discoveryMethod = (DiscoveryMethod)selectedItem;
ipAddressLabel.Visibility = discoveryMethod == DiscoveryMethod.DirectedBroadcast ? Visibility.Visible : Visibility.Collapsed;
ipAddressInput.Visibility = discoveryMethod == DiscoveryMethod.DirectedBroadcast ? Visibility.Visible : Visibility.Collapsed;
numberOfHopsLabel.Visibility = discoveryMethod == DiscoveryMethod.MulticastBroadcast ? Visibility.Visible : Visibility.Collapsed;
numberOfHopsInput.Visibility = discoveryMethod == DiscoveryMethod.MulticastBroadcast ? Visibility.Visible : Visibility.Collapsed;
subnetRangeLabel.Visibility = discoveryMethod == DiscoveryMethod.SubnetSearch ? Visibility.Visible : Visibility.Collapsed;
subnetRangeInput.Visibility = discoveryMethod == DiscoveryMethod.SubnetSearch ? Visibility.Visible : Visibility.Collapsed;
ResetDiscoveredPrinterData();
}
}
private void DiscoveredPrintersList_SelectionChanged(object sender, SelectionChangedEventArgs e) {
ListBox discoveredPrintersList = sender as ListBox;
viewModel.DiscoveredPrinterInfo = "";
var selectedItem = discoveredPrintersList.SelectedItem;
if (selectedItem != null) {
DiscoveredPrinter printer = (DiscoveredPrinter)selectedItem;
Dictionary<string, string> settings = printer.DiscoveryDataMap;
StringBuilder sb = new StringBuilder();
foreach (string key in settings.Keys) {
sb.AppendLine($"{key}: {settings[key]}");
}
viewModel.DiscoveredPrinterInfo = sb.ToString();
}
}
private void NumberOfHopsInput_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e) {
e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
}
/// <exception cref="ConnectionException"></exception>
/// <exception cref="DiscoveryException"></exception>
private void PerformDiscovery() {
DiscoveryHandlerImpl discoveryHandler = new DiscoveryHandlerImpl(this);
switch (discoveryMethodsDropdown.SelectedItem) {
case DiscoveryMethod.DirectedBroadcast:
NetworkDiscoverer.DirectedBroadcast(discoveryHandler, viewModel.IpAddress);
break;
case DiscoveryMethod.FindPrintersNearMe:
NetworkDiscoverer.FindPrinters(discoveryHandler);
break;
case DiscoveryMethod.LocalBroadcast:
NetworkDiscoverer.LocalBroadcast(discoveryHandler);
break;
case DiscoveryMethod.MulticastBroadcast:
NetworkDiscoverer.Multicast(discoveryHandler, int.Parse(viewModel.NumberOfHops));
break;
case DiscoveryMethod.SubnetSearch:
NetworkDiscoverer.SubnetSearch(discoveryHandler, viewModel.SubnetRange);
break;
case DiscoveryMethod.ZebraUsbDrivers:
try {
discoveryHandler = null;
discoverPrintersButton.IsEnabled = false;
viewModel.DiscoveredPrinters.Clear();
foreach (DiscoveredPrinterDriver printer in UsbDiscoverer.GetZebraDriverPrinters()) {
viewModel.DiscoveredPrinters.Add(printer);
}
} finally {
SetDiscoverButtonState(true);
}
break;
case DiscoveryMethod.UsbDirect:
try {
discoveryHandler = null;
discoverPrintersButton.IsEnabled = false;
viewModel.DiscoveredPrinters.Clear();
foreach (DiscoveredUsbPrinter printer in UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter())) {
viewModel.DiscoveredPrinters.Add(printer);
}
} finally {
SetDiscoverButtonState(true);
}
break;
case DiscoveryMethod.Bluetooth:
BluetoothDiscoverer.FindPrinters(discoveryHandler);
break;
}
}
private void SetDiscoverButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
discoverPrintersButton.IsEnabled = state;
});
}
private void ShowErrorMessage(string message) {
MessageBoxCreator.ShowError(message, "Discovery Error");
}
private void DiscoveredPrintersList_Click(object sender, RoutedEventArgs e) {
Clipboard.SetText(discoveredPrintersList.SelectedItem.ToString());
}
private class DiscoveryHandlerImpl : DiscoveryHandler {
private DiscoveryView discoveryView;
public DiscoveryHandlerImpl(DiscoveryView discoveryView) {
this.discoveryView = discoveryView;
discoveryView.SetDiscoverButtonState(false);
}
public void DiscoveryError(string message) {
discoveryView.ShowErrorMessage(message);
}
public void DiscoveryFinished() {
discoveryView.SetDiscoverButtonState(true);
}
public void FoundPrinter(DiscoveredPrinter printer) {
Application.Current.Dispatcher.Invoke(() => {
discoveryView.viewModel.DiscoveredPrinters.Add(printer);
});
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Zebra.Sdk.Printer.Discovery;
using Zebra.Windows.DevDemo.Enums;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.Discovery {
public class DiscoveryViewModel : IDemoViewModel {
private ObservableCollection<DiscoveredPrinter> discoveredPrinters = new ObservableCollection<DiscoveredPrinter>();
private string discoveredPrinterInfo;
private string ipAddress;
private string numberOfHops;
private string subnetRange;
public List<DiscoveryMethod> DiscoveryMethods {
get {
List<DiscoveryMethod> discoveryMethods = Enum.GetValues(typeof(DiscoveryMethod)).Cast<DiscoveryMethod>().ToList();
if(!BluetoothHelper.IsBluetoothSupported()) {
discoveryMethods.Remove(DiscoveryMethod.Bluetooth);
}
return discoveryMethods;
}
}
public ObservableCollection<DiscoveredPrinter> DiscoveredPrinters {
get => discoveredPrinters;
}
public string DiscoveredPrinterInfo {
get => discoveredPrinterInfo;
set {
if (discoveredPrinterInfo != value) {
discoveredPrinterInfo = value;
OnPropertyChanged();
}
}
}
public string IpAddress {
get => ipAddress;
set {
if (ipAddress != value) {
ipAddress = value;
OnPropertyChanged();
}
}
}
public string NumberOfHops {
get => numberOfHops;
set {
if (numberOfHops != value) {
numberOfHops = value;
OnPropertyChanged();
}
}
}
public string SubnetRange {
get => subnetRange;
set {
if (subnetRange != value) {
subnetRange = value;
OnPropertyChanged();
}
}
}
public DiscoveryViewModel() {
Name = "Discovery";
NumberOfHops = "5";
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Zebra.Windows.DevDemo.Demos {
public class IDemoViewModel : INotifyPropertyChanged {
public string Name { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName] string memberName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memberName));
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.ImagePrint.ImagePrintView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.ImagePrint"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:ImagePrintViewModel />
</UserControl.DataContext>
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Image Print</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Margin="0,0,0,10" />
<Grid Margin="0,0,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Margin="0,0,10,10">Image File:</TextBlock>
<usercontrols:FileSelectorView x:Name="fileSelector" Grid.Column="1" Margin="0,0,0,10" />
<TextBlock VerticalAlignment="Center" Grid.Row="1" Margin="0,0,10,10"><Run Text="Store on Printer:" /></TextBlock>
<CheckBox IsChecked="{Binding ShouldStoreImage}" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,0,10" />
<TextBlock VerticalAlignment="Center" Grid.Row="2" Margin="0,0,10,15"><Run Text="Stored File Name:" /></TextBlock>
<TextBox Text="{Binding StoredFileName}" Style="{StaticResource ZebraTextInput}" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,0,15" />
<Button x:Name="printButton" Grid.Row="3" Grid.ColumnSpan="3" Content="Print" Click="PrintButton_Click" />
</Grid>
</StackPanel>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Graphics;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.ImagePrint {
/// <summary>
/// Interaction logic for ImagePrintView.xaml
/// </summary>
public partial class ImagePrintView : UserControl {
private ImagePrintViewModel viewModel;
public ImagePrintView() {
InitializeComponent();
viewModel = DataContext as ImagePrintViewModel;
}
private void PrintButton_Click(object sender, RoutedEventArgs evt) {
SetPrintButtonState(false);
Connection printerConnection = null;
Task.Run(() => {
try {
printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
ZebraImageI image = ZebraImageFactory.GetImage(fileSelector.FileName);
if (viewModel.ShouldStoreImage) {
ZebraPrinterFactory.GetInstance(printerConnection).StoreImage(viewModel.StoredFileName, image, 540, 412);
}
ZebraPrinterFactory.GetInstance(printerConnection).PrintImage(image, 0, 0, 550, 412, false);
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (IOException e) {
MessageBoxCreator.ShowError(e.Message, "Image Error");
} catch (ZebraIllegalArgumentException e) {
MessageBoxCreator.ShowError(e.Message, "Illegal Arguments");
} catch (ArgumentException e) {
MessageBoxCreator.ShowError(e.Message, "Invalid File Path");
} finally {
try {
if (printerConnection != null) {
printerConnection.Close();
}
} catch (ConnectionException) {
} finally {
SetPrintButtonState(true);
}
}
});
}
private void SetPrintButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
printButton.IsEnabled = state;
});
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.ImagePrint {
class ImagePrintViewModel : IDemoViewModel {
private bool shouldStoreImage;
private string storedFileName;
public bool ShouldStoreImage {
get => shouldStoreImage;
set {
if (shouldStoreImage != value) {
shouldStoreImage = value;
OnPropertyChanged();
}
}
}
public string StoredFileName {
get => storedFileName;
set {
if (storedFileName != value) {
storedFileName = value;
OnPropertyChanged();
}
}
}
public ImagePrintViewModel() {
Name = "Image Print";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.ListFormats.ListFormatsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.ListFormats"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:ListFormatsViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">List Formats</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="retrieveFilesButton" Margin="0,0,5,0" Click="RetrieveFilesButton_Click">Retrieve Files</Button>
<Button x:Name="retrieveFormatsButton" Grid.Column="1" Margin="5,0,0,0" Click="RetrieveFormatsButton_Click">Retrieve Formats</Button>
</Grid>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="4" Margin="0,0,0,10">Retrieved Files / Formats</TextBlock>
<ListBox ItemsSource="{Binding FormatsList}" Grid.Row="5" x:Name="storedFilesList"></ListBox>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.ListFormats {
/// <summary>
/// Interaction logic for ListFormatsView.xaml
/// </summary>
public partial class ListFormatsView : UserControl {
private ListFormatsViewModel viewModel;
public ListFormatsView() {
InitializeComponent();
viewModel = DataContext as ListFormatsViewModel;
}
private async void RunFormatDemo(bool isFormat) {
await Task.Run(() => {
SetButtonStates(false);
PerformListFiles(isFormat);
SetButtonStates(true);
});
}
private void PerformListFiles(bool isFormat) {
Connection printerConnection = null;
try {
Application.Current.Dispatcher.Invoke(() => {
printerConnection = connectionSelector.GetConnection();
});
printerConnection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(printerConnection);
string[] formatExtensions;
if (printer.PrinterControlLanguage == PrinterLanguage.ZPL) {
formatExtensions = new string[] { "ZPL" };
} else {
formatExtensions = new string[] { "FMT", "LBL" };
}
string[] formats = isFormat ? printer.RetrieveFileNames(formatExtensions) : printer.RetrieveFileNames();
Application.Current.Dispatcher.Invoke(() => {
foreach (string format in formats) {
viewModel.FormatsList.Add(format);
}
});
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraIllegalArgumentException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} finally {
if (printerConnection != null) {
printerConnection.Close();
}
}
}
private void SetButtonStates(bool enabled) {
Application.Current.Dispatcher.Invoke(() => {
retrieveFilesButton.IsEnabled = enabled;
retrieveFormatsButton.IsEnabled = enabled;
});
}
private void RetrieveFilesButton_Click(object sender, RoutedEventArgs e) {
viewModel.FormatsList.Clear();
RunFormatDemo(false);
}
private void RetrieveFormatsButton_Click(object sender, RoutedEventArgs e) {
viewModel.FormatsList.Clear();
RunFormatDemo(true);
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Collections.ObjectModel;
namespace Zebra.Windows.DevDemo.Demos.ListFormats {
class ListFormatsViewModel : IDemoViewModel {
private ObservableCollection<string> formatsList = new ObservableCollection<string>();
public ObservableCollection<string> FormatsList {
get => formatsList;
}
public ListFormatsViewModel() {
Name = "List Formats";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.MagCard.MagCardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.MagCard"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:MagCardViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Mag Card</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Button x:Name="readMagCardButton" Grid.Row="2" Click="ReadMagCardButton_Click">Read Mag Card</Button>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="4" Margin="0,0,0,10">Mag Card Data</TextBlock>
<TextBox x:Name="magCardData" Text="{Binding MagCardData}" Grid.Row="5" AcceptsReturn="True" TextWrapping="NoWrap" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.MagCard {
/// <summary>
/// Interaction logic for MagCardView.xaml
/// </summary>
public partial class MagCardView : UserControl {
private MagCardViewModel viewModel;
public MagCardView() {
InitializeComponent();
viewModel = DataContext as MagCardViewModel;
}
private void ReadMagCard() {
Connection connection = null;
Task t = Task.Run(() => {
try {
connection = connectionSelector.GetConnection();
connection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);
MagCardReader magCardReader = MagCardReaderFactory.Create(printer);
if (magCardReader != null) {
UpdateMagCardOutput("");
SetButtonText("Swipe Card Now");
string[] trackData = magCardReader.Read(30000);
if (trackData[0].Equals("") && trackData[1].Equals("") && trackData[2].Equals("")) {
MessageBoxCreator.ShowError("Connection timed out", "Mag Card Error");
} else {
UpdateMagCardOutput(trackData[0] + "\r\n" + trackData[1] + "\r\n" + trackData[2]);
}
} else {
MessageBoxCreator.ShowError("Printer does not have a mag card reader", "Mag Card Error");
}
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} finally {
if (connection != null) {
try {
connection.Close();
} catch (ConnectionException) { }
}
SetButtonText("Read Mag Card");
SetButtonState(true);
}
});
}
private void UpdateMagCardOutput(string message) {
viewModel.MagCardData = message;
}
delegate void ParametrizedMethodInvoker5(string arg);
private void SetButtonText(string text) {
Application.Current.Dispatcher.Invoke(() => {
readMagCardButton.Content = text;
});
}
private void SetButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
readMagCardButton.IsEnabled = state;
});
}
private void ReadMagCardButton_Click(object sender, RoutedEventArgs e) {
try {
SetButtonState(false);
UpdateMagCardOutput("");
ReadMagCard();
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Mag Card Data Error");
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.MagCard {
class MagCardViewModel : IDemoViewModel {
private string magCardData;
public string MagCardData {
get => magCardData;
set {
if (magCardData != value) {
magCardData = value;
OnPropertyChanged();
}
}
}
public MagCardViewModel() {
Name = "Mag Card";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.PrinterStatus.PrinterStatusView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.PrinterStatus"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Printer Status</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Button x:Name="getPrinterStatusButton" Grid.Row="2" Click="GetPrinterStatusButton_Click">Get Printer Status</Button>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="4" Margin="0,0,0,10">Printer Status</TextBlock>
<TextBox x:Name="printerStatus" Grid.Row="5" AcceptsReturn="True" TextWrapping="NoWrap" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
using ZebraPrinterStatus = Zebra.Sdk.Printer.PrinterStatus;
namespace Zebra.Windows.DevDemo.Demos.PrinterStatus {
/// <summary>
/// Interaction logic for PrinterStatusView.xaml
/// </summary>
public partial class PrinterStatusView : UserControl {
public PrinterStatusView() {
InitializeComponent();
}
private void GetPrinterStatus() {
Connection printerConnection = null;
Task.Run(() => {
try {
printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(printerConnection);
ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(printer);
ZebraPrinterStatus status = (linkOsPrinter != null) ? linkOsPrinter.GetCurrentStatus() : printer.GetCurrentStatus();
string[] printerStatusString = new PrinterStatusMessages(status).GetStatusMessage();
List<string> printerStatusPrefix = GetPrinterStatusPrefix(status);
StringBuilder sb = new StringBuilder();
foreach (string s in printerStatusPrefix) {
sb.AppendLine(s);
}
foreach (string s in printerStatusString) {
sb.AppendLine(s);
}
Application.Current.Dispatcher.Invoke(() => {
printerStatus.Text = sb.ToString();
});
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} finally {
if (printerConnection != null) {
try {
printerConnection.Close();
} catch (ConnectionException) {
} finally {
SetTestButtonState(true);
}
} else {
SetTestButtonState(true);
}
}
});
}
private List<string> GetPrinterStatusPrefix(ZebraPrinterStatus printerStatus) {
bool ready = printerStatus != null ? printerStatus.isReadyToPrint : false;
string readyString = "Printer " + (ready ? "ready" : "not ready");
string labelsInBatch = "Labels in batch: " + Convert.ToString(printerStatus.labelsRemainingInBatch);
string labelsInRecvBuffer = "Labels in buffer: " + Convert.ToString(printerStatus.numberOfFormatsInReceiveBuffer);
return new List<string> { readyString, labelsInBatch, labelsInRecvBuffer };
}
private void GetPrinterStatusButton_Click(object sender, RoutedEventArgs e) {
try {
SetTestButtonState(false);
GetPrinterStatus();
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Printer Status Error");
}
}
private void SetTestButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
getPrinterStatusButton.IsEnabled = state;
});
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.PrinterStatus {
public class PrinterStatusViewModel : IDemoViewModel {
public PrinterStatusViewModel() {
Name = "Printer Status";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.Profile.ProfileView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.Profile"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Profile</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Margin="0,0,0,10" />
<!--<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" VerticalAlignment="Center" Margin="0,0,10,10">Profile File:</TextBlock>
<TextBox Grid.Column="1" VerticalAlignment="Center" Margin="0,0,10,10"/>
<Button Grid.Column="2" VerticalAlignment="Center" Margin="0,0,0,10" Click="BrowseButton_Click" Content="Browse"/>
</Grid>-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="createProfileButton" Margin="0,5,5,0" Click="CreateProfileButton_Click">Create Profile</Button>
<Button x:Name="uploadProfileButton" Grid.Column="1" Margin="5,5,0,0" Click="UploadProfileButton_Click">Upload Profile</Button>
</Grid>
</StackPanel>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using Microsoft.Win32;
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.Profile {
/// <summary>
/// Interaction logic for ProfileView.xaml
/// </summary>
public partial class ProfileView : UserControl {
public ProfileView() {
InitializeComponent();
}
private void CreateProfile(string profilePath, Connection connection) {
if (connection != null) {
try {
connection.Open();
ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
ZebraPrinterLinkOs printer = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);
if (printer != null) {
if (!profilePath.EndsWith(".zprofile")) {
profilePath += ".zprofile";
}
printer.CreateProfile(profilePath);
MessageBoxCreator.ShowInformation($"Profile created successfully at location '{profilePath}'", "Profile Created Successfully");
} else {
MessageBoxCreator.ShowError("Profile creation is only available on Link-OS(TM) printers", "Error");
}
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (IOException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraIllegalArgumentException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Create Profile Error");
} finally {
SetButtonStates(true);
try {
connection.Close();
} catch (ConnectionException) { }
}
}
}
private void UploadProfile(string profilePath, Connection connection) {
if (connection != null) {
try {
connection.Open();
ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
ZebraPrinterLinkOs printer = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);
if (printer != null) {
printer.LoadProfile(profilePath, FileDeletionOption.NONE, false);
string printerAddress = connectionSelector.getConnectionAddress();
MessageBoxCreator.ShowInformation($"Profile loaded successfully to printer {printerAddress}", "Profile Uploaded Successfully");
} else {
MessageBoxCreator.ShowError("Profile loading is only available on Link-OS(TM) printers", "Error");
}
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (IOException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Upload Profile Error");
} finally {
SetButtonStates(true);
try {
connection.Close();
} catch (ConnectionException) { }
}
}
}
private void SetButtonStates(bool enabled) {
Application.Current.Dispatcher.Invoke(() => {
createProfileButton.IsEnabled = enabled;
uploadProfileButton.IsEnabled = enabled;
});
}
private async void CreateProfileButton_Click(object sender, RoutedEventArgs e) {
try {
SetButtonStates(false);
SaveFileDialog saveFileDialog = new SaveFileDialog();
if (saveFileDialog.ShowDialog() == true) {
string profilePath = saveFileDialog.FileName;
Connection connection = connectionSelector.GetConnection();
await Task.Run(() => CreateProfile(profilePath, connection));
} else {
SetButtonStates(true);
}
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Create Profile Error");
SetButtonStates(true);
}
}
private async void UploadProfileButton_Click(object sender, RoutedEventArgs e) {
try {
SetButtonStates(false);
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true) {
string profilePath = openFileDialog.FileName;
Connection connection = connectionSelector.GetConnection();
await Task.Run(() => UploadProfile(profilePath, connection));
} else {
SetButtonStates(true);
}
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Upload Profile Error");
SetButtonStates(true);
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.Profile {
class ProfileViewModel : IDemoViewModel {
public ProfileViewModel() {
Name = "Profile";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.SendFile.SendFileView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.SendFile"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Send File</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Button x:Name="sendFileButton" Grid.Row="2" Click="SendFileButton_Click">Send File</Button>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.SendFile {
/// <summary>
/// Interaction logic for SendFileView.xaml
/// </summary>
public partial class SendFileView : UserControl {
public SendFileView() {
InitializeComponent();
}
private void SendFileToPrinter() {
string filePath = null;
Connection printerConnection = null;
Task.Run(() => {
try {
printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(printerConnection);
filePath = CreateDemoFile(printer.PrinterControlLanguage);
printer.SendFileContents(filePath);
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (IOException e) {
MessageBoxCreator.ShowError(e.Message, "IO Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Send File Error");
} finally {
try {
if (printerConnection != null)
printerConnection.Close();
} catch (ConnectionException) { }
if (filePath != null) {
try {
new FileInfo(filePath).Delete();
} catch { }
}
SetSendFileButtonState(true);
}
});
}
private string CreateDemoFile(PrinterLanguage pl) {
string tempFilePath = $"{Path.GetTempPath()}TEST_ZEBRA.LBL";
using (FileStream tmpFile = new FileStream(tempFilePath, FileMode.Create)) {
byte[] configLabel = null;
if (pl == PrinterLanguage.ZPL) {
configLabel = Encoding.UTF8.GetBytes("^XA^FO17,16^GB379,371,8^FS^FT65,255^A0N,135,134^FDTEST^FS^XZ");
} else if (pl == PrinterLanguage.CPCL) {
string cpclConfigLabel = "! 0 200 200 406 1\r\n" + "ON-FEED IGNORE\r\n" + "BOX 20 20 380 380 8\r\n" + "T 0 6 137 177 TEST\r\n" + "PRINT\r\n";
configLabel = Encoding.UTF8.GetBytes(cpclConfigLabel);
}
tmpFile.Write(configLabel, 0, configLabel.Length);
tmpFile.Flush();
}
return new FileInfo(tempFilePath).FullName;
}
private void SendFileButton_Click(object sender, RoutedEventArgs e) {
try {
SetSendFileButtonState(false);
SendFileToPrinter();
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Send File Error");
}
}
private void SetSendFileButtonState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
sendFileButton.IsEnabled = state;
});
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.SendFile {
class SendFileViewModel : IDemoViewModel {
public SendFileViewModel() {
Name = "Send File";
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.Settings {
public class Setting {
public string Key {
get; set;
}
public string Value {
get; set;
}
public string Range {
get; set;
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.Settings.SettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.Settings"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:SettingsViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Settings</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="saveSettingsButton" Margin="0,0,5,0" Click="SaveSettingsButton_Click">Save Settings and Refresh</Button>
<Button x:Name="getSettingsButton" Grid.Column="1" Margin="5,0,0,0" Click="GetSettingsButton_Click">Get Settings</Button>
</Grid>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="4" Margin="0,0,0,10">Printer Settings</TextBlock>
<DataGrid x:Name="printerSettingsGrid" ItemsSource="{Binding Settings}" Grid.Row="5" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CellEditEnding="PrinterSettingsGrid_CellEditEnding">
<DataGrid.Columns>
<DataGridTextColumn Header="Key" Binding="{Binding Key}" IsReadOnly="True" Width="140" />
<DataGridTextColumn Header="Value" Binding="{Binding Value}" Width="*" />
<DataGridTextColumn Header="Range" Binding="{Binding Range}" IsReadOnly="True" Width="140" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
using Zebra.Sdk.Settings;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.Settings {
/// <summary>
/// Interaction logic for SettingsView.xaml
/// </summary>
public partial class SettingsView : UserControl {
private SettingsViewModel viewModel;
public SettingsView() {
InitializeComponent();
viewModel = DataContext as SettingsViewModel;
}
private void UpdateSettingsTable() {
Connection connection = null;
try {
connection = connectionSelector.GetConnection();
connection.Open();
ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
ZebraPrinterLinkOs printer = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);
if (printer != null) {
Dictionary<string, Sdk.Settings.Setting> settings = printer.GetAllSettings();
Application.Current.Dispatcher.Invoke(() => {
if (settings != null) {
foreach (string key in settings.Keys) {
viewModel.Settings.Add(new Setting { Key = key, Value = settings[key].Value, Range = printer.GetSettingRange(key) });
}
} else {
MessageBoxCreator.ShowError("Error reading settings", "Settings Error");
}
printerSettingsGrid.UnselectAll();
});
} else {
MessageBoxCreator.ShowError("Connected printer does not support settings", "Connection Error");
}
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (SettingsException e) {
MessageBoxCreator.ShowError(e.Message, "Settings Error");
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Save Settings Error");
} finally {
SetButtonStates(true);
try {
if (connection != null) {
connection.Close();
}
} catch (ConnectionException) { }
}
}
private void ClearSettings() {
Application.Current.Dispatcher.Invoke(() => {
viewModel.Settings.Clear();
});
}
private bool SaveModifiedSettingsToPrinter() {
bool result = false;
Connection connection = null;
try {
connection = connectionSelector.GetConnection();
connection.Open();
ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
ZebraPrinterLinkOs printer = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);
if (printer != null) {
foreach (string key in viewModel.ModifiedSettings.Keys) {
if (printer.IsSettingReadOnly(key) == false) {
printer.SetSetting(key, viewModel.ModifiedSettings[key]);
}
}
viewModel.ModifiedSettings.Clear();
result = true;
} else {
MessageBoxCreator.ShowError("Connected printer does not support settings", "Connection Error");
}
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (SettingsException e) {
MessageBoxCreator.ShowError(e.Message, "Settings Error");
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Save Settings Error");
} finally {
try {
if (connection != null) {
connection.Close();
}
} catch (ConnectionException) { }
}
return result;
}
private void SetButtonStates(bool enabled) {
Application.Current.Dispatcher.Invoke(() => {
saveSettingsButton.IsEnabled = enabled;
getSettingsButton.IsEnabled = enabled;
});
}
private async void SaveSettingsButton_Click(object sender, RoutedEventArgs e) {
try {
SetButtonStates(false);
if (await Task.Run(() => SaveModifiedSettingsToPrinter())) {
ClearSettings();
await Task.Run(() => UpdateSettingsTable());
} else {
SetButtonStates(true);
}
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Save Settings Error");
SetButtonStates(true);
}
}
private async void GetSettingsButton_Click(object sender, RoutedEventArgs e) {
try {
SetButtonStates(false);
ClearSettings();
await Task.Run(() => UpdateSettingsTable());
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Get Settings Error");
SetButtonStates(true);
}
}
private void PrinterSettingsGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) {
if (viewModel.Settings.Count > 0) {
TextBox textBox = e.EditingElement as TextBox;
string newValue = textBox.Text.ToString();
Setting setting = e.Row.Item as Setting;
string key = setting.Key;
if (key != null) {
if (viewModel.ModifiedSettings.ContainsKey(key)) {
viewModel.ModifiedSettings[key] = newValue;
} else {
viewModel.ModifiedSettings.Add(key, newValue);
}
}
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Zebra.Windows.DevDemo.Demos.Settings {
class SettingsViewModel : IDemoViewModel {
private ObservableCollection<Setting> settings = new ObservableCollection<Setting>();
private Dictionary<string, string> modifiedSettings = new Dictionary<string, string>();
public ObservableCollection<Setting> Settings {
get => settings;
}
public Dictionary<string, string> ModifiedSettings {
get => modifiedSettings;
}
public SettingsViewModel() {
Name = "Settings";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.SmartCard.SmartCardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.SmartCard"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Smart Card</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="sendDataButton" Margin="0,0,5,0" Click="SendDataButton_Click">Send Data</Button>
<Button x:Name="sendAtrButton" Grid.Column="1" Margin="5,0,0,0" Click="SendAtrButton_Click">Send ATR</Button>
</Grid>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="4" Margin="0,0,0,10">Response Data</TextBlock>
<TextBox x:Name="responseData" Grid.Row="5" AcceptsReturn="True" TextWrapping="NoWrap" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.SmartCard {
/// <summary>
/// Interaction logic for SmartCardView.xaml
/// </summary>
public partial class SmartCardView : UserControl {
public SmartCardView() {
InitializeComponent();
}
private void RunSmartCardDemo(bool sendData) {
try {
SetButtonStates(false);
ReadSmartCard(sendData);
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Smart Card Error");
}
}
private void ReadSmartCard(bool sendData) {
Connection connection = null;
Task.Run(() => {
try {
UpdateSmartCardOutput("");
Application.Current.Dispatcher.Invoke(() => {
connection = connectionSelector.GetConnection();
});
connection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);
SmartcardReader smartcardReader = SmartcardReaderFactory.Create(printer);
if (smartcardReader != null) {
byte[] response = sendData ? smartcardReader.DoCommand("8010000008") : smartcardReader.GetATR();
UpdateSmartCardOutput(string.Concat(response.Select(x => x.ToString("x2"))));
smartcardReader.Close();
} else {
MessageBoxCreator.ShowError("Printer does not have a smart card reader", "Smart Card Error");
}
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Connection Error");
} finally {
if (connection != null) {
try {
connection.Close();
} catch (ConnectionException) { }
}
SetButtonStates(true);
}
});
}
private void UpdateSmartCardOutput(string newMessage) {
Application.Current.Dispatcher.Invoke(() => {
responseData.Text = newMessage;
});
}
private void SetButtonStates(bool enabled) {
Application.Current.Dispatcher.Invoke(() => {
sendDataButton.IsEnabled = enabled;
sendAtrButton.IsEnabled = enabled;
});
}
private void SendDataButton_Click(object sender, RoutedEventArgs e) {
RunSmartCardDemo(true);
}
private void SendAtrButton_Click(object sender, RoutedEventArgs e) {
RunSmartCardDemo(false);
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.SmartCard {
class SmartCardViewModel : IDemoViewModel {
public SmartCardViewModel() {
Name = "Smart Card";
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Demos.StoredFormat {
public class FormatVariable {
public string FieldName {
get; set;
}
public string FieldValue {
get; set;
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.Demos.StoredFormat.StoredFormatView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Demos.StoredFormat"
xmlns:usercontrols="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:StoredFormatViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource ZebraHeader}" Margin="0,0,0,10">Stored Formats</TextBlock>
<usercontrols:ConnectionSelectorView x:Name="connectionSelector" Grid.Row="1" Margin="0,0,0,15" />
<Button x:Name="retrieveFormatsButton" Grid.Row="2" Margin="5,0,0,0" Click="RetrieveFormatsButton_Click">Retrieve Formats</Button>
<Separator Grid.Row="3" Margin="0,15,0,15" />
<TextBlock Style="{StaticResource ZebraHeader}" Grid.Row="4" Margin="0,0,0,10">Retrieved Formats</TextBlock>
<ListBox ItemsSource="{Binding StoredFormatList}" Grid.Row="5" x:Name="storedFilesList" MouseDoubleClick="StoredFilesList_MouseDoubleClick"></ListBox>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;
using Zebra.Windows.DevDemo.Dialogs;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.StoredFormat {
/// <summary>
/// Interaction logic for StoredFormatView.xaml
/// </summary>
public partial class StoredFormatView : UserControl {
private StoredFormatViewModel viewModel;
private List<FieldDescriptionData> fieldDescDataVars;
private ObservableCollection<FormatVariable> formatVariables;
public StoredFormatView() {
InitializeComponent();
viewModel = DataContext as StoredFormatViewModel;
}
private void CreateFormatTableDialog() {
SetButtonState(retrieveFormatsButton, false);
SetFormatListState(false);
string formatName = (string)storedFilesList.SelectedValue;
Connection printerConnection = null;
Task.Run(() => {
try {
printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(printerConnection);
byte[] formatData = printer.RetrieveFormatFromPrinter(formatName);
fieldDescDataVars = printer.GetVariableFields(Encoding.UTF8.GetString(formatData)).ToList();
fieldDescDataVars = FormatFieldDescriptionDataVars(fieldDescDataVars);
formatVariables = new ObservableCollection<FormatVariable>();
for (int i = 0; i < fieldDescDataVars.Count; ++i) {
formatVariables.Add(new FormatVariable { FieldName = fieldDescDataVars[i].FieldName, FieldValue = "" });
}
try {
if (printerConnection != null) {
printerConnection.Close();
}
} catch (ConnectionException) { }
ShowStoredFormatDialog(formatName);
} catch (Exception e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
SetButtonState(retrieveFormatsButton, true);
SetFormatListState(true);
} finally {
try {
if (printerConnection != null && printerConnection.Connected) {
printerConnection.Close();
}
} catch (ConnectionException) { }
}
});
}
private void PopulateListWithFormats() {
Connection printerConnection = null;
Task.Run(() => {
try {
ClearFormatList();
printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(printerConnection);
string[] formatExtensions = printer.PrinterControlLanguage == PrinterLanguage.ZPL ? new String[] { "ZPL" } : new String[] { "FMT", "LBL" };
string[] formats = printer.RetrieveFileNames(formatExtensions);
AddFormatsToList(formats);
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
} catch (ZebraIllegalArgumentException e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
} finally {
try {
if (printerConnection != null) {
printerConnection.Close();
}
} catch (ConnectionException) {
} finally {
SetButtonState(retrieveFormatsButton, true);
SetFormatListState(true);
}
}
});
}
private void SetFormatListState(bool state) {
Application.Current.Dispatcher.Invoke(() => {
storedFilesList.IsEnabled = state;
});
}
private void AddFormatsToList(string[] formats) {
Application.Current.Dispatcher.Invoke(() => {
foreach (string format in formats) {
viewModel.StoredFormatList.Add(format);
}
});
}
private void ClearFormatList() {
SetFormatListState(false);
Application.Current.Dispatcher.Invoke(() => {
viewModel.StoredFormatList.Clear();
});
}
private void PrintFormat(string formatName) {
Connection printerConnection = null;
try {
printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
Dictionary<int, string> formatVars = GetFormatVariables();
ZebraPrinterFactory.GetInstance(printerConnection).PrintStoredFormat(formatName, formatVars, "UTF-8");
} catch (ArgumentException e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
} catch (ConnectionException e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
} catch (ZebraPrinterLanguageUnknownException e) {
MessageBoxCreator.ShowError(e.Message, "Communication Error");
} finally {
if (printerConnection != null) {
try {
printerConnection.Close();
} catch (ConnectionException) { }
}
}
}
private List<FieldDescriptionData> FormatFieldDescriptionDataVars(List<FieldDescriptionData> variables) {
foreach (FieldDescriptionData data in variables) {
data.FieldName = data.FieldName ?? "Field " + data.FieldNumber;
}
return variables;
}
private Dictionary<int, string> GetFormatVariables() {
Dictionary<int, string> formatVars = new Dictionary<int, string>();
for (int i = 0; i < formatVariables.Count; i++) {
int fieldNum = fieldDescDataVars[i].FieldNumber;
formatVars.Add(fieldNum, formatVariables[i].FieldValue);
}
return formatVars;
}
private void RetrieveFormatsButton_Click(object sender, RoutedEventArgs e) {
try {
SetButtonState(retrieveFormatsButton, false);
PopulateListWithFormats();
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Stored Format Error");
}
}
private void SetButtonState(Button button, bool state) {
Application.Current.Dispatcher.Invoke(() => {
button.IsEnabled = state;
});
}
private void StoredFilesList_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
if (!e.Handled) {
e.Handled = true;
CreateFormatTableDialog();
}
}
private void ShowStoredFormatDialog(string formatName) {
Application.Current.Dispatcher.Invoke(() => {
StoredFormatDialog storedFormatDialog = new StoredFormatDialog(new StoredFormatDialogViewModel(formatVariables));
Button printFormatButton = storedFormatDialog.PrintFormatButton;
printFormatButton.Click += async (s, e) => {
try {
SetButtonState(printFormatButton, false);
await Task.Run(() => PrintFormat(formatName));
} catch (Exception ex) {
MessageBoxCreator.ShowError(ex.Message, "Print Format Error");
} finally {
SetButtonState(printFormatButton, true);
}
};
storedFormatDialog.ShowDialog();
SetButtonState(retrieveFormatsButton, true);
SetFormatListState(true);
});
}
}
}
\ No newline at end of file
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Collections.ObjectModel;
namespace Zebra.Windows.DevDemo.Demos.StoredFormat {
public class StoredFormatViewModel : IDemoViewModel {
private ObservableCollection<string> storedFormatList = new ObservableCollection<string>();
public ObservableCollection<string> StoredFormatList {
get => storedFormatList;
}
public StoredFormatViewModel() {
Name = "Stored Format";
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<Window x:Class="Zebra.Windows.DevDemo.Dialogs.StoredFormatDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.Dialogs"
mc:Ignorable="d"
Title="Format Variables" Height="300" Width="300">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<DataGrid x:Name="formatVariables" ItemsSource="{Binding FormatVariables}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Variable" Binding="{Binding FieldName}" IsReadOnly="True" Width="140" />
<DataGridTextColumn Header="Value" Binding="{Binding FieldValue}" Width="*" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="printFormatButton" Grid.Row="1" Margin="0,10,0,0">Print Format</Button>
</Grid>
</Window>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Windows;
using System.Windows.Controls;
namespace Zebra.Windows.DevDemo.Dialogs {
/// <summary>
/// Interaction logic for StoredFormatDialog.xaml
/// </summary>
public partial class StoredFormatDialog : Window {
public Button PrintFormatButton {
get => printFormatButton;
}
public StoredFormatDialog(StoredFormatDialogViewModel viewModel) {
InitializeComponent();
DataContext = viewModel;
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Zebra.Windows.DevDemo.Demos.StoredFormat;
namespace Zebra.Windows.DevDemo.Dialogs {
public class StoredFormatDialogViewModel : INotifyPropertyChanged {
private ObservableCollection<FormatVariable> formatVariables = new ObservableCollection<FormatVariable>();
public event PropertyChangedEventHandler PropertyChanged;
public ObservableCollection<FormatVariable> FormatVariables {
get => formatVariables;
}
public StoredFormatDialogViewModel(ObservableCollection<FormatVariable> formatVariables) {
this.formatVariables = formatVariables;
}
private void OnPropertyChanged([CallerMemberName] string memberName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memberName));
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
namespace Zebra.Windows.DevDemo.Enums {
public enum ConnectionState {
Success,
Error,
Progress,
Info
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.ComponentModel;
namespace Zebra.Windows.DevDemo.Enums {
public enum ConnectionType {
[Description("Network")]
Network,
[Description("USB")]
USB,
[Description("USB Direct")]
UsbDirect,
[Description("Bluetooth")]
Bluetooth
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.ComponentModel;
namespace Zebra.Windows.DevDemo.Enums {
public enum DiscoveryMethod {
[Description("Local Broadcast")]
LocalBroadcast,
[Description("Directed Broadcast")]
DirectedBroadcast,
[Description("Multicast Broadcast")]
MulticastBroadcast,
[Description("Subnet Search")]
SubnetSearch,
[Description("Zebra USB Drivers")]
ZebraUsbDrivers,
[Description("USB Direct")]
UsbDirect,
[Description("Find Printers Near Me")]
FindPrintersNearMe,
[Description("Find all Bluetooth Devices")]
Bluetooth
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<Window x:Class="Zebra.Windows.DevDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo"
xmlns:utils="clr-namespace:Zebra.Windows.DevDemo.Utils"
xmlns:connectivity="clr-namespace:Zebra.Windows.DevDemo.Demos.Connectivity"
xmlns:discovery="clr-namespace:Zebra.Windows.DevDemo.Demos.Discovery"
xmlns:imageprint="clr-namespace:Zebra.Windows.DevDemo.Demos.ImagePrint"
xmlns:listformats="clr-namespace:Zebra.Windows.DevDemo.Demos.ListFormats"
xmlns:magcard="clr-namespace:Zebra.Windows.DevDemo.Demos.MagCard"
xmlns:printerstatus="clr-namespace:Zebra.Windows.DevDemo.Demos.PrinterStatus"
xmlns:profile="clr-namespace:Zebra.Windows.DevDemo.Demos.Profile"
xmlns:sendfile="clr-namespace:Zebra.Windows.DevDemo.Demos.SendFile"
xmlns:settings="clr-namespace:Zebra.Windows.DevDemo.Demos.Settings"
xmlns:smartcard="clr-namespace:Zebra.Windows.DevDemo.Demos.SmartCard"
xmlns:storedformat="clr-namespace:Zebra.Windows.DevDemo.Demos.StoredFormat"
xmlns:connectionbuilder="clr-namespace:Zebra.Windows.DevDemo.Demos.ConnectionBuilder"
mc:Ignorable="d"
WindowStyle="None" ResizeMode="CanResizeWithGrip" AllowsTransparency="True"
Title="Zebra Developer Demos" MinWidth="640" Width="640" MinHeight="480" Height="480">
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<Window.Resources>
<utils:DemoViewModelNameValueConverter x:Key="converter" />
<DataTemplate DataType="{x:Type connectivity:ConnectivityViewModel}">
<connectivity:ConnectivityView />
</DataTemplate>
<DataTemplate DataType="{x:Type discovery:DiscoveryViewModel}">
<discovery:DiscoveryView />
</DataTemplate>
<DataTemplate DataType="{x:Type imageprint:ImagePrintViewModel}">
<imageprint:ImagePrintView />
</DataTemplate>
<DataTemplate DataType="{x:Type listformats:ListFormatsViewModel}">
<listformats:ListFormatsView />
</DataTemplate>
<DataTemplate DataType="{x:Type magcard:MagCardViewModel}">
<magcard:MagCardView />
</DataTemplate>
<DataTemplate DataType="{x:Type printerstatus:PrinterStatusViewModel}">
<printerstatus:PrinterStatusView />
</DataTemplate>
<DataTemplate DataType="{x:Type profile:ProfileViewModel}">
<profile:ProfileView />
</DataTemplate>
<DataTemplate DataType="{x:Type sendfile:SendFileViewModel}">
<sendfile:SendFileView />
</DataTemplate>
<DataTemplate DataType="{x:Type settings:SettingsViewModel}">
<settings:SettingsView />
</DataTemplate>
<DataTemplate DataType="{x:Type smartcard:SmartCardViewModel}">
<smartcard:SmartCardView />
</DataTemplate>
<DataTemplate DataType="{x:Type storedformat:StoredFormatViewModel}">
<storedformat:StoredFormatView />
</DataTemplate>
<DataTemplate DataType="{x:Type connectionbuilder:ConnectionBuilderViewModel}">
<connectionbuilder:ConnectionBuilderView />
</DataTemplate>
<BitmapImage x:Key="ZebraLogoImageSource" UriSource="../../../Resources/Images/Zebra_Logo_W.png" />
</Window.Resources>
<DockPanel>
<Grid x:Name="titleBar" DockPanel.Dock="Top" Background="#007CB0" MouseDown="TitleBar_MouseDown">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Source="{StaticResource ZebraLogoImageSource}" Width="120" Height="40" Margin="15" />
<TextBlock x:Name="closeButton" Grid.Column="1" Foreground="White" FontWeight="Bold" FontSize="24" Padding="10,0" VerticalAlignment="Top" HorizontalAlignment="Right" PreviewMouseLeftButtonDown="CloseButton_PreviewMouseLeftButtonDown">×</TextBlock>
</Grid>
<DockPanel DockPanel.Dock="Left" Margin="10" Width="150">
<TextBlock Style="{StaticResource ZebraHeader}" DockPanel.Dock="Top" Margin="0,0,0,10">Available Demos</TextBlock>
<ListBox ItemsSource="{Binding DemoViewModels}">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<ContentPresenter Content="{Binding Converter={StaticResource converter}}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
<ContentControl Content="{Binding CurrentDemoViewModel}" />
</DockPanel>
</Window>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Zebra.Windows.DevDemo.Demos;
using Zebra.Windows.DevDemo.Dialogs;
namespace Zebra.Windows.DevDemo {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e) {
if (e.ChangedButton == MouseButton.Left) {
DragMove();
}
}
private void CloseButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
Application.Current.Shutdown();
}
private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
if (sender is ListBoxItem item) {
IDemoViewModel demoViewModel = item.DataContext as IDemoViewModel;
(DataContext as MainWindowViewModel).CurrentDemoViewModel = (DataContext as MainWindowViewModel).DemoViewModels.FirstOrDefault(vm => vm == demoViewModel);
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Zebra.Windows.DevDemo.Demos;
using Zebra.Windows.DevDemo.Demos.ConnectionBuilder;
using Zebra.Windows.DevDemo.Demos.Connectivity;
using Zebra.Windows.DevDemo.Demos.Discovery;
using Zebra.Windows.DevDemo.Demos.ImagePrint;
using Zebra.Windows.DevDemo.Demos.ListFormats;
using Zebra.Windows.DevDemo.Demos.MagCard;
using Zebra.Windows.DevDemo.Demos.PrinterStatus;
using Zebra.Windows.DevDemo.Demos.Profile;
using Zebra.Windows.DevDemo.Demos.SendFile;
using Zebra.Windows.DevDemo.Demos.Settings;
using Zebra.Windows.DevDemo.Demos.SmartCard;
using Zebra.Windows.DevDemo.Demos.StoredFormat;
namespace Zebra.Windows.DevDemo {
class MainWindowViewModel : INotifyPropertyChanged {
private IDemoViewModel currentDemoViewModel;
private ObservableCollection<IDemoViewModel> demoViewModels;
public event PropertyChangedEventHandler PropertyChanged;
public IDemoViewModel CurrentDemoViewModel {
get => currentDemoViewModel;
set {
if (currentDemoViewModel != value) {
currentDemoViewModel = value;
OnPropertyChanged();
}
}
}
public ObservableCollection<IDemoViewModel> DemoViewModels {
get {
if (demoViewModels == null) {
demoViewModels = new ObservableCollection<IDemoViewModel>();
}
return demoViewModels;
}
}
public MainWindowViewModel() {
DemoViewModels.Add(new ConnectivityViewModel());
DemoViewModels.Add(new DiscoveryViewModel());
DemoViewModels.Add(new ImagePrintViewModel());
DemoViewModels.Add(new ListFormatsViewModel());
DemoViewModels.Add(new MagCardViewModel());
DemoViewModels.Add(new PrinterStatusViewModel());
DemoViewModels.Add(new ProfileViewModel());
DemoViewModels.Add(new SendFileViewModel());
DemoViewModels.Add(new SettingsViewModel());
DemoViewModels.Add(new SmartCardViewModel());
DemoViewModels.Add(new StoredFormatViewModel());
DemoViewModels.Add(new ConnectionBuilderViewModel());
CurrentDemoViewModel = DemoViewModels[0];
}
private void OnPropertyChanged([CallerMemberName] string memberName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memberName));
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.UserControls.ConnectionSelectorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.UserControls"
xmlns:utils="clr-namespace:Zebra.Windows.DevDemo.Utils"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:ConnectionSelectorViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<utils:ConnectionTypeDescriptionValueConverter x:Key="converter" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Margin="0,0,10,10" VerticalAlignment="Center">Connection Type:</TextBlock>
<ComboBox x:Name="connectionTypesDropdown" ItemsSource="{Binding ConnectionTypes}" Width="100" Grid.Column="1" Margin="0,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Center" SelectionChanged="ConnectionTypesDropdown_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<ContentPresenter Content="{Binding Converter={StaticResource converter}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock x:Name="usbPrintersLabel" Grid.Row="1" Margin="0,0,10,0" VerticalAlignment="Center">USB Printers:</TextBlock>
<ComboBox x:Name="usbPrintersDropdown" ItemsSource="{Binding UsbDevices}" Width="180" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBlock x:Name="usbDirectLabel" Grid.Row="1" Margin="0,0,10,0" VerticalAlignment="Center">Symbolic Name:</TextBlock>
<TextBox x:Name="usbDirectInput" Width="180" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding SymbolicName}" />
<TextBlock x:Name="ipAddressLabel" Grid.Row="1" Margin="0,0,10,10" VerticalAlignment="Center">IP Address:</TextBlock>
<TextBox x:Name="ipAddressInput" Style="{StaticResource ZebraTextInput}" Width="180" Grid.Row="1" Grid.Column="1" Margin="0,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding IpAddress}" />
<TextBlock x:Name="btAddressLabel" Grid.Row="1" Margin="0,0,10,10" VerticalAlignment="Center">Bluetooth Address:</TextBlock>
<TextBox x:Name="btAddressInput" Style="{StaticResource ZebraTextInput}" Width="180" Grid.Row="1" Grid.Column="1" Margin="0,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding MacAddress}" />
<TextBlock x:Name="portLabel" Grid.Row="2" Margin="0,0,10,0" VerticalAlignment="Center">Port:</TextBlock>
<TextBox x:Name="portInput" Style="{StaticResource ZebraTextInput}" Width="60" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Port}" />
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer.Discovery;
using Zebra.Windows.DevDemo.Enums;
namespace Zebra.Windows.DevDemo.UserControls {
/// <summary>
/// Interaction logic for ConnectionSelectorView.xaml
/// </summary>
public partial class ConnectionSelectorView : UserControl {
private ConnectionSelectorViewModel viewModel;
public string IpAddress {
get => viewModel.IpAddress;
}
public ConnectionType ConnectionType {
get => viewModel.ConnectionType;
}
public DiscoveredPrinterDriver SelectedUsbPrinter {
get => (DiscoveredPrinterDriver) usbPrintersDropdown.SelectedItem;
}
public ConnectionSelectorView() {
InitializeComponent();
viewModel = DataContext as ConnectionSelectorViewModel;
connectionTypesDropdown.SelectedIndex = 0;
}
private void ConnectionTypesDropdown_SelectionChanged(object sender, SelectionChangedEventArgs e) {
var selectedItem = (sender as ComboBox).SelectedItem;
if (selectedItem != null) {
usbPrintersLabel.Visibility = Visibility.Collapsed;
usbPrintersDropdown.Visibility = Visibility.Collapsed;
usbDirectLabel.Visibility = Visibility.Collapsed;
usbDirectInput.Visibility = Visibility.Collapsed;
ipAddressLabel.Visibility = Visibility.Collapsed;
ipAddressInput.Visibility = Visibility.Collapsed;
portLabel.Visibility = Visibility.Collapsed;
portInput.Visibility = Visibility.Collapsed;
btAddressInput.Visibility = Visibility.Collapsed;
btAddressLabel.Visibility = Visibility.Collapsed;
switch (selectedItem) {
case ConnectionType.Network:
viewModel.ConnectionType = ConnectionType.Network;
ipAddressLabel.Visibility = Visibility.Visible;
ipAddressInput.Visibility = Visibility.Visible;
portLabel.Visibility = Visibility.Visible;
portInput.Visibility = Visibility.Visible;
break;
case ConnectionType.USB:
viewModel.ConnectionType = ConnectionType.USB;
usbPrintersLabel.Visibility = Visibility.Visible;
usbPrintersDropdown.Visibility = Visibility.Visible;
break;
case ConnectionType.UsbDirect:
viewModel.ConnectionType = ConnectionType.UsbDirect;
usbDirectLabel.Visibility = Visibility.Visible;
usbDirectInput.Visibility = Visibility.Visible;
break;
case ConnectionType.Bluetooth:
viewModel.ConnectionType = ConnectionType.Bluetooth;
btAddressInput.Visibility = Visibility.Visible;
btAddressLabel.Visibility = Visibility.Visible;
break;
}
if ((ConnectionType)selectedItem == ConnectionType.USB) {
GetUsbPrintersAndAddToList();
if (usbPrintersDropdown.Items.Count > 0) {
usbPrintersDropdown.SelectedIndex = 0;
}
}
}
}
private void GetUsbPrintersAndAddToList() {
try {
viewModel.UsbDevices.Clear();
List<DiscoveredPrinterDriver> discoPrinters = UsbDiscoverer.GetZebraDriverPrinters();
foreach (DiscoveredPrinterDriver printer in discoPrinters) {
viewModel.UsbDevices.Add(printer);
}
} catch (ConnectionException) {
viewModel.UsbDevices.Clear();
viewModel.UsbDevices.Add(new DiscoveredPrinterDriver("OS not supported", "", new List<string>()));
usbPrintersDropdown.SelectedIndex = 0;
}
}
public string getConnectionAddress() {
switch(viewModel.ConnectionType) {
case ConnectionType.Bluetooth:
return viewModel.MacAddress;
case ConnectionType.UsbDirect:
return viewModel.SymbolicName;
case ConnectionType.USB:
return viewModel.UsbPrinterName;
default:
return viewModel.IpAddress;
}
}
public Connection GetConnection() {
if (viewModel.ConnectionType == ConnectionType.Network) {
try {
int port = string.IsNullOrEmpty(viewModel.Port) ? 9100 : int.Parse(viewModel.Port);
return new TcpConnection(viewModel.IpAddress, port);
} catch (Exception e) {
throw new ConnectionException(e.Message, e);
}
} else if (viewModel.ConnectionType == ConnectionType.UsbDirect) {
try {
return new UsbConnection(viewModel.SymbolicName);
} catch (Exception e) {
throw new ConnectionException(e.Message, e);
}
} else if(viewModel.ConnectionType == ConnectionType.USB) {
DiscoveredPrinterDriver printer = null;
Application.Current.Dispatcher.Invoke(() => {
printer = (DiscoveredPrinterDriver)usbPrintersDropdown.SelectedItem;
});
viewModel.UsbPrinterName = printer.PrinterName;
return new DriverPrinterConnection(printer.PrinterName);
} else {
try {
return new BluetoothConnection(viewModel.MacAddress);
} catch (Exception e) {
throw new ConnectionException(e.Message, e);
}
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Zebra.Sdk.Printer.Discovery;
using Zebra.Windows.DevDemo.Enums;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.UserControls {
public class ConnectionSelectorViewModel : INotifyPropertyChanged {
private ConnectionType connectionType;
private string ipAddress;
private string port;
private string macAddress;
private string usbPrinterName;
private string symbolicName;
private ObservableCollection<DiscoveredPrinter> usbDevices = new ObservableCollection<DiscoveredPrinter>();
public event PropertyChangedEventHandler PropertyChanged;
public ConnectionType ConnectionType {
get => connectionType;
set {
if (connectionType != value) {
connectionType = value;
OnPropertyChanged();
}
}
}
public string IpAddress {
get => ipAddress;
set {
if (ipAddress != value) {
ipAddress = value;
OnPropertyChanged();
}
}
}
public string Port {
get => port;
set {
if (port != value) {
port = value;
OnPropertyChanged();
}
}
}
public string MacAddress {
get => macAddress;
set {
if (macAddress != value) {
macAddress = value;
OnPropertyChanged();
}
}
}
public string UsbPrinterName {
get => usbPrinterName;
set {
if (usbPrinterName != value) {
usbPrinterName = value;
OnPropertyChanged();
}
}
}
public string SymbolicName {
get => symbolicName;
set {
if (symbolicName != value) {
symbolicName = value;
OnPropertyChanged();
}
}
}
public ObservableCollection<DiscoveredPrinter> UsbDevices {
get => usbDevices;
}
public List<ConnectionType> ConnectionTypes {
get {
List<ConnectionType> connectionTypes = Enum.GetValues(typeof(ConnectionType)).Cast<ConnectionType>().ToList();
if (!BluetoothHelper.IsBluetoothSupported()) {
connectionTypes.Remove(ConnectionType.Bluetooth);
}
return connectionTypes;
}
}
public ConnectionSelectorViewModel() {
Port = "9100";
}
private void OnPropertyChanged([CallerMemberName] string memberName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memberName));
}
}
}
<!--
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
-->
<UserControl x:Class="Zebra.Windows.DevDemo.UserControls.FileSelectorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Zebra.Windows.DevDemo.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:FileSelectorViewModel />
</UserControl.DataContext>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Style="{StaticResource ZebraTextInput}" Text="{Binding FileName}" Margin="0,0,5,0" />
<Button x:Name="browseButton" Grid.Column="1" Margin="5,0,0,0" Click="BrowseButton_Click">Browse...</Button>
</Grid>
</UserControl>
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using Microsoft.Win32;
using System.Windows;
using System.Windows.Controls;
namespace Zebra.Windows.DevDemo.UserControls {
/// <summary>
/// Interaction logic for FileSelectorView.xaml
/// </summary>
public partial class FileSelectorView : UserControl {
private FileSelectorViewModel viewModel;
public string FileName {
get => viewModel.FileName;
}
public FileSelectorView() {
InitializeComponent();
viewModel = DataContext as FileSelectorViewModel;
}
private void BrowseButton_Click(object sender, RoutedEventArgs e) {
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true) {
viewModel.FileName = openFileDialog.FileName;
}
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Zebra.Windows.DevDemo.UserControls {
class FileSelectorViewModel : INotifyPropertyChanged {
private string fileName;
public string FileName {
get => fileName;
set {
if (fileName != value) {
fileName = value;
OnPropertyChanged();
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName] string memberName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memberName));
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
namespace Zebra.Windows.DevDemo.Utils {
internal class BluetoothHelper {
public static bool IsBluetoothSupported() {
var osVersion = Environment.OSVersion;
if (osVersion.Version.Major >= 10) {
return true;
}
return false;
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Data;
using Zebra.Windows.DevDemo.Enums;
namespace Zebra.Windows.DevDemo.Utils {
public class ConnectionTypeDescriptionValueConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
var type = typeof(ConnectionType);
var name = Enum.GetName(type, value);
return ((DescriptionAttribute)Attribute.GetCustomAttribute(type.GetField(name), typeof(DescriptionAttribute))).Description;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Globalization;
using System.Windows.Data;
using Zebra.Windows.DevDemo.Demos;
namespace Zebra.Windows.DevDemo.Utils {
public class DemoViewModelNameValueConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return (value as IDemoViewModel).Name;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Data;
using Zebra.Windows.DevDemo.Enums;
namespace Zebra.Windows.DevDemo.Utils {
public class DiscoveryMethodDescriptionValueConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
var type = typeof(DiscoveryMethod);
var name = Enum.GetName(type, value);
return ((DescriptionAttribute) Attribute.GetCustomAttribute(type.GetField(name), typeof(DescriptionAttribute))).Description;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System.Windows;
namespace Zebra.Windows.DevDemo.Utils {
public static class MessageBoxCreator {
public static void ShowError(string message, string caption) {
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error);
}
public static void ShowInformation(string message, string caption) {
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
</configuration>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ZebraPrinterHelper
{
class Program
{
static void Main(string[] args)
{
ZebraManger zebraManger = new ZebraManger();
zebraManger.Init("192.168.3.4", ConnectionType.Network);
zebraManger.Connection(out _);
//if (!zebraManger.IsPrinterReady(out string ms))
//{
// Console.WriteLine(ms);
//}
//zebraManger.PrintStartMode();
zebraManger.PauseMode();
zebraManger.PrintStartMode();
zebraManger.CancelAll();
Bitmap bitmap = new Bitmap(@"C:\Users\刘韬\Desktop\微信截图_20221008092432.png");
if (!zebraManger.PrintImage(bitmap, out string msg))
{
Console.WriteLine("print error:"+msg);
}
while (!zebraManger.IsLabelOnPeeler) {
Thread.Sleep(50);
}
Console.WriteLine(zebraManger.IsLabelOnPeeler);
while (zebraManger.IsLabelOnPeeler)
{
Thread.Sleep(50);
}
Console.WriteLine(zebraManger.IsLabelOnPeeler);
Console.ReadKey();
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ZebraPrinterHelper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZebraPrinterHelper")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("e4f7afc7-2f6d-4685-8350-3c05697428ea")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
此文件太大,无法显示。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Graphics;
using Zebra.Sdk.Printer;
using Zebra.Sdk.Printer.Discovery;
namespace ZebraPrinterHelper
{
public class ZebraManger
{
ConnectionType ConnectionType;
string ConnectionEndpoint;
public int PrinterDPI=203;
/// <summary>
/// 初始化打印机
/// </summary>
/// <param name="endpoint">连接地址</param>
/// <param name="connectionType">连接类型</param>
public void Init(string endpoint, ConnectionType connectionType) {
ConnectionEndpoint = endpoint;
ConnectionType = connectionType;
}
Connection printerConnection = null;
Connection GetConnection()
{
if (ConnectionType == ConnectionType.Network)
{
try
{
int port = 9100;
return new TcpConnection(ConnectionEndpoint, port);
}
catch (Exception e)
{
throw new ConnectionException(e.Message, e);
}
}
else if (ConnectionType == ConnectionType.UsbDirect)
{
try
{
return new UsbConnection(ConnectionEndpoint);
}
catch (Exception e)
{
throw new ConnectionException(e.Message, e);
}
}
else if (ConnectionType == ConnectionType.USB)
{
return new DriverPrinterConnection(ConnectionEndpoint);
}
else
{
try
{
return new BluetoothConnection(ConnectionEndpoint);
}
catch (Exception e)
{
throw new ConnectionException(e.Message, e);
}
}
}
/// <summary>
/// 连接打印机
/// </summary>
/// <param name="msg">错误消息</param>
/// <returns>是否成功</returns>
public bool Connection(out string msg) {
msg = "";
try
{
printerConnection = GetConnection();
printerConnection.Open();
PrinterDPI = GetPrinterDPI();
return true;
}
catch (ConnectionException e)
{
msg = "Connection Error:" + e.Message;
}
catch (ZebraPrinterLanguageUnknownException e)
{
msg = "Connection Error:" + e.Message;
}
catch (IOException e)
{
msg = "Image Error" + e.Message;
}
catch (ZebraIllegalArgumentException e)
{
msg = "Illegal Arguments" + e.Message;
}
catch (ArgumentException e)
{
msg = "Invalid File Path" + e.Message;
}
finally
{
}
return false;
}
/// <summary>
/// 关闭打印机连接
/// </summary>
public void Close() {
try
{
if (printerConnection != null)
{
printerConnection.Close();
printerConnection = null;
}
}
catch (ConnectionException)
{
}
finally
{
}
}
~ZebraManger() {
Close();
}
/// <summary>
/// 打印图像
/// </summary>
/// <param name="bmp"></param>
/// <param name="msg">错误消息</param>
/// <returns>是否成功</returns>
public bool PrintImage(Bitmap bmp, out string msg)
{
if (!CheckAndConnection(out msg))
return false;
CancelAll();
var status = GetStatus();
if (!status.isReadyToPrint) {
string[] printerStatusString = new PrinterStatusMessages(status).GetStatusMessage();
msg = string.Join("\r\n", printerStatusString);
return false;
}
if (IsLabelOnPeeler) {
msg = "上一个标签尚未移走";
return false;
}
try
{
ZebraImageI image = ZebraImageFactory.GetImage(bmp);
ZebraPrinterFactory.GetInstance(printerConnection).PrintImage(image, 0, 0, 0, 0, false);
return true;
}
catch (ConnectionException e)
{
msg = "Connection Error:" + e.Message;
}
catch (ZebraPrinterLanguageUnknownException e)
{
msg = "Connection Error:" + e.Message;
}
catch (IOException e)
{
msg = "Image Error" + e.Message;
}
catch (ZebraIllegalArgumentException e)
{
msg = "Illegal Arguments"+e.Message;
}
catch (ArgumentException e)
{
msg = "Invalid File Path" + e.Message;
}
finally
{
}
return false;
}
bool CheckAndConnection(out string msg) {
msg = "";
if (printerConnection == null || !printerConnection.Connected)
{
if (!Connection(out string m))
{
msg = m;
return false;
}
}
return true;
}
public bool IsLabelOnPeeler
{
get
{
try
{
string d = "! U1 getvar \"sensor.peeler\"\n";
var b = Encoding.ASCII.GetBytes(d);
var rd = printerConnection.SendAndWaitForResponse(b, 5000, 500, null);
var rs = Encoding.ASCII.GetString(rd);
//log("sensor.peeler" + rs);
return rs.IndexOf("not clear") > -1;
}
catch {
return false;
}
}
}
public int GetPrinterDPI()
{
try
{
string d = "! U1 getvar \"head.resolution.in_dpi\"\n";
var b = Encoding.ASCII.GetBytes(d);
var rd = printerConnection.SendAndWaitForResponse(b, 5000, 500, null);
var rs = Encoding.ASCII.GetString(rd);
if (rs.Length > 0)
{
rs = rs.Trim('\"');
return int.Parse(rs);
}
return 203;
}
catch
{
return 203;
}
}
public void CancelAll() {
try
{
string d = "~JA\n";
var b = Encoding.ASCII.GetBytes(d);
printerConnection.Write(b);
}
catch
{
}
}
public void PauseMode()
{
try
{
string d = "~PP\n";
var b = Encoding.ASCII.GetBytes(d);
printerConnection.Write(b);
}
catch
{
}
}
public void PrintStartMode()
{
string d = "~PS\n";
var b = Encoding.ASCII.GetBytes(d);
printerConnection.Write(b);
}
public bool IsPrinterReady(out string msg) {
msg = "";
var status = GetStatus();
string[] printerStatusString = new PrinterStatusMessages(status).GetStatusMessage();
if (printerStatusString.Length > 0)
{
msg = string.Join("\r\n", printerStatusString);
return false;
}
if (status.numberOfFormatsInReceiveBuffer > 0)
{
msg = "打印机缓冲池内有未打印文档";
return false;
}
return true;
}
public PrinterStatus GetStatus() {
if (printerConnection == null || !printerConnection.Connected)
{
if (!Connection(out string m))
{
//msg = m;
//return false;
}
}
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(printerConnection);
ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(printer);
return (linkOsPrinter != null) ? linkOsPrinter.GetCurrentStatus() : printer.GetCurrentStatus();
}
}
public enum ConnectionType
{
[Description("Network")]
Network,
[Description("USB")]
USB,
[Description("USB Direct")]
UsbDirect,
[Description("Bluetooth")]
Bluetooth
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{E4F7AFC7-2F6D-4685-8350-3C05697428EA}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ZebraPrinterHelper</RootNamespace>
<AssemblyName>ZebraPrinterHelper</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</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>
<ItemGroup>
<Reference Include="SdkApi.Core">
<HintPath>..\Source\Sdk\SdkApi.Core.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop">
<HintPath>..\Source\Sdk\SdkApi.Desktop.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop.Usb">
<HintPath>..\Source\Sdk\SdkApi.Desktop.Usb.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ZebraManger.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="ZPL Guide ENG.pdf" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!