예제 #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
        ///////////////////////////////////////////////////////////////////////////////
        // 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);
        }