Esempio n. 1
0
        private void DoautoCapture()
        {
            #region DoautoCapture
            int n;
            try
            {
                m_result = RS_SDK.RS_RemoveAllOverlay(deviceHandle);
                if (m_result != RS_SDK.RS_SUCCESS)
                {
                    if (MsgPanel.InvokeRequired)
                    {
                        afterAutoCaptureCallback callback = new afterAutoCaptureCallback(captureProcess);
                        try
                        {
                            this.Invoke(callback, m_result);
                        }
                        catch
                        {
                        }
                    }
                    else
                    {
                        RS_SDK.RS_GetErrString(m_result, ref m_errorMsg);
                        MsgPanel.Text = m_errorMsg;
                    }
                    return;
                }

                if (clbDedo.Visible)
                {
                    n = 0;

                    for (int i = 0; i < 4; i++)
                    {
                        if (clbDedo.GetItemChecked(i))
                        {
                            n++;
                        }
                    }

                    m_minCount = m_minCount - n;

                    m_result = RS_SDK.RS_SetMinimumFinger(deviceHandle, m_minCount);
                    if (m_result != RS_SDK.RS_SUCCESS)
                    {
                        RS_SDK.RS_GetErrString(m_result, ref m_errorMsg);
                        MsgPanel.Text = m_errorMsg;
                    }
                }
                else
                {
                    n = 0;

                    for (int i = 0; i < 2; i++)
                    {
                        if (clbPulgar.GetItemChecked(i))
                        {
                            n++;
                        }
                    }

                    m_minCount = m_minCount - n;

                    m_result = RS_SDK.RS_SetMinimumFinger(deviceHandle, m_minCount);
                    if (m_result != RS_SDK.RS_SUCCESS)
                    {
                        RS_SDK.RS_GetErrString(m_result, ref m_errorMsg);
                        MsgPanel.Text = m_errorMsg;
                    }
                }

                m_result = RS_SDK.RS_TakeImageData(deviceHandle, 10000, ref capturedImageData, ref capturedImageWidth, ref capturedImageHeight);

                if (m_result != RS_SDK.RS_SUCCESS)
                {
                    if (capturedImageData != (IntPtr)0)
                    {
                        RS_SDK.RS_FreeImageData(capturedImageData);
                    }
                }

                if (MsgPanel.InvokeRequired)
                {
                    afterAutoCaptureCallback callback = new afterAutoCaptureCallback(captureProcess);
                    try
                    {
                        this.Invoke(callback, m_result);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    RS_SDK.RS_GetErrString(m_result, ref m_errorMsg);
                    MsgPanel.Text = m_errorMsg;
                }
            }
            catch (Exception ex)
            {
                return;
            }
            #endregion
        }