mirror of
https://github.com/soukoku/ntwain.git
synced 2025-10-25 10:59:03 +08:00
Initial move from old twain-in-dotnet.
This commit is contained in:
19
Tests/Tester.Winform/Program.cs
Normal file
19
Tests/Tester.Winform/Program.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Tester.Winform
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new TestForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Tests/Tester.Winform/Properties/AssemblyInfo.cs
Normal file
36
Tests/Tester.Winform/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Tester.Winform")]
|
||||
[assembly: AssemblyDescription("Winform app for quick testing implementations in the TWAIN lib.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Yin-Chun Wang")]
|
||||
[assembly: AssemblyProduct("Tester.Winform")]
|
||||
[assembly: AssemblyCopyright("Copyright © Yin-Chun Wang 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("81c482ce-db1a-45ac-8db8-86a784082c1b")]
|
||||
|
||||
|
||||
// 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")]
|
||||
63
Tests/Tester.Winform/Properties/Resources.Designer.cs
generated
Normal file
63
Tests/Tester.Winform/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18034
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tester.Winform.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", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tester.Winform.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Tests/Tester.Winform/Properties/Resources.resx
Normal file
117
Tests/Tester.Winform/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
Tests/Tester.Winform/Properties/Settings.Designer.cs
generated
Normal file
26
Tests/Tester.Winform/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18034
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tester.Winform.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Tests/Tester.Winform/Properties/Settings.settings
Normal file
7
Tests/Tester.Winform/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
328
Tests/Tester.Winform/TestForm.Designer.cs
generated
Normal file
328
Tests/Tester.Winform/TestForm.Designer.cs
generated
Normal file
@@ -0,0 +1,328 @@
|
||||
namespace Tester.Winform
|
||||
{
|
||||
partial class TestForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm));
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.btnSources = new System.Windows.Forms.ToolStripDropDownButton();
|
||||
this.sepSourceList = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.reloadSourcesListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnStartCapture = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnStopScan = new System.Windows.Forms.ToolStripButton();
|
||||
this.btnSaveImage = new System.Windows.Forms.ToolStripButton();
|
||||
this.panelOptions = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.groupDuplex = new System.Windows.Forms.GroupBox();
|
||||
this.ckDuplex = new System.Windows.Forms.CheckBox();
|
||||
this.groupSize = new System.Windows.Forms.GroupBox();
|
||||
this.comboSize = new System.Windows.Forms.ComboBox();
|
||||
this.groupDepth = new System.Windows.Forms.GroupBox();
|
||||
this.comboDepth = new System.Windows.Forms.ComboBox();
|
||||
this.groupDPI = new System.Windows.Forms.GroupBox();
|
||||
this.comboDPI = new System.Windows.Forms.ComboBox();
|
||||
this.btnAllSettings = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.panelOptions.SuspendLayout();
|
||||
this.groupDuplex.SuspendLayout();
|
||||
this.groupSize.SuspendLayout();
|
||||
this.groupDepth.SuspendLayout();
|
||||
this.groupDPI.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(222, 25);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(580, 430);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pictureBox1.TabIndex = 1;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// saveFileDialog1
|
||||
//
|
||||
this.saveFileDialog1.FileName = "Test";
|
||||
this.saveFileDialog1.Filter = "png files|*.png";
|
||||
this.saveFileDialog1.Title = "Save Image";
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnSources,
|
||||
this.btnStartCapture,
|
||||
this.btnStopScan,
|
||||
this.btnSaveImage});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(802, 25);
|
||||
this.toolStrip1.TabIndex = 2;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// btnSources
|
||||
//
|
||||
this.btnSources.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.btnSources.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.sepSourceList,
|
||||
this.reloadSourcesListToolStripMenuItem});
|
||||
this.btnSources.Image = ((System.Drawing.Image)(resources.GetObject("btnSources.Image")));
|
||||
this.btnSources.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnSources.Name = "btnSources";
|
||||
this.btnSources.Size = new System.Drawing.Size(94, 22);
|
||||
this.btnSources.Text = "Select &sources";
|
||||
this.btnSources.DropDownOpening += new System.EventHandler(this.btnSources_DropDownOpening);
|
||||
//
|
||||
// sepSourceList
|
||||
//
|
||||
this.sepSourceList.Name = "sepSourceList";
|
||||
this.sepSourceList.Size = new System.Drawing.Size(168, 6);
|
||||
//
|
||||
// reloadSourcesListToolStripMenuItem
|
||||
//
|
||||
this.reloadSourcesListToolStripMenuItem.Name = "reloadSourcesListToolStripMenuItem";
|
||||
this.reloadSourcesListToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
|
||||
this.reloadSourcesListToolStripMenuItem.Text = "&Reload sources list";
|
||||
this.reloadSourcesListToolStripMenuItem.Click += new System.EventHandler(this.reloadSourcesListToolStripMenuItem_Click);
|
||||
//
|
||||
// btnStartCapture
|
||||
//
|
||||
this.btnStartCapture.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.btnStartCapture.Enabled = false;
|
||||
this.btnStartCapture.Image = ((System.Drawing.Image)(resources.GetObject("btnStartCapture.Image")));
|
||||
this.btnStartCapture.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnStartCapture.Name = "btnStartCapture";
|
||||
this.btnStartCapture.Size = new System.Drawing.Size(62, 22);
|
||||
this.btnStartCapture.Text = "S&tart scan";
|
||||
this.btnStartCapture.Click += new System.EventHandler(this.btnStartCapture_Click);
|
||||
//
|
||||
// btnStopScan
|
||||
//
|
||||
this.btnStopScan.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.btnStopScan.Enabled = false;
|
||||
this.btnStopScan.Image = ((System.Drawing.Image)(resources.GetObject("btnStopScan.Image")));
|
||||
this.btnStopScan.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnStopScan.Name = "btnStopScan";
|
||||
this.btnStopScan.Size = new System.Drawing.Size(62, 22);
|
||||
this.btnStopScan.Text = "Sto&p scan";
|
||||
this.btnStopScan.Click += new System.EventHandler(this.btnStopScan_Click);
|
||||
//
|
||||
// btnSaveImage
|
||||
//
|
||||
this.btnSaveImage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.btnSaveImage.Image = ((System.Drawing.Image)(resources.GetObject("btnSaveImage.Image")));
|
||||
this.btnSaveImage.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnSaveImage.Name = "btnSaveImage";
|
||||
this.btnSaveImage.Size = new System.Drawing.Size(71, 22);
|
||||
this.btnSaveImage.Text = "S&ave image";
|
||||
this.btnSaveImage.Click += new System.EventHandler(this.btnSaveImage_Click);
|
||||
//
|
||||
// panelOptions
|
||||
//
|
||||
this.panelOptions.AutoScroll = true;
|
||||
this.panelOptions.ColumnCount = 1;
|
||||
this.panelOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panelOptions.Controls.Add(this.groupDuplex, 0, 3);
|
||||
this.panelOptions.Controls.Add(this.groupSize, 0, 2);
|
||||
this.panelOptions.Controls.Add(this.groupDepth, 0, 1);
|
||||
this.panelOptions.Controls.Add(this.groupDPI, 0, 0);
|
||||
this.panelOptions.Controls.Add(this.btnAllSettings, 0, 6);
|
||||
this.panelOptions.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panelOptions.Location = new System.Drawing.Point(0, 25);
|
||||
this.panelOptions.Name = "panelOptions";
|
||||
this.panelOptions.RowCount = 7;
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panelOptions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panelOptions.Size = new System.Drawing.Size(222, 430);
|
||||
this.panelOptions.TabIndex = 3;
|
||||
//
|
||||
// groupDuplex
|
||||
//
|
||||
this.groupDuplex.Controls.Add(this.ckDuplex);
|
||||
this.groupDuplex.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupDuplex.Enabled = false;
|
||||
this.groupDuplex.Location = new System.Drawing.Point(8, 203);
|
||||
this.groupDuplex.Margin = new System.Windows.Forms.Padding(8);
|
||||
this.groupDuplex.Name = "groupDuplex";
|
||||
this.groupDuplex.Size = new System.Drawing.Size(206, 58);
|
||||
this.groupDuplex.TabIndex = 6;
|
||||
this.groupDuplex.TabStop = false;
|
||||
this.groupDuplex.Text = "Duplex";
|
||||
//
|
||||
// ckDuplex
|
||||
//
|
||||
this.ckDuplex.AutoSize = true;
|
||||
this.ckDuplex.Location = new System.Drawing.Point(18, 24);
|
||||
this.ckDuplex.Name = "ckDuplex";
|
||||
this.ckDuplex.Size = new System.Drawing.Size(65, 17);
|
||||
this.ckDuplex.TabIndex = 0;
|
||||
this.ckDuplex.Text = "Enabled";
|
||||
this.ckDuplex.UseVisualStyleBackColor = true;
|
||||
this.ckDuplex.CheckedChanged += new System.EventHandler(this.ckDuplex_CheckedChanged);
|
||||
//
|
||||
// groupSize
|
||||
//
|
||||
this.groupSize.Controls.Add(this.comboSize);
|
||||
this.groupSize.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupSize.Enabled = false;
|
||||
this.groupSize.Location = new System.Drawing.Point(8, 138);
|
||||
this.groupSize.Margin = new System.Windows.Forms.Padding(8, 8, 8, 3);
|
||||
this.groupSize.Name = "groupSize";
|
||||
this.groupSize.Size = new System.Drawing.Size(206, 54);
|
||||
this.groupSize.TabIndex = 5;
|
||||
this.groupSize.TabStop = false;
|
||||
this.groupSize.Text = "Size";
|
||||
//
|
||||
// comboSize
|
||||
//
|
||||
this.comboSize.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboSize.FormattingEnabled = true;
|
||||
this.comboSize.Location = new System.Drawing.Point(18, 19);
|
||||
this.comboSize.Name = "comboSize";
|
||||
this.comboSize.Size = new System.Drawing.Size(169, 21);
|
||||
this.comboSize.TabIndex = 0;
|
||||
this.comboSize.SelectedIndexChanged += new System.EventHandler(this.comboSize_SelectedIndexChanged);
|
||||
//
|
||||
// groupDepth
|
||||
//
|
||||
this.groupDepth.Controls.Add(this.comboDepth);
|
||||
this.groupDepth.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupDepth.Enabled = false;
|
||||
this.groupDepth.Location = new System.Drawing.Point(8, 73);
|
||||
this.groupDepth.Margin = new System.Windows.Forms.Padding(8, 8, 8, 3);
|
||||
this.groupDepth.Name = "groupDepth";
|
||||
this.groupDepth.Size = new System.Drawing.Size(206, 54);
|
||||
this.groupDepth.TabIndex = 4;
|
||||
this.groupDepth.TabStop = false;
|
||||
this.groupDepth.Text = "Depth";
|
||||
//
|
||||
// comboDepth
|
||||
//
|
||||
this.comboDepth.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboDepth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboDepth.FormattingEnabled = true;
|
||||
this.comboDepth.Location = new System.Drawing.Point(18, 19);
|
||||
this.comboDepth.Name = "comboDepth";
|
||||
this.comboDepth.Size = new System.Drawing.Size(169, 21);
|
||||
this.comboDepth.TabIndex = 0;
|
||||
this.comboDepth.SelectedIndexChanged += new System.EventHandler(this.comboDepth_SelectedIndexChanged);
|
||||
//
|
||||
// groupDPI
|
||||
//
|
||||
this.groupDPI.Controls.Add(this.comboDPI);
|
||||
this.groupDPI.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.groupDPI.Enabled = false;
|
||||
this.groupDPI.Location = new System.Drawing.Point(8, 8);
|
||||
this.groupDPI.Margin = new System.Windows.Forms.Padding(8, 8, 8, 3);
|
||||
this.groupDPI.Name = "groupDPI";
|
||||
this.groupDPI.Size = new System.Drawing.Size(206, 54);
|
||||
this.groupDPI.TabIndex = 0;
|
||||
this.groupDPI.TabStop = false;
|
||||
this.groupDPI.Text = "DPI";
|
||||
//
|
||||
// comboDPI
|
||||
//
|
||||
this.comboDPI.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboDPI.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboDPI.FormattingEnabled = true;
|
||||
this.comboDPI.Location = new System.Drawing.Point(18, 19);
|
||||
this.comboDPI.Name = "comboDPI";
|
||||
this.comboDPI.Size = new System.Drawing.Size(169, 21);
|
||||
this.comboDPI.TabIndex = 0;
|
||||
this.comboDPI.SelectedIndexChanged += new System.EventHandler(this.comboDPI_SelectedIndexChanged);
|
||||
//
|
||||
// btnAllSettings
|
||||
//
|
||||
this.btnAllSettings.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.btnAllSettings.Enabled = false;
|
||||
this.btnAllSettings.Location = new System.Drawing.Point(34, 312);
|
||||
this.btnAllSettings.Name = "btnAllSettings";
|
||||
this.btnAllSettings.Size = new System.Drawing.Size(153, 23);
|
||||
this.btnAllSettings.TabIndex = 7;
|
||||
this.btnAllSettings.Text = "Open driver settings";
|
||||
this.btnAllSettings.UseVisualStyleBackColor = true;
|
||||
this.btnAllSettings.Click += new System.EventHandler(this.btnAllSettings_Click);
|
||||
//
|
||||
// TestForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(802, 455);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.panelOptions);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Name = "TestForm";
|
||||
this.Text = "Test Form";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
this.toolStrip1.PerformLayout();
|
||||
this.panelOptions.ResumeLayout(false);
|
||||
this.groupDuplex.ResumeLayout(false);
|
||||
this.groupDuplex.PerformLayout();
|
||||
this.groupSize.ResumeLayout(false);
|
||||
this.groupDepth.ResumeLayout(false);
|
||||
this.groupDPI.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripDropDownButton btnSources;
|
||||
private System.Windows.Forms.ToolStripSeparator sepSourceList;
|
||||
private System.Windows.Forms.ToolStripMenuItem reloadSourcesListToolStripMenuItem;
|
||||
private System.Windows.Forms.TableLayoutPanel panelOptions;
|
||||
private System.Windows.Forms.GroupBox groupDPI;
|
||||
private System.Windows.Forms.GroupBox groupDepth;
|
||||
private System.Windows.Forms.GroupBox groupSize;
|
||||
private System.Windows.Forms.GroupBox groupDuplex;
|
||||
private System.Windows.Forms.ComboBox comboDPI;
|
||||
private System.Windows.Forms.ComboBox comboSize;
|
||||
private System.Windows.Forms.ComboBox comboDepth;
|
||||
private System.Windows.Forms.ToolStripButton btnStartCapture;
|
||||
private System.Windows.Forms.ToolStripButton btnStopScan;
|
||||
private System.Windows.Forms.ToolStripButton btnSaveImage;
|
||||
private System.Windows.Forms.CheckBox ckDuplex;
|
||||
private System.Windows.Forms.Button btnAllSettings;
|
||||
}
|
||||
}
|
||||
|
||||
372
Tests/Tester.Winform/TestForm.cs
Normal file
372
Tests/Tester.Winform/TestForm.cs
Normal file
@@ -0,0 +1,372 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using NTwain.Triplets;
|
||||
using NTwain;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using NTwain.Values.Cap;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using CommonWin32;
|
||||
|
||||
namespace Tester.Winform
|
||||
{
|
||||
sealed partial class TestForm : Form
|
||||
{
|
||||
ImageCodecInfo _tiffCodecInfo;
|
||||
TwainSession _twain;
|
||||
bool _stopScan;
|
||||
bool _loadingCaps;
|
||||
|
||||
|
||||
#region setup & cleanup
|
||||
|
||||
public TestForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (IntPtr.Size == 8)
|
||||
{
|
||||
Text = Text + " (64bit)";
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = Text + " (32bit)";
|
||||
}
|
||||
foreach (var enc in ImageCodecInfo.GetImageEncoders())
|
||||
{
|
||||
if (enc.MimeType == "image/tiff") { _tiffCodecInfo = enc; break; }
|
||||
}
|
||||
SetupTwain();
|
||||
}
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
if (e.CloseReason == CloseReason.UserClosing && _twain.State > 4)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CleanupTwain();
|
||||
}
|
||||
base.OnFormClosing(e);
|
||||
}
|
||||
|
||||
private void SetupTwain()
|
||||
{
|
||||
var appVer = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
|
||||
|
||||
TWIdentity appId = TWIdentity.Create(DataGroups.Image, new Version(appVer.ProductMajorPart, appVer.ProductMinorPart),
|
||||
"My Company", "Test Family", "Tester", "A TWAIN testing app.");
|
||||
_twain = new TwainSession(appId);
|
||||
_twain.DataTransferred += (s, e) =>
|
||||
{
|
||||
if (pictureBox1.Image != null)
|
||||
{
|
||||
pictureBox1.Image.Dispose();
|
||||
pictureBox1.Image = null;
|
||||
}
|
||||
if (e.Data != IntPtr.Zero)
|
||||
{
|
||||
//_ptrTest = e.Data;
|
||||
var img = e.Data.GetDrawingBitmap();
|
||||
if (img != null)
|
||||
pictureBox1.Image = img;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(e.FilePath))
|
||||
{
|
||||
var img = new Bitmap(e.FilePath);
|
||||
pictureBox1.Image = img;
|
||||
}
|
||||
};
|
||||
_twain.SourceDisabled += (s, e) =>
|
||||
{
|
||||
btnStopScan.Enabled = false;
|
||||
btnStartCapture.Enabled = true;
|
||||
panelOptions.Enabled = true;
|
||||
LoadSourceCaps();
|
||||
};
|
||||
_twain.TransferReady += (s, e) =>
|
||||
{
|
||||
e.CancelAll = _stopScan;
|
||||
};
|
||||
Application.AddMessageFilter(_twain);
|
||||
}
|
||||
|
||||
private void CleanupTwain()
|
||||
{
|
||||
Application.RemoveMessageFilter(_twain);
|
||||
if (_twain.State == 4)
|
||||
{
|
||||
_twain.CloseSource();
|
||||
}
|
||||
if (_twain.State == 3)
|
||||
{
|
||||
_twain.CloseManager();
|
||||
}
|
||||
|
||||
if (_twain.State > 2)
|
||||
{
|
||||
// normal close down didn't work, do hard kill
|
||||
_twain.ForceStepDown(2);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region toolbar
|
||||
|
||||
private void btnSources_DropDownOpening(object sender, EventArgs e)
|
||||
{
|
||||
if (btnSources.DropDownItems.Count == 2)
|
||||
{
|
||||
ReloadSourceList();
|
||||
}
|
||||
}
|
||||
|
||||
private void reloadSourcesListToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ReloadSourceList();
|
||||
}
|
||||
|
||||
void SourceMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
// do nothing if source is enabled
|
||||
if (_twain.State > 4) { return; }
|
||||
|
||||
if (_twain.State == 4) { _twain.CloseSource(); }
|
||||
|
||||
foreach (var btn in btnSources.DropDownItems)
|
||||
{
|
||||
var srcBtn = btn as ToolStripMenuItem;
|
||||
if (srcBtn != null) { srcBtn.Checked = false; }
|
||||
}
|
||||
|
||||
var curBtn = (sender as ToolStripMenuItem);
|
||||
var src = curBtn.Tag as TWIdentity;
|
||||
if (_twain.OpenSource(src) == ReturnCode.Success)
|
||||
{
|
||||
curBtn.Checked = true;
|
||||
btnStartCapture.Enabled = true;
|
||||
LoadSourceCaps();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStartCapture_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_twain.State == 4)
|
||||
{
|
||||
var hand = new HandleRef(this, this.Handle);
|
||||
_stopScan = false;
|
||||
|
||||
if (_twain.SupportedCaps.Contains(CapabilityId.CapUIControllable))
|
||||
{
|
||||
// hide scanner ui if possible
|
||||
if (_twain.EnableSource(SourceEnableMode.NoUI, false, hand) == ReturnCode.Success)
|
||||
{
|
||||
btnStopScan.Enabled = true;
|
||||
btnStartCapture.Enabled = false;
|
||||
panelOptions.Enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_twain.EnableSource(SourceEnableMode.ShowUI, false, hand) == ReturnCode.Success)
|
||||
{
|
||||
btnStopScan.Enabled = true;
|
||||
btnStartCapture.Enabled = false;
|
||||
panelOptions.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStopScan_Click(object sender, EventArgs e)
|
||||
{
|
||||
_stopScan = true;
|
||||
}
|
||||
|
||||
private void btnSaveImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
var img = pictureBox1.Image;
|
||||
|
||||
if (img != null)
|
||||
{
|
||||
switch (img.PixelFormat)
|
||||
{
|
||||
case PixelFormat.Format1bppIndexed:
|
||||
saveFileDialog1.Filter = "tiff files|*.tif";
|
||||
break;
|
||||
default:
|
||||
saveFileDialog1.Filter = "png files|*.png";
|
||||
break;
|
||||
}
|
||||
|
||||
if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
if (saveFileDialog1.FileName.EndsWith(".tif", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
EncoderParameters tiffParam = new EncoderParameters(1);
|
||||
|
||||
tiffParam.Param[0] = new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionCCITT4);
|
||||
|
||||
pictureBox1.Image.Save(saveFileDialog1.FileName, _tiffCodecInfo, tiffParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox1.Image.Save(saveFileDialog1.FileName, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region real work
|
||||
|
||||
private void ReloadSourceList()
|
||||
{
|
||||
if (_twain.State < 3)
|
||||
{
|
||||
_twain.OpenManager(new HandleRef(this, this.Handle));
|
||||
}
|
||||
|
||||
if (_twain.State >= 3)
|
||||
{
|
||||
while (btnSources.DropDownItems.IndexOf(sepSourceList) > 0)
|
||||
{
|
||||
var first = btnSources.DropDownItems[0];
|
||||
first.Click -= SourceMenuItem_Click;
|
||||
btnSources.DropDownItems.Remove(first);
|
||||
}
|
||||
foreach (var src in _twain.GetSources())
|
||||
{
|
||||
var srcBtn = new ToolStripMenuItem(src.ProductName);
|
||||
srcBtn.Tag = src;
|
||||
srcBtn.Click += SourceMenuItem_Click;
|
||||
srcBtn.Checked = _twain.SourceId != null && _twain.SourceId.Id == src.Id;
|
||||
btnSources.DropDownItems.Insert(0, srcBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region cap control
|
||||
|
||||
|
||||
private void LoadSourceCaps()
|
||||
{
|
||||
var caps = _twain.SupportedCaps;
|
||||
_loadingCaps = true;
|
||||
if (groupDepth.Enabled = caps.Contains(CapabilityId.ICapPixelType))
|
||||
{
|
||||
LoadDepth();
|
||||
}
|
||||
if (groupDPI.Enabled = caps.Contains(CapabilityId.ICapXResolution) && caps.Contains(CapabilityId.ICapYResolution))
|
||||
{
|
||||
LoadDPI();
|
||||
}
|
||||
// TODO: find out if this is how duplex works or also needs the other option
|
||||
if (groupDuplex.Enabled = caps.Contains(CapabilityId.CapDuplexEnabled))
|
||||
{
|
||||
LoadDuplex();
|
||||
}
|
||||
if (groupSize.Enabled = caps.Contains(CapabilityId.ICapSupportedSizes))
|
||||
{
|
||||
LoadPaperSize();
|
||||
}
|
||||
btnAllSettings.Enabled = caps.Contains(CapabilityId.CapEnableDSUIOnly);
|
||||
_loadingCaps = false;
|
||||
}
|
||||
|
||||
private void LoadPaperSize()
|
||||
{
|
||||
var list = _twain.CapGetSupportedSizes();
|
||||
comboSize.DataSource = list;
|
||||
var cur = _twain.GetCurrentCap<SupportedSize>(CapabilityId.ICapSupportedSizes);
|
||||
if (list.Contains(cur))
|
||||
{
|
||||
comboSize.SelectedItem = cur;
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadDuplex()
|
||||
{
|
||||
ckDuplex.Checked = _twain.GetCurrentCap<uint>(CapabilityId.CapDuplexEnabled) != 0;
|
||||
}
|
||||
|
||||
private void LoadDPI()
|
||||
{
|
||||
// only allow dpi of certain values for those source that lists everything
|
||||
var list = _twain.CapGetDPIs().Where(dpi => (dpi % 50) == 0).ToList();
|
||||
comboDPI.DataSource = list;
|
||||
var cur = _twain.GetCurrentCap<int>(CapabilityId.ICapXResolution);
|
||||
if (list.Contains(cur))
|
||||
{
|
||||
comboDPI.SelectedItem = cur;
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadDepth()
|
||||
{
|
||||
var list = _twain.CapGetPixelTypes();
|
||||
comboDepth.DataSource = list;
|
||||
var cur = _twain.GetCurrentCap<PixelType>(CapabilityId.ICapPixelType);
|
||||
if (list.Contains(cur))
|
||||
{
|
||||
comboDepth.SelectedItem = cur;
|
||||
}
|
||||
}
|
||||
|
||||
private void comboSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_loadingCaps && _twain.State == 4)
|
||||
{
|
||||
var sel = (SupportedSize)comboSize.SelectedItem;
|
||||
_twain.CapSetSupportedSize(sel);
|
||||
}
|
||||
}
|
||||
|
||||
private void comboDepth_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_loadingCaps && _twain.State == 4)
|
||||
{
|
||||
var sel = (PixelType)comboDepth.SelectedItem;
|
||||
_twain.CapSetPixelType(sel);
|
||||
}
|
||||
}
|
||||
|
||||
private void comboDPI_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_loadingCaps && _twain.State == 4)
|
||||
{
|
||||
var sel = (int)comboDPI.SelectedItem;
|
||||
_twain.CapSetDPI(sel);
|
||||
}
|
||||
}
|
||||
|
||||
private void ckDuplex_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_loadingCaps && _twain.State == 4)
|
||||
{
|
||||
_twain.CapSetDuplex(ckDuplex.Checked);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAllSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
var hand = new HandleRef(this, this.Handle);
|
||||
_twain.EnableSource(SourceEnableMode.ShowUIOnly, true, hand);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
187
Tests/Tester.Winform/TestForm.resx
Normal file
187
Tests/Tester.Winform/TestForm.resx
Normal file
@@ -0,0 +1,187 @@
|
||||
<?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=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>
|
||||
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>153, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="btnSources.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnStartCapture.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnStopScan.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnSaveImage.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
99
Tests/Tester.Winform/Tester.Winform.csproj
Normal file
99
Tests/Tester.Winform/Tester.Winform.csproj
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{4FC243F1-318E-4FA9-9EBD-2CA3A8F35425}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Tester.Winform</RootNamespace>
|
||||
<AssemblyName>Tester.Winform</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</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|x86' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CommonWin32, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a0a4edcfe233918d, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\CommonWin32.2.0.4\lib\net35-Client\CommonWin32.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TestForm.Designer.cs">
|
||||
<DependentUpon>TestForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="TestForm.resx">
|
||||
<DependentUpon>TestForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\NTwain\NTwain.csproj">
|
||||
<Project>{0C5A6FB1-0282-4D61-8354-68DEB1515001}</Project>
|
||||
<Name>NTwain</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
3
Tests/Tester.Winform/app.config
Normal file
3
Tests/Tester.Winform/app.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v2.0.50727" sku="Client"/></startup></configuration>
|
||||
4
Tests/Tester.Winform/packages.config
Normal file
4
Tests/Tester.Winform/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CommonWin32" version="2.0.4" targetFramework="net35-Client" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user