Example #1
0
        private void ReadSmartCardsThread()
        {
            _cardReaderArray.Clear();

            List <string> cardUserList = UserManager.GetCardReaderNames();

            for (int index = 0; index < cardUserList.Count; index++)
            {
                string       cardUserName = cardUserList[index];
                CardUserInfo cardUserInfo = new CardUserInfo(index, cardUserName);
                _cardReaderArray.Add(cardUserInfo);
            }
        }
Example #2
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            AuthenticateUserEventArgs ea = null;

            if (checkBoxCardReader.Checked)
            {
                bool         validateCardUserPinOnly = (this.Options == LoginDialogOptions.AddUser);
                CardUserInfo cardUserInfo            = comboBoxCacCard.SelectedItem as CardUserInfo;
                if (cardUserInfo != null)
                {
                    ea = new AuthenticateUserEventArgs(cardUserInfo.CardUserIndex, textBoxCacPin.Text, validateCardUserPinOnly);
                }
            }
            else
            {
                ea = new AuthenticateUserEventArgs(textBoxUserName.Text, textBoxPassword.Text.ToSecureString());
            }

            if (ea == null)
            {
                return;
            }

            AuthenticateUser(this, ea);
            if (ea.Cancel)
            {
                DialogResult = DialogResult.Cancel;
            }

            if (ea.InvalidCredentials)
            {
                DialogResult         = DialogResult.None;
                textBoxPassword.Text = string.Empty;
                textBoxCacPin.Text   = string.Empty;

                if (checkBoxCardReader.Checked)
                {
                    comboBoxCacCard.Focus();
                }
                else
                {
                    textBoxUserName.Focus();
                }
            }

            if (checkBoxCardReader.Checked)
            {
                this.EdiNumber = ea.EdiNumber;
            }
        }
Example #3
0
        private void Credentials_Changed(object sender, EventArgs e)
        {
            if (this.checkBoxCardReader.Checked)
            {
                buttonLogin.Enabled = comboBoxCacCard.Items.Count > 0 && textBoxCacPin.Text.Length > 0;
            }
            else
            {
                buttonLogin.Enabled = textBoxUserName.Text.Length > 0 && textBoxPassword.Text.Length > 0;
            }

#if LEADTOOLS_V19_OR_LATER
            CardUserInfo selectedCardUser = comboBoxCacCard.SelectedItem as CardUserInfo;
            if (selectedCardUser != null)
            {
                this.textBoxCacPin.Enabled = UserManager.IsUserCardReaderReady(selectedCardUser.CardUserIndex);
            }
#endif
        }