mirror of
https://github.com/soukoku/ntwain.git
synced 2025-10-24 18:29:04 +08:00
Test idea of wrapping source identity into .net class.
This commit is contained in:
@@ -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); } }
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user