// The MIT License (MIT) // Copyright (c) 2013 Yin-Chun Wang // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using NTwain.Data; using NTwain.Values; using NTwain.Values.Cap; 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, ImageFileFormat 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 ImageFileFormat _imageFormat; /// /// Gets or sets the image format for image xfer. /// /// /// The image format. /// /// public ImageFileFormat 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; } } }