コード例 #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Private Methods...
        ///////////////////////////////////////////////////////////////////////////////
        #region Private Methods...

        /// <summary>
        /// Prompt the user prior to scanning...
        /// </summary>
        /// <returns>the button they pressed...</returns>
        private TwainLocalScanner.ButtonPress ConfirmScan(float a_fScale)
        {
            // Let's make sure we do this in the right place...
            if (InvokeRequired)
            {
                m_buttonpress = TwainLocalScanner.ButtonPress.Cancel;
                Invoke(new MethodInvoker(delegate { m_buttonpress = ConfirmScan(a_fScale); }));
                return(m_buttonpress);
            }

            DialogResult dialogresult = DialogResult.No;
            ConfirmScan  confirmscan;

            // Ask the question...
            confirmscan = new ConfirmScan
                          (
                (int)Config.Get("confirmTimeout", 10000),
                (Config.Get("useBeep", "yes") == "yes"),
                a_fScale,
                m_scanner.GetSessionUserDns()
                          );
            dialogresult = confirmscan.ShowDialog(this);
            confirmscan.Dispose();
            confirmscan = null;

            // Okay...
            if (dialogresult == DialogResult.Yes)
            {
                return(TwainLocalScanner.ButtonPress.OK);
            }

            // Nope...
            return(TwainLocalScanner.ButtonPress.Cancel);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: loachfighter/twain-direct
        ///////////////////////////////////////////////////////////////////////////////
        // Private Methods...
        ///////////////////////////////////////////////////////////////////////////////
        #region Private Methods...

        /// <summary>
        /// Prompt the user prior to scanning...
        /// </summary>
        /// <returns>the button they pressed...</returns>
        private TwainLocalScanner.ButtonPress ConfirmScan(float a_fScale)
        {
            // Let's make sure we do this in the right place...
            if (InvokeRequired)
            {
                m_buttonpress = TwainLocalScanner.ButtonPress.Cancel;
                Invoke(new MethodInvoker(delegate { m_buttonpress = ConfirmScan(a_fScale); }));
                return(m_buttonpress);
            }

            DialogResult dialogresult = DialogResult.No;
            ConfirmScan  confirmscan;

            // Ask the question...
            confirmscan  = new ConfirmScan(a_fScale);
            dialogresult = confirmscan.ShowDialog(this);
            confirmscan.Dispose();
            confirmscan = null;

            // Okay...
            if (dialogresult == DialogResult.Yes)
            {
                return(TwainLocalScanner.ButtonPress.OK);
            }

            // Nope...
            return(TwainLocalScanner.ButtonPress.Cancel);
        }