コード例 #1
0
        partial void BtnAskForNewCode_TouchUpInside(UIButton sender)
        {
            //if fields are empty
            if (String.IsNullOrEmpty(tfNickNameField.Text))
            {
                BarHelper.DisplayErrorBar(uivMainView, MSGBank.ERROR_TITLE, "Vous devez remplir le champ 'Nom d'utilisateur'");
                return;
            }

            //send packet to server
            ServerPacketConfirmation serverPacketConfirmation = ServerHelper.AskResetUserPassword(tfNickNameField.Text);

            //if success
            if (serverPacketConfirmation.ActionSuccess)
            {
                BarHelper.DisplayInfoBar(uivMainView, "Restauration de mot de passe", "Un nouveau code de restauration de mot de passe vous a été envoyé par mail !");
                btnAskForNewCode.Enabled = false;
                return;
            }

            //chose right error message
            String messageError = string.Empty;

            switch (serverPacketConfirmation.NetworkError)
            {
            case NetworkError.GLOBAL_UNKNOWN:
                goto default;

            case NetworkError.SERVER_UNAVAILABLE:
                messageError = MSGBank.ERROR_NO_SERVER;
                break;

            case NetworkError.SQL_USER_UNKNOWN:
                messageError = MSGBank.ERROR_UNKNOWN_USER;
                break;

            default:
                messageError = MSGBank.ERROR_UNKNOWN;
                break;
            }
            BarHelper.DisplayErrorBar(uivMainView, MSGBank.ERROR_TITLE, messageError);
        }