Some non-functional change updates.

This commit is contained in:
soukoku 2014-09-11 21:14:41 -04:00
parent 669de30345
commit 9415d5d43d
17 changed files with 172 additions and 140 deletions

View File

@ -2,32 +2,33 @@
using System;
using System.Runtime.InteropServices;
using TW_BOOL = System.UInt16; // unsigned short
// The following TWAIN basic types are mapped with "using"
// to aid in mapping against the twain.h file using copy-paste.
// Consumers will not see those names.
using TW_BOOL = System.UInt16; // unsigned short
// use HandleRef instead?
using TW_HANDLE = System.IntPtr; // HANDLE, todo: should really be uintptr?
using TW_MEMREF = System.IntPtr; // LPVOID
using TW_UINTPTR = System.UIntPtr; // UINT_PTR
using TW_INT16 = System.Int16; // short
using TW_INT32 = System.Int32; // long
using TW_INT8 = System.SByte; // char
using TW_MEMREF = System.IntPtr; // LPVOID
using TW_UINT16 = System.UInt16; // unsigned short
using TW_UINT32 = System.UInt32; // unsigned long
using TW_UINT8 = System.Byte; // unsigned char
// iffy
using TW_UINTPTR = System.UIntPtr; // UINT_PTR
// This mono doc is awesome. An interop must-read
// http://www.mono-project.com/Interop_with_Native_Libraries
// http://www.mono-project.com/Interop_with_Native_Libraries (old)
// http://www.mono-project.com/docs/advanced/pinvoke/ (new url)
//////////////////////////////////
// most of the doc text are copied
// from the twain pdf. Data that
// Data structures that
// are passed to the TWAIN method
// are defined as classes to reduce
// ref/out in the low-level calls.
@ -321,7 +322,7 @@ namespace NTwain.Data
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial struct TWMemory
{
// not a class due to being embedded next
// this is not a class due to being embedded by other classes
TW_UINT32 _flags;
TW_UINT32 _length;
@ -448,8 +449,8 @@ namespace NTwain.Data
[StructLayout(LayoutKind.Sequential, Pack = 2)]
partial class TWStatusUtf8
{
// NOTE: rather than embedding the twstatus directly use its fields instead
// so the twstatus could become a class object. If twstatus changes
// NOTE: rather than embedding the TWStatus directly I'm using its fields instead
// so the TWStatus could become a class object. If TWStatus changes
// definition remember to change it here
TW_UINT16 _conditionCode;
TW_UINT16 _data;

View File

@ -13,13 +13,15 @@ namespace NTwain.Data
{
//// This file contains custom logic added to the twain types.
//// Separating the field definitions out makes finding all the
//// custom code logic easier. Mostly this is just making the fields
//// Separating the raw field definitions out makes finding all the
//// custom code logic easier. Mostly this just makes the fields
//// into .net friendly properties.
//// potentially unit tests for the twain types only need to target
//// code in this file since everything else is just interop and
//// field definitions (pretty much have to hope it's correct).
//// field definitions.
//// most of the doc text are copied from the twain spec pdf.
/// <summary>

View File

@ -39,7 +39,7 @@ namespace NTwain.Internals
/// <returns></returns>
ICommittable GetPendingStateChanger(int newState);
void ChangeSourceId(TwainSource source);
void ChangeCurrentSource(TwainSource source);
ReturnCode DisableSource();
@ -48,6 +48,7 @@ namespace NTwain.Internals
void SafeSyncableRaiseEvent(TransferReadyEventArgs e);
ReturnCode EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle);
SynchronizationContext SynchronizationContext { get; set; }
/// <summary>

View File

@ -1,4 +1,5 @@
using System;
using NTwain.Triplets;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -22,8 +23,8 @@ namespace NTwain
if (IsWin)
{
var newDsmPath = Path.Combine(Environment.SystemDirectory, "twaindsm.dll");
var oldDsmPath = Path.Combine(Environment.SystemDirectory, "twain_32.dll");
var newDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_NEW_DSM_NAME);
var oldDsmPath = Path.Combine(Environment.SystemDirectory, Dsm.WIN_OLD_DSM_NAME);
if (IsApp64bit)
{
@ -44,11 +45,12 @@ namespace NTwain
}
else if (IsLinux)
{
DsmExists = File.Exists(Triplets.Dsm.LINUX_DSM_PATH);
DsmExists = File.Exists(Dsm.LINUX_DSM_PATH);
IsSupported = DsmExists && IsOnMono;
}
else
{
// mac? not gonna happen
}
_defaultMemManager = new WinMemoryManager();
@ -56,8 +58,17 @@ namespace NTwain
// prefer the use of the twain dsm on windows.
internal static readonly bool UseNewWinDSM;
internal static readonly bool IsOnMono;
internal static readonly bool IsWin;
internal static readonly bool IsLinux;
internal static readonly bool IsApp64bit;
/// <summary>
/// Gets a value indicating whether the application is running in 64-bit.
/// </summary>
/// <value>
/// <c>true</c> if the application is 64-bit; otherwise, <c>false</c>.
/// </value>
public static bool IsApp64bit { get; private set; }
/// <summary>
/// Gets a value indicating whether the applicable TWAIN DSM library exists in the operating system.
@ -67,13 +78,9 @@ namespace NTwain
/// </value>
public static bool DsmExists { get; private set; }
internal static readonly bool IsOnMono;
internal static readonly bool IsWin;
internal static readonly bool IsLinux;
/// <summary>
/// Gets a value indicating whether this library is supported on current OS.
/// Check the other platform properties to determine the reason if this is false.
/// </summary>
/// <value>
/// <c>true</c> if this library is supported; otherwise, <c>false</c>.
@ -86,7 +93,7 @@ namespace NTwain
/// <summary>
/// Gets the <see cref="IMemoryManager"/> for communicating with data sources.
/// This should only be used after the DSM has been opened.
/// This should only be used when a <see cref="TwainSession"/> is open.
/// </summary>
/// <value>
/// The memory manager.

View File

@ -23,7 +23,7 @@ namespace NTwain.Triplets
var rc = Dsm.DsmEntry(Session.AppId, Message.CloseDS, Session.CurrentSource.Identity);
if (rc == ReturnCode.Success)
{
Session.ChangeSourceId(null);
Session.ChangeCurrentSource(null);
Session.ChangeState(3, true);
}
return rc;
@ -79,7 +79,7 @@ namespace NTwain.Triplets
var rc = Dsm.DsmEntry(Session.AppId, Message.OpenDS, source.Identity);
if (rc == ReturnCode.Success)
{
Session.ChangeSourceId(source);
Session.ChangeCurrentSource(source);
Session.ChangeState(4, true);
}
return rc;

View File

@ -5,12 +5,11 @@ using System.Runtime.InteropServices;
namespace NTwain.Triplets
{
static partial class Dsm
{
internal const string LINUX_DSM_PATH = "/usr/local/lib/libtwaindsm.so";
{
static partial class NativeMethods
{
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -19,7 +18,7 @@ namespace NTwain.Triplets
Message msg,
ref IntPtr data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -28,7 +27,7 @@ namespace NTwain.Triplets
Message msg,
ref DataGroups data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -37,7 +36,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWAudioInfo data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -46,7 +45,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCapability data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -55,7 +54,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCustomDSData data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -64,7 +63,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWDeviceEvent data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -73,7 +72,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCallback data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -82,7 +81,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCallback2 data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -91,7 +90,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWEntryPoint data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -100,7 +99,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWEvent data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -109,7 +108,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWFileSystem data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
IntPtr zero,
@ -118,7 +117,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWIdentity data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -127,7 +126,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPassThru data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -136,7 +135,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPendingXfers data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -145,7 +144,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWSetupFileXfer data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -154,7 +153,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWSetupMemXfer data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -163,7 +162,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWStatusUtf8 data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -172,7 +171,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWUserInterface data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -181,7 +180,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCieColor data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -190,7 +189,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWExtImageInfo data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -199,7 +198,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWFilter data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -208,7 +207,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWGrayResponse data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -217,7 +216,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageInfo data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -226,7 +225,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageLayout data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -235,7 +234,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageMemXfer data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -244,7 +243,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWJpegCompression data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -253,7 +252,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPalette8 data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -262,7 +261,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWRgbResponse data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -271,7 +270,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWStatus data);
[DllImport(LINUX_DSM_PATH, EntryPoint = "DSM_Entry")]
[DllImport(LINUX_DSM_PATH, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmLinux(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,

View File

@ -8,7 +8,7 @@ namespace NTwain.Triplets
{
static partial class NativeMethods
{
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -17,7 +17,7 @@ namespace NTwain.Triplets
Message msg,
ref IntPtr data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -26,7 +26,7 @@ namespace NTwain.Triplets
Message msg,
ref DataGroups data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -35,7 +35,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWAudioInfo data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -44,7 +44,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCapability data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -53,7 +53,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCustomDSData data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -62,7 +62,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWDeviceEvent data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -71,7 +71,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCallback data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -80,7 +80,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCallback2 data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -89,7 +89,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWEntryPoint data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -98,7 +98,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWEvent data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -107,7 +107,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWFileSystem data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
IntPtr zero,
@ -116,7 +116,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWIdentity data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -125,7 +125,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPassThru data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -134,7 +134,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPendingXfers data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -143,7 +143,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWSetupFileXfer data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -152,7 +152,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWSetupMemXfer data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -161,7 +161,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWStatusUtf8 data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -170,7 +170,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWUserInterface data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -179,7 +179,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCieColor data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -188,7 +188,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWExtImageInfo data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -197,7 +197,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWFilter data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -206,7 +206,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWGrayResponse data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -215,7 +215,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageInfo data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -224,7 +224,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageLayout data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -233,7 +233,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageMemXfer data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -242,7 +242,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWJpegCompression data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -251,7 +251,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPalette8 data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -260,7 +260,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWRgbResponse data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -269,7 +269,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWStatus data);
[DllImport("twaindsm", EntryPoint = "#1")]
[DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinNew(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,

View File

@ -8,7 +8,7 @@ namespace NTwain.Triplets
{
static partial class NativeMethods
{
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -17,7 +17,7 @@ namespace NTwain.Triplets
Message msg,
ref IntPtr data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -26,7 +26,7 @@ namespace NTwain.Triplets
Message msg,
ref DataGroups data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -35,7 +35,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWAudioInfo data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -44,7 +44,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCapability data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -53,7 +53,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCustomDSData data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -62,7 +62,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWDeviceEvent data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -71,7 +71,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCallback data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -80,7 +80,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCallback2 data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -89,7 +89,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWEntryPoint data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -98,7 +98,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWEvent data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -107,7 +107,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWFileSystem data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
IntPtr zero,
@ -116,7 +116,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWIdentity data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -125,7 +125,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPassThru data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -134,7 +134,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPendingXfers data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -143,7 +143,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWSetupFileXfer data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -152,7 +152,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWSetupMemXfer data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -161,7 +161,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWStatusUtf8 data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -170,7 +170,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWUserInterface data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -179,7 +179,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWCieColor data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -188,7 +188,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWExtImageInfo data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -197,7 +197,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWFilter data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -206,7 +206,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWGrayResponse data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -215,7 +215,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageInfo data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -224,7 +224,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageLayout data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -233,7 +233,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWImageMemXfer data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -242,7 +242,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWJpegCompression data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -251,7 +251,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWPalette8 data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -260,7 +260,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWRgbResponse data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,
@ -269,7 +269,7 @@ namespace NTwain.Triplets
Message msg,
[In, Out]TWStatus data);
[DllImport("twain_32", EntryPoint = "#1")]
[DllImport(WIN_OLD_DSM_NAME, EntryPoint = DSM_ENTRY)]
public static extern ReturnCode DsmWinOld(
[In, Out]TWIdentity origin,
[In, Out]TWIdentity destination,

View File

@ -10,6 +10,11 @@ namespace NTwain.Triplets
/// </summary>
static partial class Dsm
{
internal const string DSM_ENTRY = "DSM_Entry";
internal const string LINUX_DSM_PATH = "/usr/local/lib/libtwaindsm.so";
internal const string WIN_NEW_DSM_NAME = "twaindsm.dll";
internal const string WIN_OLD_DSM_NAME = "twain_32.dll";
#region wrapped calls
public static ReturnCode DsmEntry(

View File

@ -16,7 +16,7 @@ or better explained in code:
DGControl.Status.Get(...)
and that's the triplet at-a-glance. Only triplets usable by the
application-side are explicitly defined this way.
application-side are defined here.
Also some of the operations are marked as internal when there are
better wrapped managed version available. Goal is to

View File

@ -114,10 +114,10 @@ namespace NTwain
return new TentativeStateCommitable(this, newState);
}
void ITwainSessionInternal.ChangeSourceId(TwainSource source)
void ITwainSessionInternal.ChangeCurrentSource(TwainSource source)
{
CurrentSource = source;
OnPropertyChanged("SourceId");
OnPropertyChanged("CurrentSource");
SafeAsyncSyncableRaiseOnEvent(OnSourceChanged, SourceChanged);
}

View File

@ -6,6 +6,9 @@ using System.Text;
namespace NTwain
{
// this contains all cap-related methods prefixed with Cap
partial class TwainSource
{
/// <summary>

View File

@ -69,7 +69,20 @@ namespace NTwain
/// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param>
/// <param name="windowHandle">The window handle if modal.</param>
/// <returns></returns>
[Obsolete("Use Enable() instead.")]
public ReturnCode StartTransfer(SourceEnableMode mode, bool modal, IntPtr windowHandle)
{
return Enable(mode, modal, windowHandle);
}
/// <summary>
/// Enables the source to start transferring.
/// </summary>
/// <param name="mode">The mode.</param>
/// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param>
/// <param name="windowHandle">The window handle if modal.</param>
/// <returns></returns>
public ReturnCode Enable(SourceEnableMode mode, bool modal, IntPtr windowHandle)
{
return _session.EnableSource(mode, modal, windowHandle);
}
@ -261,7 +274,7 @@ namespace NTwain
#region cameras
/// <summary>
/// Gets the cameras supported by the source.
/// [Experimental] Gets the cameras supported by the source.
/// </summary>
/// <returns></returns>
public IList<string> GetCameras()
@ -286,7 +299,7 @@ namespace NTwain
}
/// <summary>
/// Sets the target camera for cap negotiation that can be set per camera.
/// [Experimental] Sets the target camera for cap negotiation that can be set per camera.
/// </summary>
/// <param name="cameraName"></param>
/// <returns></returns>

View File

@ -16,7 +16,7 @@ A nuget package is also [available here](https://www.nuget.org/packages/ntwain)
Using the lib
--------------------------------------
To properly use this lib you will need to be reasonably familiar with the TWAIN spec
and how it works in general (especially capability).
and understand how it works in general (especially capability).
The spec can be downloaded from [twain.org](http://twain.org/).
Except for those that have been abstracted away with .net equivalents, most triplet operations are
@ -24,9 +24,9 @@ provided as-is so you will need to know when and how to use them.
There are no high-level, single-line scan-a-page-for-me-now functions yet.
The main class to use is TwainSession. You can either use it directly by subscribing
to the important events or sub-class it and override the OnMethods related to those events.
to the important events or sub-class it and override the On* methods related to those events.
The sample projects contain both usages. Note that an application process should only
have one TwainSession, unless you really know what you're doing.
have one active (open) TwainSession at a time.
```
#!c#
@ -59,7 +59,7 @@ and call Open() to start using it.
```
#!c#
// choose and open a source
// choose and open the first source found
IEnumerable<TwainSources> sources = session.GetSources();
var myDS = sources.First();
myDS.Open();
@ -70,16 +70,16 @@ At this point you can negotiate with the source using all the typical TWAIN trip
The TwainSource class itself has some handy pre-defined methods for common capability negotiation
such as DPI, bitdepth, or paper size to get you started.
When you're ready to get into transfer mode, just call StartTransfer() on the source object.
When you're ready to get into transfer mode, just call Enable() on the source object.
```
#!c#
var myDS = sources.StartTransfer(...);
sources.Enable(...);
```
After transfer has completed (you are notified of this with the SourceDisabled event from session)
After transfer has completed (remember you are notified of this with the SourceDisabled event from session)
and you're done with TWAIN, you can close the source and the session in sequence to clean things up.
```
@ -120,6 +120,7 @@ newer data source manager (twaindsm.dll) from below installed.
[DSM from TWAIN.org](http://sourceforge.net/projects/twain-dsm/files/TWAIN%20DSM%202%20Win/)
Otherwise just compile and run the app as x86 and it'll use the 32-bit version (twain_32.dll) that comes with Windows.
If your scanner driver is still 32-bit (and most likely it will be) you'll have no choice but to
compile as x86 anyway, even if you have installed the newer dsm dll.
In fact, installing the new DSM is recommended whether you're running in 64-bit or not.
If the scanner's TWAIN driver is still 32-bit (and most likely it will be) then you'll have no choice but to
compile the app as x86.

View File

@ -55,7 +55,7 @@ namespace Tester
if (rc == ReturnCode.Success)
{
Console.WriteLine("Start capture from the sample source.");
rc = hit.StartTransfer(SourceEnableMode.NoUI, false, IntPtr.Zero);
rc = hit.Enable(SourceEnableMode.NoUI, false, IntPtr.Zero);
}
else
{

View File

@ -132,7 +132,7 @@ namespace Tester.WPF
this.CurrentSource.CapSetImageXferMech(XferMech.File);
}
var rc = this.CurrentSource.StartTransfer(SourceEnableMode.NoUI, false, hwnd);
var rc = this.CurrentSource.Enable(SourceEnableMode.NoUI, false, hwnd);
}
}
}

View File

@ -173,7 +173,7 @@ namespace Tester.Winform
if (_twain.CurrentSource.SupportedCaps.Contains(CapabilityId.CapUIControllable))
{
// hide scanner ui if possible
if (_twain.CurrentSource.StartTransfer(SourceEnableMode.NoUI, false, this.Handle) == ReturnCode.Success)
if (_twain.CurrentSource.Enable(SourceEnableMode.NoUI, false, this.Handle) == ReturnCode.Success)
{
btnStopScan.Enabled = true;
btnStartCapture.Enabled = false;
@ -182,7 +182,7 @@ namespace Tester.Winform
}
else
{
if (_twain.CurrentSource.StartTransfer(SourceEnableMode.ShowUI, true, this.Handle) == ReturnCode.Success)
if (_twain.CurrentSource.Enable(SourceEnableMode.ShowUI, true, this.Handle) == ReturnCode.Success)
{
btnStopScan.Enabled = true;
btnStartCapture.Enabled = false;
@ -372,7 +372,7 @@ namespace Tester.Winform
private void btnAllSettings_Click(object sender, EventArgs e)
{
_twain.CurrentSource.StartTransfer(SourceEnableMode.ShowUIOnly, true, this.Handle);
_twain.CurrentSource.Enable(SourceEnableMode.ShowUIOnly, true, this.Handle);
}
#endregion