Files
ntwain/src/NTwain/TransferReadyEventArgs.cs

105 lines
3.5 KiB
C#
Raw Normal View History

2014-04-17 19:11:11 -04:00
using NTwain.Data;
using System;
2014-04-02 19:01:21 -04:00
namespace NTwain
{
/// <summary>
/// Contains event data when a data transfer is ready to be processed.
/// </summary>
public class TransferReadyEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="TransferReadyEventArgs"/> class.
/// </summary>
2015-03-27 07:30:37 -04:00
/// <param name="source">The source.</param>
/// <param name="pendingCount">The pending count.</param>
2015-03-27 07:30:37 -04:00
/// <param name="endOfJob">if set to <c>true</c> then it's the end of job.</param>
public TransferReadyEventArgs(DataSource source, int pendingCount, bool endOfJob)
{
2015-03-27 07:30:37 -04:00
DataSource = source;
PendingTransferCount = pendingCount;
EndOfJob = endOfJob;
}
2015-03-27 07:30:37 -04:00
/// <summary>
/// Gets the data source.
/// </summary>
/// <value>
/// The data source.
/// </value>
public DataSource DataSource { get; private set; }
2014-04-02 19:01:21 -04:00
/// <summary>
/// Gets or sets a value indicating whether the current transfer should be canceled
/// and continue next transfer if there are more data.
/// </summary>
/// <value><c>true</c> to cancel current transfer; otherwise, <c>false</c>.</value>
public bool CancelCurrent { get; set; }
/// <summary>
/// Gets or sets a value indicating whether all transfers should be canceled.
/// </summary>
/// <value><c>true</c> to cancel all transfers; otherwise, <c>false</c>.</value>
public bool CancelAll { get; set; }
/// <summary>
/// Gets a value indicating whether current transfer signifies an end of job in TWAIN world.
2014-04-02 19:01:21 -04:00
/// </summary>
/// <value><c>true</c> if transfer is end of job; otherwise, <c>false</c>.</value>
public bool EndOfJob { get; private set; }
2014-04-02 19:01:21 -04:00
/// <summary>
/// Gets the known pending transfer count. This may not be appilicable
/// for certain scanning modes.
2014-04-02 19:01:21 -04:00
/// </summary>
/// <value>The pending count.</value>
public int PendingTransferCount { get; private set; }
2015-03-27 07:30:37 -04:00
TWImageInfo _imgInfo;
2014-04-02 19:01:21 -04:00
/// <summary>
/// Gets the tentative image information for the current transfer if applicable.
2014-04-10 07:30:00 -04:00
/// This may differ from the final image depending on the transfer mode used (mostly when doing mem xfer).
2014-04-02 19:01:21 -04:00
/// </summary>
/// <value>
/// The image info.
2014-04-02 19:01:21 -04:00
/// </value>
2015-03-27 07:30:37 -04:00
public TWImageInfo PendingImageInfo
{
get
{
if (_imgInfo == null)
{
if (DataSource.DGImage.ImageInfo.Get(out _imgInfo) != ReturnCode.Success)
{
_imgInfo = null;
}
}
return _imgInfo;
}
}
2014-04-02 19:01:21 -04:00
2015-03-27 07:30:37 -04:00
TWAudioInfo _audInfo;
/// <summary>
/// Gets the audio information for the current transfer if applicable.
/// </summary>
/// <value>
/// The audio information.
/// </value>
2015-03-27 07:30:37 -04:00
public TWAudioInfo AudioInfo
{
get
{
if (_audInfo == null)
{
if (DataSource.DGAudio.AudioInfo.Get(out _audInfo) != ReturnCode.Success)
{
_audInfo = null;
}
}
return _audInfo;
}
}
2014-04-02 19:01:21 -04:00
}
}