mirror of
https://github.com/soukoku/ntwain.git
synced 2025-12-19 10:58:24 +08:00
Add xfermech info to transfer ready event.
This commit is contained in:
@@ -3,76 +3,88 @@ using System;
|
|||||||
|
|
||||||
namespace NTwain
|
namespace NTwain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains event data when a data transfer is ready to be processed.
|
/// Contains event data when a data transfer is ready to be processed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TransferReadyEventArgs : EventArgs
|
public class TransferReadyEventArgs : EventArgs
|
||||||
{
|
|
||||||
public TransferReadyEventArgs(int pendingCount, TWEJ endOfJobFlag)
|
|
||||||
{
|
{
|
||||||
//_twain = twain;
|
public TransferReadyEventArgs(TWSX imgXferMech, TWSX audXferMech, int pendingCount, TWEJ endOfJobFlag)
|
||||||
PendingCount = pendingCount;
|
{
|
||||||
EndOfJobFlag = endOfJobFlag;
|
ImgXferMech = imgXferMech;
|
||||||
|
AudXferMech = audXferMech;
|
||||||
|
//_twain = twain;
|
||||||
|
PendingCount = pendingCount;
|
||||||
|
EndOfJobFlag = endOfJobFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether to cancel the capture phase.
|
||||||
|
/// </summary>
|
||||||
|
public CancelType Cancel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the end of job flag value for this transfer if job control is enabled.
|
||||||
|
/// </summary>
|
||||||
|
public TWEJ EndOfJobFlag { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current transfer mech if working with images.
|
||||||
|
/// </summary>
|
||||||
|
public TWSX ImgXferMech { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current transfer mech if working with audio.
|
||||||
|
/// </summary>
|
||||||
|
public TWSX AudXferMech { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the known pending transfer count. This may not be appilicable
|
||||||
|
/// for certain scanning modes.
|
||||||
|
/// </summary>
|
||||||
|
public int PendingCount { get; private set; }
|
||||||
|
|
||||||
|
//TW_IMAGEINFO? _imgInfo;
|
||||||
|
//private readonly TwainAppSession _twain;
|
||||||
|
|
||||||
|
///// <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).
|
||||||
|
///// </summary>
|
||||||
|
//public TW_IMAGEINFO? PendingImageInfo
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// // only get it if requested since it could be slow
|
||||||
|
// if (!_imgInfo.HasValue)
|
||||||
|
// {
|
||||||
|
// if (_twain.GetImageInfo(out TW_IMAGEINFO info).RC == TWRC.SUCCESS)
|
||||||
|
// {
|
||||||
|
// _imgInfo = info;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return _imgInfo;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public enum CancelType
|
||||||
/// Gets or sets whether to cancel the capture phase.
|
{
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public CancelType Cancel { get; set; }
|
/// No cancel.
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
None,
|
||||||
/// Gets the end of job flag value for this transfer if job control is enabled.
|
/// <summary>
|
||||||
/// </summary>
|
/// Skips current transfer.
|
||||||
public TWEJ EndOfJobFlag { get; private set; }
|
/// </summary>
|
||||||
|
SkipCurrent,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the known pending transfer count. This may not be appilicable
|
/// Stops feeder but continue receiving already scanned images in the app.
|
||||||
/// for certain scanning modes.
|
/// </summary>
|
||||||
/// </summary>
|
Graceful,
|
||||||
public int PendingCount { get; private set; }
|
/// <summary>
|
||||||
|
/// Stops feeder and discard any pending images.
|
||||||
//TW_IMAGEINFO? _imgInfo;
|
/// </summary>
|
||||||
//private readonly TwainAppSession _twain;
|
EndNow
|
||||||
|
}
|
||||||
///// <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).
|
|
||||||
///// </summary>
|
|
||||||
//public TW_IMAGEINFO? PendingImageInfo
|
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// // only get it if requested since it could be slow
|
|
||||||
// if (!_imgInfo.HasValue)
|
|
||||||
// {
|
|
||||||
// if (_twain.GetImageInfo(out TW_IMAGEINFO info).RC == TWRC.SUCCESS)
|
|
||||||
// {
|
|
||||||
// _imgInfo = info;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return _imgInfo;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum CancelType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No cancel.
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
/// <summary>
|
|
||||||
/// Skips current transfer.
|
|
||||||
/// </summary>
|
|
||||||
SkipCurrent,
|
|
||||||
/// <summary>
|
|
||||||
/// Stops feeder but continue receiving already scanned images in the app.
|
|
||||||
/// </summary>
|
|
||||||
Graceful,
|
|
||||||
/// <summary>
|
|
||||||
/// Stops feeder and discard any pending images.
|
|
||||||
/// </summary>
|
|
||||||
EndNow
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace NTwain
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
var readyArgs = new TransferReadyEventArgs(pending.Count, (TWEJ)pending.EOJ);
|
var readyArgs = new TransferReadyEventArgs(imgXferMech, audXferMech, pending.Count, (TWEJ)pending.EOJ);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TransferReady?.Invoke(this, readyArgs);
|
TransferReady?.Invoke(this, readyArgs);
|
||||||
|
|||||||
Reference in New Issue
Block a user