/// <summary>
        /// Helper function which shows a message dialog box for the given message.
        /// </summary>
        /// <param name="message">The error message to display</param>
        private void ShowInvalidPINMessage(string message)
        {
            var result = MessageBox.Show(message);

            if (result == MessageBoxResult.OK)
            {
                TxtPin.Password = "";
                TxtPin.Focus();
            }
        }
Beispiel #2
0
        private void ObtenerInfo()
        {
            if (certificadoP12 == null)
            {
                MessageBox.Show("Debe de seleccionar una llave criptográfica", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                TxtPin.Focus();
            }

            string certTemp = certificadoP12;

            if (!certTemp.EndsWith(".p12"))
            {
                MessageBox.Show("El archivo seleccionado no es una llave criptográfica", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!string.IsNullOrEmpty(TxtPin.Text))
            {
                try
                {
                    pinCertificado = TxtPin.Text;
                    cert           = new X509Certificate2(rutayArchivo, pinCertificado);
                    MostrarDatosCertificado();
                }
                catch (Exception)
                {
                    MessageBox.Show("El PIN ingresado es incorrecto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("Debe ingresar un PIN numérico de 4 digitos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void OnErrorOccurred(object sender, EventArgs e)
        {
            if (_manageDriverViewModel.IsErrorInFirstName)
            {
                LblErrorMsg.Text = "First Name must be not null and contains alphabet only.";
                TxtFirstName.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInLastName)
            {
                LblErrorMsg.Text = "Last Name must be not null and contains alphabet only.";
                TxtLastName.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInUsername && _manageDriverViewModel.IsAddingDriver)
            {
                LblErrorMsg.Text = string.IsNullOrEmpty(_manageDriverViewModel.ErrorMessage) ? "Username must be not null and contains alphanumberic only." : _manageDriverViewModel.ErrorMessage;;
                TxtUsername.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInPin)
            {
                LblErrorMsg.Text = "Pin number must be four digit only, no any aphabet allowed.";
                TxtPin.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInGroup)
            {
                LblErrorMsg.Text = "Please select any Group.";
                CBGroup.Focus();
                return;
            }
        }