using System; using NTwain.Data; using NTwain.Values; using System.Collections.Generic; 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 pending data. /// The formats. /// The current format. /// The compressions. /// The current compression. /// if set to true then allow file xfer properties. /// The image info. internal TransferReadyEventArgs(TWPendingXfers pending, IList supportedFormats, FileFormat currentFormat, IList supportedCompressions, Compression currentCompression, bool canDoFileXfer, TWImageInfo imageInfo) { PendingCount = pending.Count; EndOfJob = pending.EndOfJob; _imageCompression = currentCompression; SupportedCompressions = supportedCompressions; _imageFormat = currentFormat; SupportedFormats = supportedFormats; CanDoFileXfer = canDoFileXfer; ImageInfo = imageInfo; } /// /// Gets the image info for the current transfer. /// /// /// The image info. /// public TWImageInfo ImageInfo { get; private set; } /// /// Gets the known pending transfer count. This may not be appilicable /// for certain scanning modes. /// /// The pending count. public int PendingCount { get; private set; } /// /// Gets a value indicating whether current transfer signifies an end of job. /// /// true if transfer is end of job; otherwise, false. public bool EndOfJob { 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 or sets a value indicating whether file transfer is supported. /// /// /// true if this instance can do file transfer; otherwise, false. /// public bool CanDoFileXfer { get; private set; } /// /// Gets or sets the desired output file path if file transfer is supported. /// Note that not all sources will support the specified image type and compression /// when file transfer is used. /// /// /// The output file. /// public string OutputFile { get; set; } /// /// Gets the supported compression for image xfer. /// /// /// The supported compressions. /// public IList SupportedCompressions { get; private set; } private Compression _imageCompression; /// /// Gets or sets the image compression for image xfer. /// /// /// The image compression. /// /// public Compression ImageCompression { get { return _imageCompression; } set { if (SupportedCompressions.Contains(value)) { _imageCompression = value; } else { throw new NotSupportedException(string.Format("{0} is not supported.", value)); } } } /// /// Gets the supported file formats for image file xfer. /// /// /// The supported formats. /// public IList SupportedFormats { get; private set; } private FileFormat _imageFormat; /// /// Gets or sets the image format for image xfer. /// /// /// The image format. /// /// public FileFormat ImageFormat { get { return _imageFormat; } set { if (SupportedFormats.Contains(value)) { _imageFormat = value; } else { throw new NotSupportedException(string.Format("{0} is not supported.", value)); } } } ///// ///// Gets or sets the audio file format if is specified ///// and the data to be transferred is audio. ///// ///// ///// The audio file format. ///// //public AudioFileFormat AudioFileFormat { get; set; } } }