コード例 #1
0
        private void refreshAvailablePoKeysList()
        {
            AvailablePoKeysList.Clear();

            List <PoKeysDeviceInfo> devices = PoKeysDevice.EnumeratePoKeysDevices(true, true, true);

            foreach (PoKeysDeviceInfo device in devices)
            {
                if (PoKeysDevice.ConnectToDevice(device))
                {
                    int    pokeysSerial = PoKeysDevice.GetDeviceSerialNumber();
                    string pokeysName   = PoKeysDevice.GetDeviceName();

                    byte pokeysUserId   = 0;
                    bool pokeysUserIdOk = false;
                    if (PoKeysDevice.GetUserID(ref pokeysUserId))
                    {
                        pokeysUserIdOk = true;
                    }

                    AvailablePoKeys availablePoKeys = new AvailablePoKeys(pokeysSerial, pokeysName, pokeysUserIdOk ? pokeysUserId : (byte?)null, device);
                    AvailablePoKeysList.Add(availablePoKeys);

                    PoKeysDevice.DisconnectDevice();
                }
            }
        }
コード例 #2
0
        private void refreshAvailablePoKeysList()
        {
            AvailablePoKeysList.Clear();

            int nbPokeys = PoKeysDevice.EnumerateDevices();

            for (int pokeysIndex = 0; pokeysIndex < nbPokeys; ++pokeysIndex)
            {
                if (PoKeysDevice.ConnectToDevice(pokeysIndex))
                {
                    int    pokeysSerial = PoKeysDevice.GetDeviceSerialNumber();
                    string pokeysName   = PoKeysDevice.GetDeviceName();

                    byte pokeysUserId   = 0;
                    bool pokeysUserIdOk = false;
                    if (PoKeysDevice.GetUserID(ref pokeysUserId))
                    {
                        pokeysUserIdOk = true;
                    }

                    AvailablePoKeys availablePoKeys = new AvailablePoKeys(pokeysSerial, pokeysName, pokeysUserIdOk ? pokeysUserId : (byte?)null, pokeysIndex);
                    AvailablePoKeysList.Add(availablePoKeys);

                    PoKeysDevice.DisconnectDevice();
                }
            }
        }