mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:15:42 +08:00
Add xfermech info to transfer ready event.
This commit is contained in:
parent
e107a927b3
commit
f205d73f64
@ -3,76 +3,88 @@ using System;
|
||||
|
||||
namespace NTwain
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains event data when a data transfer is ready to be processed.
|
||||
/// </summary>
|
||||
public class TransferReadyEventArgs : EventArgs
|
||||
{
|
||||
public TransferReadyEventArgs(int pendingCount, TWEJ endOfJobFlag)
|
||||
/// <summary>
|
||||
/// Contains event data when a data transfer is ready to be processed.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// 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; private set; }
|
||||
|
||||
/// <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;
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
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
|
||||
{
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user