using NTwain.Data;
using System;
namespace NTwain
{
///
/// Contains event data when a data transfer is ready to be processed.
///
public class TransferReadyEventArgs : EventArgs
{
///
/// Initializes a new instance of the class.
///
/// The source.
/// The pending count.
///
public TransferReadyEventArgs(DataSource source, int pendingCount, EndXferJob endOfJobFlag)
{
DataSource = source;
PendingTransferCount = pendingCount;
EndOfJobFlag = endOfJobFlag;
}
///
/// Gets the data source.
///
///
/// The data source.
///
public DataSource DataSource { get; private set; }
///
/// Gets or sets a value indicating whether the current transfer should be canceled
/// and continue next transfer if there are more data.
///
/// true to cancel current transfer; otherwise, false.
public bool CancelCurrent { get; set; }
///
/// Gets or sets a value indicating whether all transfers should be canceled.
///
/// true to cancel all transfers; otherwise, false.
public bool CancelAll { get; set; }
///
/// Gets a value indicating whether current transfer signifies an end of job in TWAIN world.
///
/// true if transfer is end of job; otherwise, false.
public bool EndOfJob { get { return EndOfJobFlag != EndXferJob.None; } }
///
/// Gets the end of job flag value for this transfer (if job control is enabled).
///
///
/// The end of job flag.
///
public EndXferJob EndOfJobFlag { get; private set; }
///
/// Gets the known pending transfer count. This may not be appilicable
/// for certain scanning modes.
///
/// The pending count.
public int PendingTransferCount { get; private set; }
TWImageInfo _imgInfo;
///
/// 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).
///
///
/// The image info.
///
public TWImageInfo PendingImageInfo
{
get
{
if (_imgInfo == null)
{
if (DataSource.DGImage.ImageInfo.Get(out _imgInfo) != ReturnCode.Success)
{
_imgInfo = null;
}
}
return _imgInfo;
}
}
TWAudioInfo _audInfo;
///
/// Gets the audio information for the current transfer if applicable.
///
///
/// The audio information.
///
public TWAudioInfo AudioInfo
{
get
{
if (_audInfo == null)
{
if (DataSource.DGAudio.AudioInfo.Get(out _audInfo) != ReturnCode.Success)
{
_audInfo = null;
}
}
return _audInfo;
}
}
}
}