Exemple #1
0
        ///////////////////////
        /// EnumerateDevice(), GetEnumDeviceInfo()
        /// EnumerateDevice() can be called before Initializing SGFingerPrintManager
        private void EnumerateBtn_Click(object sender, System.EventArgs e)
        {
            Int32  iError;
            string enum_device;

            cmbDeviceName.Items.Clear();

            // Enumerate Device
            iError = m_FPM.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];

            for (int i = 0; i < m_FPM.NumberOfDevice; i++)
            {
                m_DevList[i] = new SGFPMDeviceList();
                m_FPM.GetEnumDeviceInfo(i, m_DevList[i]);
                enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID;
                cmbDeviceName.Items.Add(enum_device);
            }

            if (cmbDeviceName.Items.Count > 0)
            {
                // Add Auto Selection
                enum_device = "Auto Selection";
                cmbDeviceName.Items.Add(enum_device);

                cmbDeviceName.SelectedIndex = 0;  //First selected one
            }
        }
Exemple #2
0
        private void btnEnum_Click(object sender, EventArgs e)
        {
            Int32  iError;
            string enumDevice;

            cmbDeviceName.Items.Clear();

            // Enumerate Device
            iError = _mFpm.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            _mDevList = new SGFPMDeviceList[_mFpm.NumberOfDevice];

            for (int i = 0; i < _mFpm.NumberOfDevice; i++)
            {
                _mDevList[i] = new SGFPMDeviceList();
                _mFpm.GetEnumDeviceInfo(i, _mDevList[i]);
                enumDevice = _mDevList[i].DevName.ToString() + " : " + _mDevList[i].DevID;
                cmbDeviceName.Items.Add(enumDevice);
            }

            if (cmbDeviceName.Items.Count > 0)
            {
                // Add Auto Selection
                enumDevice = "Auto Selection";
                cmbDeviceName.Items.Add(enumDevice);

                cmbDeviceName.SelectedIndex = 0; //First selected one
                Status.Text = @"A device found, click on Init button to activate device";
            }
            else
            {
                Status.Text = @"No device found. Connect a device and click on the Enum button";
            }
        }
Exemple #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            EnableButtons(false);
            // Init Button
            m_RadioButton = new RadioButton[11];


            m_SecurityLevel  = SGFPMSecurityLevel.NORMAL;
            m_StoredTemplate = null;
            m_ImageWidth     = 260;
            m_ImageHeight    = 300;
            m_Dpi            = 500;

            m_FPM = new SGFingerPrintManager();
            Int32  iError;
            string enum_device;

            comboBox1.Items.Clear();

            // Enumerate Device
            iError = m_FPM.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];

            for (int i = 0; i < m_FPM.NumberOfDevice; i++)
            {
                m_DevList[i] = new SGFPMDeviceList();
                m_FPM.GetEnumDeviceInfo(i, m_DevList[i]);
                enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID;
                comboBox1.Items.Add(enum_device);
            }

            if (comboBox1.Items.Count > 0)
            {
                // Add Auto Selection
                enum_device = "Auto Selection";
                comboBox1.Items.Add(enum_device);

                comboBox1.SelectedIndex = 0;  //First selected one
            }

            StatusBar.Text = "Click Init Button";

            if (m_useAnsiTemplate)
            {
                StatusBar.Text = "Format used: ANSI 378 Format";
            }
            else
            {
                StatusBar.Text = "Format used: ISO 19794-2 Format";
            }
        }
