Exemple #1
0
        private void connection()
        {
            user = new ConnexionUtilisateur();
            DialogResult state = user.ShowDialog();

            /*while (state == DialogResult.Cancel)
             * {
             *  state = user.ShowDialog();
             * }*/

            if (state == DialogResult.OK)
            {
                String uname = user.getUserName(), pass = user.getPassword();
                while (!lite.userConnection(uname, pass))
                {
                    MessageBox.Show("vos identifiants sont incorrects", "erreur connexion", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    user.initPassword();
                    user.setpasswordFocus();
                    state = user.ShowDialog();
                    if (state == DialogResult.Cancel)
                    {
                        break;
                    }
                    uname = user.getUserName();
                    pass  = user.getPassword();
                }
                if (state == DialogResult.Cancel)
                {
                    guessAccess();
                }
                else
                {
                    //MessageBox.Show("connexion reussie", "succes connexion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    connectedUser();
                    //connected = true;
                }
            }
            else
            {
                guessAccess();
            }
            user.Dispose();
            menuStrip1.BackColor = Color.Black;
            menuStrip1.ForeColor = Color.White;
        }