Test idea of wrapping source identity into .net class.

This commit is contained in:
soukoku
2014-05-19 20:48:21 -04:00
parent f17692184f
commit e879c00102
50 changed files with 511 additions and 693 deletions

View File

@@ -1,4 +1,5 @@
using NTwain.Data;
using NTwain;
using NTwain.Data;
namespace Tester.WPF
{
@@ -7,9 +8,9 @@ namespace Tester.WPF
/// </summary>
class DSVM
{
public TWIdentity DS { get; set; }
public TwainSource DS { get; set; }
public string Name { get { return DS.ProductName; } }
public string Name { get { return DS.Name; } }
public string Version { get { return DS.Version.Info; } }
public string Protocol { get { return string.Format("{0}.{1}", DS.ProtocolMajor, DS.ProtocolMinor); } }
}

View File

@@ -68,9 +68,9 @@ namespace Tester.WPF
{
// set it up to use file xfer
if (this.GetCurrentCap(CapabilityId.ICapXferMech).ConvertToEnum<XferMech>() == XferMech.File)
if (this.Source.GetCurrentCap(CapabilityId.ICapXferMech).ConvertToEnum<XferMech>() == XferMech.File)
{
var formats = this.CapGetImageFileFormat();
var formats = this.Source.CapGetImageFileFormat();
var wantFormat = formats.Contains(FileFormat.Tiff) ? FileFormat.Tiff : FileFormat.Bmp;
var fileSetup = new TWSetupFileXfer
@@ -110,17 +110,17 @@ namespace Tester.WPF
{
if (State == 4)
{
if (this.CapGetPixelTypes().Contains(PixelType.BlackWhite))
if (this.Source.CapGetPixelTypes().Contains(PixelType.BlackWhite))
{
this.CapSetPixelType(PixelType.BlackWhite);
this.Source.CapSetPixelType(PixelType.BlackWhite);
}
if (this.CapGetImageXferMechs().Contains(XferMech.File))
if (this.Source.CapGetImageXferMechs().Contains(XferMech.File))
{
this.CapSetImageXferMech(XferMech.File);
this.Source.CapSetImageXferMech(XferMech.File);
}
var rc = EnableSource(SourceEnableMode.NoUI, false, hwnd);
var rc = this.Source.StartTransfer(SourceEnableMode.NoUI, false, hwnd);
}
}
}