Exemple #4
0
        private void Attendance_Load(object sender, EventArgs e)
        {
            m_LedOn = false;

            m_SecurityLevel  = SGFPMSecurityLevel.NORMAL;
            m_StoredTemplate = null;
            m_ImageWidth     = 260;
            m_ImageHeight    = 300;
            m_Dpi            = 500;

            EnableButtons(false);


            m_FPM = new SGFingerPrintManager();
            Int32  iError;
            string enum_device;

            comboBox2.Items.Clear();

            // Enumerate Device
            iError = m_FPM.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];

            for (int i = 0; i < m_FPM.NumberOfDevice; i++)
            {
                m_DevList[i] = new SGFPMDeviceList();
                m_FPM.GetEnumDeviceInfo(i, m_DevList[i]);
                enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID;
                comboBox2.Items.Add(enum_device);
            }

            if (comboBox2.Items.Count > 0)
            {
                // Add Auto Selection
                enum_device = "Auto Selection";
                comboBox2.Items.Add(enum_device);

                comboBox2.SelectedIndex = 0;  //First selected one
            }
        }
        private void EnumerateBtn_Click(object sender, System.EventArgs e)
        {
            Int32  iError;
            string enum_device;

            // Enumerate Device
            iError = m_FPM.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];

            if (m_FPM.NumberOfDevice == 0)
            {
                return;
            }

            //DisplayError("OpenDevice()", iError);

            m_DevList[0] = new SGFPMDeviceList();
            m_FPM.GetEnumDeviceInfo(0, m_DevList[0]);
            enum_device = m_DevList[0].DevName.ToString() + " : " + m_DevList[0].DevID;

            SGFPMDeviceName device_name;
            Int32           device_id;


            device_name = m_DevList[0].DevName;
            device_id   = m_DevList[0].DevID;

            iError = m_FPM.Init(device_name);
            iError = m_FPM.OpenDevice(device_id);

            if (iError == (Int32)SGFPMError.ERROR_NONE)
            {
                GetBtn_Click(sender, e);
                //panel1.Visible = false;
            }
            else
            {
            }
        }
Exemple #6
0
        public void EnumerateDevices()
        {
            Int32 iError;

            SGFPMDeviceList[] m_DevList = null; // Used for EnumerateDevice

            // Enumerate Device


            //            return;
            // Get enumeration info into SGFPMDeviceList
            //m_FPM = new SGFingerPrintManager();
            iError    = m_FPM.EnumerateDevice();
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];


            for (int i = 0; i < m_FPM.NumberOfDevice; i++)
            {
                m_DevList[i] = new SGFPMDeviceList();
                m_FPM.GetEnumDeviceInfo(i, m_DevList[i]);
                if (ActiveDevices.OfType <DeviceSG>().Any(item =>
                                                          item.devId == m_DevList[i].DevID &&
                                                          item.devName == m_DevList[i].DevName))
                {
                    continue;
                }

                DeviceSG device = new DeviceSG(m_DevList[i].DevID, m_DevList[i].DevName, "SecuGen " + m_DevList[i].DevName.ToString().Remove(0, 4));

                ActiveDevices.Add(device);
            }

            List <DeviceSG> deleteList = new List <DeviceSG>();
            Dictionary <SGFPMDeviceName, int> devCount = new Dictionary <SGFPMDeviceName, int>();

            foreach (var device in ActiveDevices.OfType <DeviceSG>())
            {
                bool toDelete = true;
                for (int i = 0; i < m_FPM.NumberOfDevice; i++)
                {
                    if (m_DevList[i].DevID == device.devId &&
                        m_DevList[i].DevName == device.devName)
                    {
                        toDelete = false;
                    }
                }
                if (toDelete)
                {
                    device.Dispose();
                    deleteList.Add(device);
                }
            }
            foreach (var device in deleteList)
            {
                ActiveDevices.Remove(device);
            }
            foreach (var device in ActiveDevices.OfType <DeviceSG>())
            {
                var count = 0;
                if (ActiveDevices.OfType <DeviceSG>().Count(item => item.devName == device.devName) > 1)
                {
                    if (!devCount.Keys.Contains(device.devName))
                    {
                        count = 1;
                        devCount.Add(device.devName, 1);
                    }
                    else
                    {
                        count = ++devCount[device.devName];
                    }
                }
                device.count = count;
            }
        }