Exemple #1
0
 /// <summary>
 /// Creates the specified DS.
 /// </summary>
 /// <param name="dsm">The DSM.</param>
 /// <param name="index">The index of a DS.</param>
 /// <returns>Instance of a XDs class.</returns>
 public static XDs Create(XDsm dsm, int index)
 {
     return(new Extensions.XDs {
         Dsm = dsm,
         _index = index
     });
 }
 /// <summary>
 /// Create instance of a XDsm class.
 /// </summary>
 /// <param name="isTwain2Enable">if set to <c>true</c> is a TWAIN2.x enable.</param>
 /// <param name="isShowUI">if set to <c>true</c> is show UI of a Data Source.</param>
 /// <param name="language">The language.</param>
 /// <param name="country">The country.</param>
 /// <returns></returns>
 public static XDsm Create(bool isTwain2Enable = false, bool isShowUI = true, TwLanguage language = TwLanguage.RUSSIAN, TwCountry country = TwCountry.BELARUS)
 {
     return(XDsm.Create(
                new Twain32 {
         IsTwain2Enable = isTwain2Enable,
         ShowUI = isShowUI,
         Language = language,
         Country = country
     },
                true));
 }
        /// <summary>
        /// Create instance of a XDsm class.
        /// </summary>
        /// <param name="twain32">Instance of the Twain32 class.</param>
        /// <param name="isOwns">If set to <c>true</c> is owner of instance of the Twain32 class.</param>
        /// <returns></returns>
        public static XDsm Create(Twain32 twain32, bool isOwns = false)
        {
            XDsm _dsm = null;

            try {
                return(_dsm = new XDsm {
                    _twain32 = twain32,
                    _isOwns = isOwns
                });
            } finally {
                twain32.EndXfer            += _dsm._EndXfer;
                twain32.XferDone           += _dsm._XferDone;
                twain32.SetupMemXferEvent  += _dsm._SetupMemXferEvent;
                twain32.MemXferEvent       += _dsm._MemXferEvent;
                twain32.SetupFileXferEvent += _dsm._SetupFileXferEvent;
                twain32.FileXferEvent      += _dsm._FileXferEvent;
                twain32.AcquireCompleted   += _dsm._AcquireCompleted;
                twain32.AcquireError       += _dsm._AcquireError;
            }
        }