diff --git a/src/NTwain/TransferReadyEventArgs.cs b/src/NTwain/TransferReadyEventArgs.cs index 9b88486..b7b4120 100644 --- a/src/NTwain/TransferReadyEventArgs.cs +++ b/src/NTwain/TransferReadyEventArgs.cs @@ -3,76 +3,88 @@ using System; namespace NTwain { - /// - /// Contains event data when a data transfer is ready to be processed. - /// - public class TransferReadyEventArgs : EventArgs - { - public TransferReadyEventArgs(int pendingCount, TWEJ endOfJobFlag) + /// + /// Contains event data when a data transfer is ready to be processed. + /// + public class TransferReadyEventArgs : EventArgs { - //_twain = twain; - PendingCount = pendingCount; - EndOfJobFlag = endOfJobFlag; + public TransferReadyEventArgs(TWSX imgXferMech, TWSX audXferMech, int pendingCount, TWEJ endOfJobFlag) + { + ImgXferMech = imgXferMech; + AudXferMech = audXferMech; + //_twain = twain; + PendingCount = pendingCount; + EndOfJobFlag = endOfJobFlag; + } + + /// + /// Gets or sets whether to cancel the capture phase. + /// + public CancelType Cancel { get; set; } + + /// + /// Gets the end of job flag value for this transfer if job control is enabled. + /// + public TWEJ EndOfJobFlag { get; } + + /// + /// Gets the current transfer mech if working with images. + /// + public TWSX ImgXferMech { get; } + + /// + /// Gets the current transfer mech if working with audio. + /// + public TWSX AudXferMech { get; } + + /// + /// Gets the known pending transfer count. This may not be appilicable + /// for certain scanning modes. + /// + public int PendingCount { get; private set; } + + //TW_IMAGEINFO? _imgInfo; + //private readonly TwainAppSession _twain; + + ///// + ///// 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). + ///// + //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; + // } + //} + } - /// - /// Gets or sets whether to cancel the capture phase. - /// - public CancelType Cancel { get; set; } - - /// - /// Gets the end of job flag value for this transfer if job control is enabled. - /// - public TWEJ EndOfJobFlag { get; private set; } - - /// - /// Gets the known pending transfer count. This may not be appilicable - /// for certain scanning modes. - /// - public int PendingCount { get; private set; } - - //TW_IMAGEINFO? _imgInfo; - //private readonly TwainAppSession _twain; - - ///// - ///// 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). - ///// - //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 - { - /// - /// No cancel. - /// - None, - /// - /// Skips current transfer. - /// - SkipCurrent, - /// - /// Stops feeder but continue receiving already scanned images in the app. - /// - Graceful, - /// - /// Stops feeder and discard any pending images. - /// - EndNow - } + public enum CancelType + { + /// + /// No cancel. + /// + None, + /// + /// Skips current transfer. + /// + SkipCurrent, + /// + /// Stops feeder but continue receiving already scanned images in the app. + /// + Graceful, + /// + /// Stops feeder and discard any pending images. + /// + EndNow + } } diff --git a/src/NTwain/TwainAppSession.Xfers.cs b/src/NTwain/TwainAppSession.Xfers.cs index b7b008b..05437f4 100644 --- a/src/NTwain/TwainAppSession.Xfers.cs +++ b/src/NTwain/TwainAppSession.Xfers.cs @@ -66,7 +66,7 @@ namespace NTwain { do { - var readyArgs = new TransferReadyEventArgs(pending.Count, (TWEJ)pending.EOJ); + var readyArgs = new TransferReadyEventArgs(imgXferMech, audXferMech, pending.Count, (TWEJ)pending.EOJ); try { TransferReady?.Invoke(this, readyArgs);