Ejemplo n.º 1
0
        /// <summary>
        /// Enables the source to start transferring.
        /// </summary>
        /// <param name="mode">The mode.</param>
        /// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param>
        /// <param name="windowHandle">The window handle if modal.</param>
        /// <returns></returns>
        ReturnCode ITwainSessionInternal.EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle)
        {
            _closeRequested = false;
            DisableReason   = Message.Null;
            var rc = ReturnCode.Failure;

            _msgLoopHook?.Invoke(() =>
            {
                PlatformInfo.Current.Log.Debug("Thread {0}: EnableSource with {1}.", Thread.CurrentThread.ManagedThreadId, mode);


                _twui         = new TWUserInterface();
                _twui.ShowUI  = mode == SourceEnableMode.ShowUI;
                _twui.ModalUI = modal;
                _twui.hParent = windowHandle;

                if (mode == SourceEnableMode.ShowUIOnly)
                {
                    rc = ((ITwainSessionInternal)this).DGControl.UserInterface.EnableDSUIOnly(_twui);
                }
                else
                {
                    rc = ((ITwainSessionInternal)this).DGControl.UserInterface.EnableDS(_twui);
                }
            });
            return(rc);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Enables the source to start transferring.
 /// </summary>
 /// <param name="mode">The mode.</param>
 /// <param name="modal">if set to <c>true</c> any driver UI will display as modal.</param>
 /// <param name="windowHandle">The window handle if modal.</param>
 /// <returns></returns>
 public ReturnCode Enable(SourceEnableMode mode, bool modal, IntPtr windowHandle)
 {
     return(_session.EnableSource(mode, modal, windowHandle));
 }