mirror of
https://github.com/soukoku/ntwain.git
synced 2025-08-20 09:15:24 +08:00
Add method to set filexfer options on xferready event.
This commit is contained in:
parent
b2fe1c1bcd
commit
e3dfa8f4dd
@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<!--change these in each release-->
|
||||
<VersionPrefix>4.0.0.0</VersionPrefix>
|
||||
<VersionSuffix>alpha.5</VersionSuffix>
|
||||
<VersionSuffix>alpha.6</VersionSuffix>
|
||||
|
||||
<!--keep it the same until major # changes-->
|
||||
<AssemblyVersion>4.0.0.0</AssemblyVersion>
|
||||
|
||||
@ -8,11 +8,11 @@ namespace NTwain
|
||||
/// </summary>
|
||||
public class TransferReadyEventArgs : EventArgs
|
||||
{
|
||||
public TransferReadyEventArgs(TWSX imgXferMech, TWSX audXferMech, int pendingCount, TWEJ endOfJobFlag)
|
||||
public TransferReadyEventArgs(TwainAppSession twain, TWSX imgXferMech, TWSX audXferMech, int pendingCount, TWEJ endOfJobFlag)
|
||||
{
|
||||
_twain = twain;
|
||||
ImgXferMech = imgXferMech;
|
||||
AudXferMech = audXferMech;
|
||||
//_twain = twain;
|
||||
PendingCount = pendingCount;
|
||||
EndOfJobFlag = endOfJobFlag;
|
||||
}
|
||||
@ -43,9 +43,20 @@ namespace NTwain
|
||||
/// </summary>
|
||||
public int PendingCount { get; private set; }
|
||||
|
||||
//TW_IMAGEINFO? _imgInfo;
|
||||
//private readonly TwainAppSession _twain;
|
||||
private readonly TwainAppSession _twain;
|
||||
|
||||
/// <summary>
|
||||
/// If the transfer mech is file-related,
|
||||
/// setup the file transfer options here.
|
||||
/// </summary>
|
||||
/// <param name="fileXfer"></param>
|
||||
/// <returns></returns>
|
||||
public STS SetupFileTransfer(ref TW_SETUPFILEXFER fileXfer)
|
||||
{
|
||||
return _twain.SetFileXfer(ref fileXfer);
|
||||
}
|
||||
|
||||
//TW_IMAGEINFO? _imgInfo;
|
||||
///// <summary>
|
||||
///// Gets the tentative image information for the current transfer if applicable.
|
||||
///// This may differ from the final image depending on the transfer mode used (mostly when doing mem xfer).
|
||||
|
||||
@ -3,8 +3,8 @@ using NTwain.Triplets;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NTwain
|
||||
{
|
||||
namespace NTwain;
|
||||
|
||||
// this file contains property and event definitions
|
||||
|
||||
partial class TwainAppSession
|
||||
@ -16,7 +16,7 @@ namespace NTwain
|
||||
{
|
||||
get => _appIdentity;
|
||||
}
|
||||
TW_IDENTITY_LEGACY _appIdentity;
|
||||
internal TW_IDENTITY_LEGACY _appIdentity;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current (opened) data source.
|
||||
@ -34,7 +34,7 @@ namespace NTwain
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
TW_IDENTITY_LEGACY _currentDS;
|
||||
internal TW_IDENTITY_LEGACY _currentDS;
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the default data source.
|
||||
@ -167,4 +167,3 @@ namespace NTwain
|
||||
/// </summary>
|
||||
public event TwainEventDelegate<TransferredEventArgs>? Transferred;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,17 @@ namespace NTwain
|
||||
return WrapInSTS(DGImage.ExtImageInfo.Get(ref _appIdentity, ref _currentDS, ref container));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can only be called in state 6, so it's here and only exposed
|
||||
/// in transfer ready event.
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <returns></returns>
|
||||
internal STS SetFileXfer(ref TW_SETUPFILEXFER settings)
|
||||
{
|
||||
return WrapInSTS(DGControl.SetupFileXfer.Set(ref _appIdentity, ref _currentDS, ref settings));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start the transfer loop.
|
||||
@ -66,7 +77,7 @@ namespace NTwain
|
||||
{
|
||||
do
|
||||
{
|
||||
var readyArgs = new TransferReadyEventArgs(imgXferMech, audXferMech, pending.Count, (TWEJ)pending.EOJ);
|
||||
var readyArgs = new TransferReadyEventArgs(this, imgXferMech, audXferMech, pending.Count, (TWEJ)pending.EOJ);
|
||||
try
|
||||
{
|
||||
TransferReady?.Invoke(this, readyArgs);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user